Can use !include $var

0 votes
asked Jun 20 in Question / help by EGR

Can the !include directive be used where the parameter is a variable?

@startuml

!$v = "/Users/Projects/classA.puml"

!include $v

@enduml

1 Answer

0 votes
answered Jun 20 by kirchsth (6,240 points)

Hello @EGR,

!include with variables is basically working, you can even combine it with fix parts like in following sample (click on the image and you see the source)



Based on the /Users/....  it looks for me like a problem with local files.
Does it work if you use the path directly?
Did you check this link? How to pass a search path for "!include" files ? - PlantUML Q&A

commented Jun 20 by egr

@Kirchsth:
Indeed, it is a path to a local file, on macOS.
This path is just an example.
I have tested the include from a variable, it works correctly if it is from Github.

Regards

EGR

commented Jun 21 by kirchsth (6,240 points)

Hi @EGR

is following working?

@startuml

!include "/Users/Projects/classA.puml"

@enduml

BR Helmut

...