Can't seem to pass multiline text to preprocessor macro

0 votes
asked Jun 30, 2017 in Bug by rd27 (530 points)

Plantuml doesn't seem to accept multiline text as macro arguments. So in the following text the last TestFolder line causes an error. Is theer a trick I am missing? Thanks!

!definelong TestFolder(TEXT)
folder test2 [
TEXT
]
!enddefinelong

TestFolder("testtext")
TestFolder("test
text")

2 Answers

0 votes
answered Jan 26, 2018 by Anthony-Gaudino (7,800 points)

You can't have line breaks like this on the macros.

You may use something like this instead:

@startuml
!definelong TestFolder(name, TEXT)
folder name [
TEXT
]
!enddefinelong

TestFolder(a, "testtext")
TestFolder(b, "test\ntext")
@enduml
commented Jul 6, 2018 by Kai
Also it is possible to use the Macro Variable in Quotes "TEXT", which protect agains some more Issues
0 votes
answered Nov 13, 2018 by Yayef

This solution doesn't work with notes as \n is not parsed in notes.

@startuml
!definelong CustomNote(text)
note
text
end note
!enddefinelong

CustomNote("first line\nsecond line")

@enduml

The note has one line:

first line\nsecond line

What I want is:

first line
second line

How can I achieve this?

...