User-defined style applied on class also becomes a stereotype

0 votes
asked Oct 6 in Bug by dragondive (440 points)

I tried applying a user-defined style to a class diagram. It partially works (the "Bold" style does get applied, but not "Italics" or "Underline"). But because the syntax to apply the user-defined style is the same as specifying a stereotype, the class also becomes a stereotype.

I know that `style` is still somewhat experimental. Can we consider using a different syntax for one of these two features, to avoid confusion?

Example on the server: http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuR8fBgdCIRNZIiv9B2vsoKnCBqhCLQZcKW02lTnAi2I82mLk-NabmM0nf_oS5B1mBLSjbuq-iYaAZZcPoQaADZPG_NPsN0wfUIb0sm00 

@startuml
<style>
classDiagram {
    .mystyle {
        FontStyle Bold
    }
}
</style>
class Alice <<mystyle>>
@enduml


commented Oct 9 by Martin (5,640 points)

An alternative is to add:

hide <<mystyle>> stereotype

but you couldn't have a mix of shown and not shown as per Plantuml's answer.

2 Answers

0 votes
answered Oct 6 by plantuml (263,020 points)

The most difficult issue here is to find the right syntax...

Maybe we could indeed use a new syntax.
What about introducing 'style pseudo-stereotype' with three guillemets <<< >>>.
This would apply the style to the class without adding any stereotypes:

@startuml
<style>
classDiagram {
    .mystyle {
        FontStyle Bold
    }
}
</style>
class Alice <<<mystyle>>>
@enduml

Would that makes sense ?
What people think about it ?

commented Oct 6 by dragondive (440 points)

Another option off the top of my head is this:

class <<style>> Alice <<stereotype>>

It is "backward compatible" with existing codes, doesn't introduce another pair of "operators", is less ugly (subjective) and not confusing when you need to use both together:

class Alice <<stereotype>><<<style>>>

I don't know if it complicates the parser though if we introduce the possibility of another token in between the object "type" and "name".

commented Oct 6 by The-Lu (36,620 points)

Why not...
I agree...It makes sens...yes
Like for link, on Class diagram: with three square brackets for field or method... wink

Then... When we will think Class we will think 3!

+2 votes
answered Oct 9 by plantuml (263,020 points)

With last beta http://beta.plantuml.net/plantuml.jar you can now have:

Is this what you are expecting ?

Since this is really some beta, please tell us if you find issues!

Thanks!

commented Oct 10 by dragondive (440 points)
Thanks for the quick implementation. It looks great at first glance. I will try it on more usecases and see if everything works as expected. :-)
...