Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Preprocessor enhancement

0 votes
I do a lot of test with version 8049 and !define and I see some possible enhancement:
1) !endif and !else don't like spaces. It is possible to correct it in ifManager.java line 43
protected static final Pattern2 elsePattern = MyPattern.cmpile("^[%s]*!else[%s]*$");
protected static final Pattern2 endifPattern = MyPattern.cmpile("^[%s]*!endif[%s]*$");
2) !else, !definelong and !enddefinelong are not defined in language description
LanguageDescriptor.java line 143
3) ifndef is not described in the documentation
4) It would be nice to have a !define with the file format output type
For example in Option.java line 84:
public void setFileFormat(FileFormat fileFormat) {
this.fileFormat = fileFormat;
String s = "FILE_FORMAT_" + fileFormat.toString() +"=\"1\"";
public Option(String... arg) throws InterruptedException, IOException {
if (arg.length == 0) {
asked Nov 22, 2016 in Wanted features by Serge Wenger Work (4,770 points)

1 Answer

0 votes
Best answer

Thanks for your contribution. Points 1,2 and 3 are ok. (integrated in last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar )

About point 4, we have an issue.

We understand the point and the interest of this suggestion.

However in some cases the diagram can be parsed before knowing which format is going to be used for export (depending how you integrate PlantUML). So we have to think about this.

Thanks again

answered Nov 23, 2016 by plantuml (125,210 points)
selected Nov 24, 2016 by Serge Wenger Work
Thanks for points 1) to 3). I check, it is OK.

I try a workaround with the option -DFILE_FORMAT_PNG=value but it seem not working:

java.exe -jar plantuml.8051Beta3.jar -DFILE_FORMAT_PNG=1 TestDefine2.txt

Alice -> Bob: png
Alice -> Bob: svg
Yes, this is a good workaround.

Sorry, there is a bug in 8051beta3 (underscore badly managed in !ifdef, due to new || && implementation).

You can either download 8051beta4 https://dl.dropboxusercontent.com/u/13064071/plantuml.jar that fixes that issue, or use FILEFORMATPNG as variable name with beta3).
8051beta4  is OK. Thanks

It is OK with command line, but not with -gui. Sorry.
Thanks for the report.
Should be ok with last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
(Not highly tested)
Support This Project Offer 250 Mo! Follow PlantUML on Twitter