Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inlined external PUML breaks when PUML has an include #362

Open
asgrim opened this issue Feb 5, 2024 · 0 comments · May be fixed by #387
Open

Inlined external PUML breaks when PUML has an include #362

asgrim opened this issue Feb 5, 2024 · 0 comments · May be fixed by #387
Labels
bug Something isn't working

Comments

@asgrim
Copy link
Member

asgrim commented Feb 5, 2024

Issue description

When an external PlantUML diagram that itself has an include, such as:

@startuml
!include external-diagram.puml
@enduml

is included by way of an inline using \Roave\DocbookTool\Formatter\InlineExternalImages, since the diagram is written to a temporary path to be rendered by PlantUML in \Roave\DocbookTool\Formatter\RenderPlantUmlDiagramInline, it becomes disconnected from the original source tree, and therefore the !include directive cannot be resolved.

Example test case

Example reproducer in our test suite:

$ git diff --cached
diff --git a/test/fixture/docbook/diagram-with-include.puml b/test/fixture/docbook/diagram-with-include.puml
new file mode 100644
index 0000000..f393672
--- /dev/null
+++ b/test/fixture/docbook/diagram-with-include.puml
@@ -0,0 +1,4 @@
+@startuml
+!include external-diagram.puml
+Bob<-Alice : hello2
+@enduml
diff --git a/test/fixture/docbook/test.md b/test/fixture/docbook/test.md
index 8f3490b..c661eb5 100644
--- a/test/fixture/docbook/test.md
+++ b/test/fixture/docbook/test.md
@@ -66,3 +66,5 @@ They are hand drawn, that's why they look rubbish.
 ## Inline PUML file
 
 ![An external PlantUML diagram](./external-diagram.puml)
+
+![An external PlantUML diagram with an include](./diagram-with-include.puml)

Workaround

Suggested workaround for consumers who encounter this bug until fixed: copy the necessary diagrams into /tmp before build, e.g.:

FROM builder AS built

# Temporary workaround for https://github.com/Roave/DocbookTool/issues/362
RUN cp -rvf /docs-src/diagrams/* /tmp

RUN bin/docbook-tool --html --pdf
@asgrim asgrim added the bug Something isn't working label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant