Styling a multi-line string with legacy HTML formatting

0 votes
asked Oct 28, 2020 in Bug by Leo
Is it possible to style a multi-line string with legacy HTML? For example, this doesn't work:

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuIejJarEB4vLKB8fpgnAjJ8qiFF9p4jLoCzBZSa3iqhAystqGN9sIbmEgNafG4q0

I would like this to look like this:

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuIejJarEB4vLKB8fpgnAjJ8qiFF9p4jLoCzBjT47YTZ5vA7Ab9JdGsMKk1nIyrA0XW00

Is this unintended behavior (bug) or is there an alternative way of doing this (not including the approach of manually altering the tags)?

1 Answer

0 votes
answered Oct 28, 2020 by The-Lu (74,900 points)

Hello L.,

A possible workaround is to put only the begin tag <size:10> as:

On one-line as:

usecase "<size:10>Line one\n<size:10>Line two"


[See on PlantUML server]

or directly on multi-line:

usecase U0 [
<size:10>Line one
<size:10>Line two
]


[See on PlantUML server]

Or don't use html but use of stereotype:

hide stereotype
skinparam UsecaseFontSize<<medium>> 10
usecase "Line one\nLine two" <<medium>>
usecase "Normal Line one"


[See on PlantUML server]

If that can help,
Regards,
Th.

commented Oct 29, 2020 by Leo
I need this styling to be a part of the sequence message text, like this:

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuN9KqBLJS5AmKj3IyaqjoSXFKSXBp4tLqeh9iodEh4grCZImoqwjDBHIA4lCAKqrH1KsWWeRSJcavgK0ZGC0

I was hoping to create a procedure to create this type of message, having the method name and argument list as separate procedure arguments, like this:

http://www.plantuml.com/plantuml/uml/LOzD2i8m48NtSuffwSA6YhRBKafrxmsw2SsWnMIY-H7qzCPI57Vp3U-3zmOVf0lHQ80iyZtQG0flpawaeYESfDQRmjle9ggmKEJ3p3BCbXCP2XUhqY7TEHhYu4j0NDEuxV_osA8GgoB4o9sVNzJM-_vdTxlFhuUCM7qh02mT3XKUAynFYuyi3UK9h_IiMtn87QaUEL6pKfEN00EnIilU

This, however doesn't allow me to pass in the list of method arguments as multi-line string because styling it would require styling each individual line before calling the procedure, so I'm afraid the first two approaches don't work for me.

As for the last one, I suppose I cannot define a stereotype with this kind of complex styling (first line bold and normal font size, all other normal and small font size)?

Regards,

Leo
commented Oct 30, 2020 by The-Lu (74,900 points)

Hello L.,

That's good and your 'replace' function is a good example of preprocessing procedure.yes

Here is another workaround, simpler:

If all the messages of sequence are on the same kind, or if the 'Method name' is without newline, you can inverse the size:

  • put all the text on small font size (10), with the global parameter "skinparam ArrowFontSize 10".
  • and put only the 'Method name' with normal font size (14).wink

Without procedure:

@startuml
skinparam ArrowFontSize 10
A -> B : **<size:14>Method name**\nkey1: value1\nkey2: value2
@enduml


[See on PlantUML server]

With procedure:

skinparam ArrowFontSize 10

!unquoted procedure call($source, $destination, $method, $arguments)
  $source -> $destination : **<size:14>$method**\n$arguments
!endprocedure

call(A, B, "Method name", "key1: value1\nkey2: value2")


[See on PlantUML server]

If that can help,
Regards,
Th.

...