Unable to refer to groups with spaces using square brackets

0 votes
asked Sep 10, 2019 in Bug by rd27 (460 points)

I don't to be able to use [square bracket] syntax to refer to a group with a space in it. As the following example shows, everything works but [Group B]. Even [GroupE] works, so it specifically when using square brackets and using a space. Thx!

@startuml
node GroupA
node "Group B" {
}
node GroupC {
}
node GroupD as "Group D"
node GroupE

[Group B] --> GroupA
GroupC --> GroupA
GroupD --> GroupA
[GroupE] --> GroupA
@enduml
http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuShBJqbLS2_ABormXB2Lm1m59oM5QgvQ96bdDBwBGc8nJB6B4fA4AnTNDDICM0LTNJkOwH1JC4HSa4IW6brHz3cavgK0NGe0

1 Answer

+1 vote
answered Sep 10, 2019 by plantuml (294,960 points)
selected Aug 3, 2020 by rd27
 
Best answer

A possible workaround is to use :

@startuml
node GroupA
node "Group B" as B {
}

B --> GroupA
@enduml

Does it help ?

commented Sep 10, 2019 by rd27 (460 points)

Thanks, I hadn't realized I could switch short name and long name like that. How does plantuml choose which name to use for the label? It seems it always picks the one with the space (vs longest or first)?

For example, in this example both "Group B" and Group D" are use the name with the space. While GroupG still uses "GroupG" even though there is a longer name.

@startuml
node GroupA
node "Group B" as GroupB {
  rectangle b1
}
node GroupC {
}
node GroupD as "Group D" {
  rectangle d1
}
node GroupE
node GroupFF as GroupF
node GroupG as GroupGG

GroupB --> GroupA
GroupC --> GroupA
GroupD --> GroupA
[GroupE] --> GroupA
@enduml

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuShBJqbLS2_ABormXB2Lm1m59oM5n6A8X5Crbu92KMfoIM9UUawgGf8XLosIDcU5QXI-2r0Vp10N9GLKlIceUbsvk20sAEZgsi5S0J4LGyG5MIGQeZqMMSmXDIy5w2C0

commented Sep 10, 2019 by plantuml (294,960 points)
Actually PlantUML determines the label thanks to the quotes. The label has quotes and the ident is the other value.

When there are no quotes (but you should avoid this syntax), the label is the first value.

See http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuShBJqbLIClFDrH8B5PGIYdDpQqqL8A8AW65ZPH0uc1X8xXQOxYOCPT3QXwGbGC0

Hope this helps!
...