Please provide a macro to access the filename without the extension

0 votes
asked Jun 26, 2017 in Closed feature request by boshka (3,940 points)
edited Jun 26, 2017 by boshka

Q1: I would like to have a macro to be able to access the output filename without the extension

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

@startuml test.svg
     note right: %filename%
@enduml

1 Answer

0 votes
answered Jun 28, 2017 by plantuml (294,960 points)
selected Mar 23, 2018 by Anthony-Gaudino
 
Best answer

Q1: With last beta https://www.dropbox.com/s/koo42q3d9gxw288/plantuml.jar?dl=0

you can have:

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

Q2: Not sure to understand the question. This is simply our decision (see http://plantuml.com/preprocessing )

(Note that this is not working with the online server http://www.plantuml.com/plantuml because there are no "filename" in that case)

commented Jun 28, 2017 by boshka (3,940 points)
edited Jun 28, 2017 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, 2017 by plantuml (294,960 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 Nov 22, 2017 by luclaf (120 points)
Hello,
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 Nov 22, 2017 by plantuml (294,960 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 Nov 24, 2017 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:
https://github.com/qjebbs/vscode-plantuml/issues/80

---------------------------------------------------------------------------------------------------------------------

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.
...