Line breaks in !function !return (how?) (preprocessorV2)

0 votes
asked May 29, 2019 in Bug by boshka (3,940 points)
edited May 29, 2019 by boshka
Could you help with the below?

how to specify multi-line result in the !function? The below does not work:

!function myFunction(arg)
           !return ":myFunction();\nnote right\ncalled with\n" + arg + "\nend note"
!endfunction

myFunction("myArg")

Also, is there a more convenient way for that like in legacy versions (i want some function to return just some plantuml multiline code fed with the function arguments)?

1 Answer

0 votes
answered May 29, 2019 by plantuml (295,000 points)

You can use void function instead of return function in that case.

@startuml
!unquoted function my_Function($arg)
:myFunction();
note right
called with
$arg
end note
!endfunction

start
my_Function(myArg1)
my_Function(myArg2)
@enduml

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuL8ipIiipIz9JL58AyrBBidCprF8hOntWx8rL1ABqZMvh78huIAQrbnvGFKAHPdf6ILSoOavEK2zvPab6LmWjLofUIaA87akHI0BPYGN5zW-BcIJSoiTYz8DDJ75Z3Iv781wWOu30000

Is this what you are looking for ?

commented May 29, 2019 by boshka (3,940 points)
yes, many thanks (sorry, missed this in the migration notes)
commented May 30, 2019 by boshka (3,940 points)
I also noticed, that you can still define and use a function without a !return as follows:

!function myFunction(arg)

     <arbitrary plantuml code>

!endfunction
...