PreprocessorV2: multiline function invocation

0 votes
asked Dec 24, 2019 in Question / help by jrosiek (240 points)
Hi,

Is it possible to span arguments to preprocessor function over multiple lines, like that:

@startuml
!unquoted function $f($x)
    !assert 1==2 : $x
!endfunction

$f(xxxx\
ddada)

@enduml

I really hoped the preprocessor has the notion of 'logical line', similarity to C/C++ preprocessor. Can it be achieved some other way? I don't need the newline to be a part of the argument. I just want to break it over multiple lines to improve readability of long/multiargument function invocation.

Thanks,

Jarek

2 Answers

0 votes
answered Dec 24, 2019 by plantuml (294,960 points)
Just to be sure : you would like the result of your example beeing exactly the same as :

@startuml
!unquoted function $f($x)
    !assert 1==2 : $x
!endfunction

$f(xxxxddada)

@enduml

Is is correct ?
commented Dec 25, 2019 by jrosiek (240 points)
Yes. That's what happens in - for example - C/C++ preprocessor. It firstly joins physical lines into logical ones - backslash just before newline signals logical line continuation. Such mechanism is very convenient because it is possible to split the long argument list into multiple lines.
0 votes
answered Dec 27, 2019 by plantuml (294,960 points)

This is not widely tested, but with last beta
http://beta.plantuml.net/plantuml.jar

You can now have :

@startuml
!unquoted function $f($x)
title $x
!endfunction

$f(xxxx\
ddada\
ok\
)
a->b
@enduml

Tell us if it's not working for you !

commented Dec 27, 2019 by jrosiek (240 points)
Thanks! I will certainly check it.

Do you know how fast it will become a part of a release?
commented Dec 29, 2019 by plantuml (294,960 points)
We will release a new version beginning of January with this fix.

Regards,
...