Sequence Diagram - Messages on multiple lines

+1 vote
asked Feb 12, 2015 in Wanted features by Larry (200 points)

Hi

I am currently maintaining sequence diagrams with significantly "rich" (then long) messages.

In order to not stretch the diagram too much and enhance readability, I split messages in multiple lines thanks to \n, e.g. :

Alice-->Bob : Message(\n  firstArgument : firstValue,\n  secondArgument : secondValue,\n  thirdArgument : thirdValue,\n  fourthArgument : fourthValue\n)

But with a rather large sequence diagram with numerous messages, it is a pain to maintain these kilometric lines ...

Is there an alternative syntax to truly specify these messages on several lines, e.g. using message delimiters ?

For instance, using a quoted string that spans several lines ?

Alice-->Bob : "Message(

  firstArgument : firstValue,

  secondArgument : secondValue,

  thirdArgument : thirdValue,

  fourthArgument : fourthValue

)"
 

Thanks

1 Answer

+1 vote
answered Feb 12, 2015 by plantuml (295,000 points)

When a line ends with a backslash, the preprocessor will merge the two lines.

For example:

@startuml
alice -> B\
ob
@enduml

is equivalent to

@startuml
alice -> Bob
@enduml

So you can take advantage of this, writing :

@startuml
Alice-->Bob : Message(\n\
  firstArgument : firstValue,\n\
  secondArgument : secondValue,\n\
  thirdArgument : thirdValue,\n\
  fourthArgument : fourthValue\n\
)
@enduml

This looks weird, but at least it works :-)
 

commented Feb 12, 2015 by Larry (200 points)
Thanks, it will do the trick !
I can bear the cosmetic aspect (... for now :-))
...