I have some defines I use for building database diagrams with PlantUML which I am trying to convert to use the new preprocessor, but the new function definitions behave differently to the old defines and this is causing problems. With defines, when they were referenced in the rest of the file the define was expanded and the rest of the line left as it was, with functions it appears to replace the entire line discarding any text before or after the function.
I have made a minimal example to demonstrate the problem. Below is a version with the old preprocessor which works:
@startuml
!define test(name) class name << (A, #FF00DD >>
test(test) {
id: int4
do_something(): void
}
@enduml
This expands to
@startuml
class test << (A, #FF00DD >> {
id: int4
do_something(): void
}
@enduml
Converted to the new preprocessor:
@startuml
!function test($name)
class $name << (A, #FF00DD >>
!endfunction
test("test") {
id: int4
do_something(): void
}
@enduml
expands to
@startuml
class test << (A, #FF00DD >>
id: int4
do_something(): void
}
@enduml
The bracket on the line after test("test") has been discarded, which causes a syntax error.
The problem also appears if the function is called in the middle or at the end of the line, with all the text except for the function output being discarded.