package with long description and alias

+2 votes
asked Nov 29, 2017 in Bug by anonymous

I have a package like :

@startuml
package Title [
line 1
line 2
]
@enduml

And I try to give it an alias :

@startuml
package Title as alias [
line 1
line 2
]
@enduml

But PlantUML  gives me a syntax error :

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


Am I missing something ?
commented Feb 18, 2021 by anonymous
Is there a workaround to achieve this? I also need this feature.
commented Feb 6, 2024 by AleXoundOS (100 points)
IMHO, the package syntax with alias and square brackets for description (which gives the syntax error) should become supported in PlantUML.

2 Answers

–1 vote
answered Dec 1, 2017 by sseletskyy (120 points)

You can do it only for the package with the content wrapped with curly braces

Here is an example

@startuml
package One [
line 1
line 2
]

package Two as T {
 package Three [
  line 1
  line 2
 ]
}

One -> T
T <-> Three
@enduml
commented Dec 1, 2017 by anonymous
I had figured this out, but i needed the bracket version
0 votes
answered Feb 18, 2021 by The-Lu (87,240 points)
edited Feb 18, 2021 by The-Lu

Hello A.,

Is there a workaround to achieve this? I also need this feature.

In fact, the main issue is that for package PlantUML display both alias and title or description!

Here are all current possibilities:

@startuml
package Title_Alias_0
package Title as Alias_1
package "Long Title" as Alias_2
package Alias_3 [
line 1
line 2
]
package "Title\nline 1\nline2" as Alias_4
package Title_Alias_5 {
}
package Title as Alias_6 {
}
package Title as Alias_7 {
node n
}
@enduml

Then the open question is:

If that can help,
Regards,
Th.

commented Feb 18, 2021 by Martin (9,120 points)
edited Feb 18, 2021 by Martin

These different syntaxes have long confused me.   Your post clarifies it a bit.

I think this one is sufficiently different to deserve a mention:

package Alias_8 as "
Long Title
line 1
line 2
"

For which I don't think there is a container variation.

PS For comparison, replacing all instances of Package with Folder gives this (which is not what I was expecting!):

Here's where it was decided to blank out the folder tab but not the package one: https://forum.plantuml.net/8575/add-option-to-hide-alias-on-folder-top-part?show=8575#q8575

It seems a shame to have no syntax where you can have all three of tab text, description text, and alias.  I quite like the OP's suggested syntax.

...