access to filename

0 votes
asked Jun 26 in Wanted features by boshka (1,320 points)
edited Jun 26 by boshka


Q1: Am I able to access the output filename (without extention) inside the @startuml?


Q2: Why this does result in the full file name?

@startuml test.svg
     note right: %filename%

1 Answer

0 votes
answered Jun 28 by plantuml (134,650 points)

Q1: With last beta

you can have:

@startuml foo.png
     note right: %filename%
     note left: %filenameNoExtension%

Q2: Not sure to understand the question. This is simply our decision (see )

(Note that this is not working with the online server because there are no "filename" in that case)

commented Jun 28 by boshka (1,320 points)
edited Jun 28 by boshka
Q2 - sorry, it should sound like:
Why this does NOT result in the full file name?

Note: it does not work even in case there is file name (that is, with Eclipse plugin). Can't it simply take the name from the @startuml <filename> line?

UPD: I checked with standalone jar and still the image is generated with %filename% note, not with the real file name in the note
commented Jun 29 by plantuml (134,650 points)
Before talking about Eclipse, we should first fix the issue using the standalone jar. Could you give us the exact command line you are using ? It seems to work on our side, so we are confused :-)
commented 2 days ago by luclaf (100 points)
I have the same problem with both %filename% and %filenameNoExtension% when put in the Title.
I use VS Code with the following settings
"plantuml.jar": "D:\\Apps\\PlantUML\\plantuml.1.2017.18.jar",
commented 2 days ago by plantuml (134,650 points)
About VS Code, I think the issue comes from the integration between VS Code and PlantUML.  %filename% works with PlantUML command line.
You should explain this issue to the author of the VS Code PlantUML plugin and show him this thread. We would be glad to help him to implements this, but we have to work together on the subject.
commented 14 hours ago by jebbs
Hi, this is author of "VSCode Plantuml".

To the problem post by luclaf, the first idea come to my mind is solving it with "-DVAR1=value", I pass the value like "-Dfilename=filename.wsd -D filenameNoExtension=filename" on calling, and the "plantuml.jar" need to change its "!define" behavior a bit:

Replace "%filename%" (not "filename") with "filename.wsd".

Please see my try on github:


But this would cause compatible issues, and we cannot keep the old replacement (replace "filename" with "filename.wsd") for the compatible, because my plugin defines "filename" for every diagram, it may replace inline words that user doesn't expected to.

So, shall we create a new parameter for filename? which is direct and simple.

Or I do the replacement in source code, which should be the easiest and work for all version.