Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-DIAG-068

A {uml} directive renders a PUML file as a render dependency

When a {uml} directive or a {plantuml} directive without a body names a file, the extension SHALL render the diagram stored in that file, using the file text as the diagram and as the expandable source and recording the file name on the diagram element, record the file as a dependency of the render, or show the reason it cannot be read in place of the diagram.

Step 1 of path 2 in StRS-MDOKFSTUDIO-DIAG-009: from “A uml directive names a PUML file” to “The diagram of the file is drawn”.

Scenarios 8

The situations the tests check; open one to read it.

nominalFile diagram
Givena {uml} directive and a {plantuml} directive without a body, both naming diagrams/flow.puml
Whenthe preview is rendered
Thenboth figures hold the file text as diagram and source, with data-plantuml-file equal to diagrams/flow.puml and data-plantuml-base equal to the file's real path
boundaryOptions only
Givena {plantuml} directive whose body holds only a :caption: option
Whenthe preview is rendered
Thenit is treated as body-less, the file is rendered and the caption is not shown
nominalDependency
Givena {uml} directive naming an existing file
a {plantuml} directive with a body
Whenthe preview is rendered
the preview is rendered
Thenthe file's real path is in the render dependencies
no file dependency is recorded for it
refusalFiles that are not read

The refusal message replaces the diagram, no diagram figure is produced and one warning is reported for the line.

InputOutcome
Path outside the allowed folders (outside the workspace; Restricted Mode keeps to the document's folder)a message says the file is outside the folders the preview reads
Absolute path (a Windows drive path such as C:\diagrams\a.puml included) or URLthe message says the path must be a relative path to a local file
File larger than 5 MiBthe message says the file is larger than the 5 MiB preview limit
refusalMissing file
Givena {uml} directive naming diagrams/later.puml that does not exist
the file is created afterwards
Whenthe preview is rendered
the preview renders again
Thenthe message PlantUML file not found: diagrams/later.puml. appears with a warning on line 1 and the missing path is a dependency
the diagram appears
refusalBudget exhausted
Givena render whose include budget is used up and a {uml} directive after it, or two such directives
Whenthe preview is rendered
Theneach diagram is replaced by the message that the file was not read because the include budget of this render is exhausted, and only one budget warning is reported for the render
boundaryDirectives without file or body
InputOutcome
{uml} with no argument and no bodythe message The {uml} directive needs a diagram file path or a diagram body. appears in place of the diagram and a warning is reported
{plantuml} with no argument and no bodyno such message; the diagram is an empty figure
nominalInclude base of nested diagrams

A diagram that comes from an included document or from a {uml} file resolves its !include lines next to that file.

InputOutcome
plantuml fence in a document included by {include}data-plantuml-base equal to the included document
{uml} diagram in an included documentdata-plantuml-base equal to its own file
plantuml fence in the previewed document itselfno data-plantuml-base; includes resolve next to the document

Implemented in 2

Tested by 4

Known limits (1)

Replaces

SwRS-MDOKFSTUDIO-DIAG-069A diagram file is a dependency of the render superseded superseded by SwRS-MDOKFSTUDIO-DIAG-068 Markdown file
SwRS-MDOKFSTUDIO-DIAG-070An unreadable diagram file shows its refusal superseded superseded by SwRS-MDOKFSTUDIO-DIAG-068 Markdown file
SwRS-MDOKFSTUDIO-DIAG-071A missing diagram file is reported and watched superseded superseded by SwRS-MDOKFSTUDIO-DIAG-068 Markdown file
SwRS-MDOKFSTUDIO-DIAG-072An exhausted include budget stops diagram files superseded superseded by SwRS-MDOKFSTUDIO-DIAG-068 Markdown file
SwRS-MDOKFSTUDIO-DIAG-073A {uml} directive without file or body says so superseded superseded by SwRS-MDOKFSTUDIO-DIAG-068 Markdown file
SwRS-MDOKFSTUDIO-DIAG-074Nested diagrams resolve includes next to their own file superseded superseded by SwRS-MDOKFSTUDIO-DIAG-068 Markdown file