1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 04:55:10 +00:00

Fix skinparam and style issues

This commit is contained in:
Arnaud Roques 2021-11-17 18:47:53 +01:00
parent 1188690078
commit 88b2d9a765
5 changed files with 176 additions and 159 deletions

View File

@ -62,6 +62,8 @@ public class StyleExtractor {
break;
line = data.next();
}
} else if (line.getString().trim().startsWith("!assume ")) {
// Ignore
} else if (line.getString().trim().startsWith("!pragma ")) {
// Ignore
} else if (line.getString().trim().startsWith("title ")) {

View File

@ -60,41 +60,15 @@ public class FromSkinparamToStyle {
static {
addConvert("participantClickableBackgroundColor", PName.BackGroundColor, SName.participant, SName.clickable);
addConvert("participantClickableBorderColor", PName.LineColor, SName.participant, SName.clickable);
addConvert("participantBackgroundColor", PName.BackGroundColor, SName.participant);
addConvert("participantBorderColor", PName.LineColor, SName.participant);
addConvert("participantBorderThickness", PName.LineThickness, SName.participant);
addConFont("participant", SName.participant);
addConvert("boundaryBackgroundColor", PName.BackGroundColor, SName.boundary);
addConvert("boundaryBorderColor", PName.LineColor, SName.boundary);
addConvert("boundaryBorderThickness", PName.LineThickness, SName.boundary);
addConFont("boundary", SName.boundary);
addConvert("controlBackgroundColor", PName.BackGroundColor, SName.control);
addConvert("controlBorderColor", PName.LineColor, SName.control);
addConvert("controlBorderThickness", PName.LineThickness, SName.control);
addConFont("control", SName.control);
addConvert("collectionsBackgroundColor", PName.BackGroundColor, SName.collections);
addConvert("collectionsBorderColor", PName.LineColor, SName.collections);
addConvert("collectionsBorderThickness", PName.LineThickness, SName.collections);
addConFont("collections", SName.collections);
addConvert("actorBackgroundColor", PName.BackGroundColor, SName.actor);
addConvert("actorBorderColor", PName.LineColor, SName.actor);
addConvert("actorBorderThickness", PName.LineThickness, SName.actor);
addConFont("actor", SName.actor);
addConvert("databaseBackgroundColor", PName.BackGroundColor, SName.database);
addConvert("databaseBorderColor", PName.LineColor, SName.database);
addConvert("databaseBorderThickness", PName.LineThickness, SName.database);
addConFont("database", SName.database);
addConvert("entityBackgroundColor", PName.BackGroundColor, SName.entity);
addConvert("entityBorderColor", PName.LineColor, SName.entity);
addConvert("entityBorderThickness", PName.LineThickness, SName.entity);
addConFont("entity", SName.entity);
addMagic(SName.participant);
addMagic(SName.boundary);
addMagic(SName.control);
addMagic(SName.collections);
addMagic(SName.actor);
addMagic(SName.database);
addMagic(SName.entity);
addConFont("header", SName.header);
addConFont("footer", SName.footer);
@ -123,20 +97,22 @@ public class FromSkinparamToStyle {
addConFont("sequenceDivider", SName.separator);
addConvert("sequenceDividerBorderThickness", PName.LineThickness, SName.separator);
addConvert("SequenceMessageAlignment", PName.HorizontalAlignment, SName.arrow);
addConFont("note", SName.note);
addConvert("noteBorderThickness", PName.LineThickness, SName.note);
addConvert("noteBackgroundColor", PName.BackGroundColor, SName.note);
addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group);
addConvert("packageBorderColor", PName.LineColor, SName.group);
addMagic(SName.package_);
addConvert("PartitionBorderColor", PName.LineColor, SName.partition);
addConvert("PartitionBackgroundColor", PName.BackGroundColor, SName.partition);
addConFont("Partition", SName.partition);
addConvert("hyperlinkColor", PName.HyperLinkColor, SName.root);
addConvert("activityStartColor", PName.LineColor, SName.circle);
addConvert("activityBarColor", PName.LineColor, SName.activityBar);
addConvert("activityBorderColor", PName.LineColor, SName.activity);
@ -146,7 +122,7 @@ public class FromSkinparamToStyle {
addConvert("activityDiamondBackgroundColor", PName.BackGroundColor, SName.diamond);
addConvert("activityDiamondBorderColor", PName.LineColor, SName.diamond);
addConFont("activityDiamond", SName.diamond);
addConFont("arrow", SName.arrow);
addConvert("arrowThickness", PName.LineThickness, SName.arrow);
addConvert("arrowColor", PName.LineColor, SName.arrow);
@ -154,30 +130,30 @@ public class FromSkinparamToStyle {
addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root);
addConvert("defaultFontName", PName.FontName, SName.root);
addConFont("SwimlaneTitle", SName.swimlane);
addConvert("SwimlaneTitleBackgroundColor", PName.BackGroundColor, SName.swimlane);
addConvert("SwimlaneBorderColor", PName.LineColor, SName.swimlane);
addConvert("SwimlaneBorderThickness", PName.LineThickness, SName.swimlane);
addConvert("roundCorner", PName.RoundCorner, SName.root);
addConvert("titleBorderThickness", PName.LineThickness, SName.title);
addConvert("titleBorderColor", PName.LineColor, SName.title);
addConvert("titleBackgroundColor", PName.BackGroundColor, SName.title);
addConvert("titleBorderRoundCorner", PName.RoundCorner, SName.title);
addConFont("title", SName.title);
addConvert("legendBorderThickness", PName.LineThickness, SName.legend);
addConvert("legendBorderColor", PName.LineColor, SName.legend);
addConvert("legendBackgroundColor", PName.BackGroundColor, SName.legend);
addConvert("legendBorderRoundCorner", PName.RoundCorner, SName.legend);
addConFont("legend", SName.legend);
addConvert("noteTextAlignment", PName.HorizontalAlignment, SName.note);
addConvert("BackgroundColor", PName.BackGroundColor, SName.document);
addConvert("classBackgroundColor", PName.BackGroundColor, SName.class_);
addConvert("classBorderColor", PName.LineColor, SName.class_);
addConFont("class", SName.class_);
@ -196,6 +172,33 @@ public class FromSkinparamToStyle {
addConFont("stateAttribute", SName.state);
addConvert("stateBorderThickness", PName.LineThickness, SName.state);
addMagic(SName.agent);
addMagic(SName.artifact);
addMagic(SName.card);
addMagic(SName.interface_);
addMagic(SName.cloud);
addMagic(SName.component);
addMagic(SName.file);
addMagic(SName.folder);
addMagic(SName.frame);
addMagic(SName.hexagon);
addMagic(SName.node);
addMagic(SName.person);
addMagic(SName.queue);
addMagic(SName.rectangle);
addMagic(SName.stack);
addMagic(SName.storage);
addMagic(SName.usecase);
addMagic(SName.map);
}
private static void addMagic(SName sname) {
final String cleanName = sname.name().replace("_", "");
addConvert(cleanName + "BackgroundColor", PName.BackGroundColor, sname);
addConvert(cleanName + "BorderColor", PName.LineColor, sname);
addConvert(cleanName + "BorderThickness", PName.LineThickness, sname);
addConFont(cleanName, sname);
}
private final List<Style> styles = new ArrayList<>();

View File

@ -67,6 +67,9 @@ public class CodeIteratorSub extends AbstractCodeIterator {
}
public StringLocated peek() throws EaterException, EaterExceptionLocated {
if (readingInProgress != null) {
return readingInProgress.peek();
}
StringLocated result = source.peek();
if (result == null) {
return null;

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 3;
final int beta = 4;
return beta;
}

View File

@ -183,115 +183,6 @@ skinparam useBetaStyle false
!_PATCH = "<color #b5bd00>PATCH</color>"
!_HEAD = "<color #9012fe>HEAD</color>"
''
'' Style settings
''
<style>
mindmapDiagram {
root {
BackgroundColor $PUML_BGCOLOR
FontColor $PRIMARY_TEXT
HyperLinkColor $INFO_BG
LineColor $PRIMARY_DARK
LineThickness 1
Margin 10
Padding 6
Shadowing 0.0
}
node {
Padding 15
roundcorner 20
BackgroundColor $PRIMARY_BG-$PRIMARY_DARK
}
caption {
LineThickness 0
}
footer {
LineThickness 0
}
groupHeader {
BackgroundColor $SECONDARY_BG
FontColor $INFO_BG
FontStyle bold
}
header {
LineThickness 0
}
referenceHeader {
BackgroundColor $PUML_BGCOLOR
FontColor $DARK_BG
FontStyle bold
}
separator {
BackgroundColor $FGCOLOR
FontColor $PUML_BGCOLOR
FontStyle bold
}
title {
FontSize 20
BorderRoundCorner 8
BorderThickness 1
BackgroundColor $SECONDARY_LIGHT-$SECONDARY_BG
FontColor $PRIMARY_TEXT
BorderColor $SECONDARY_BG
}
}
nwdiagDiagram {
network {
$primary_scheme()
LineColor $PRIMARY_BG
LineThickness 1.0
FontColor $PRIMARY_DARK
}
server {
$primary_scheme()
}
arrow {
FontColor $PRIMARY_DARK
LineColor $PRIMARY_DARK
}
group {
BackGroundColor $LIGHT_BG
LineColor $LIGHT_DARK
LineThickness 2.0
Margin 5
Padding 5
}
}
ganttDiagram {
task {
$primary_scheme()
LineColor $PRIMARY_BG
Margin 10
Padding 6
}
note {
FontColor $INFO_TEXT
LineColor $INFO_DARK
BackGroundColor $INFO_BG
}
separator {
LineColor $SECONDARY_BG
BackGroundColor $secondary_scheme()
FontColor $SECONDARY_TEXT
}
milestone {
FontColor $INFO_BG
FontSize 16
FontStyle italic
BackGroundColor $DIAMOND_BG
LineColor $SECONDARY_DARK
}
timeline {
BackgroundColor $SECONDARY_BG
FontColor $SECONDARY_TEXT
}
closed {
BackgroundColor $WARNING_DARK
FontColor $WARNING_TEXT
}
}
</style>
''
'' Global Default Values
''
skinparam defaultFontName "Verdana"
@ -639,9 +530,127 @@ skinparam file {
!endsub
!startsub stack
skinparam stack {
$primary_scheme()
}
!endsub
!startsub map
skinparam map {
$primary_scheme()
}
!endsub
''
'' When mixing skinparam and <style>, it is very important to put <style> after skinparam
''
'' Style settings
''
<style>
wbsDiagram, mindmapDiagram {
root {
BackgroundColor $PUML_BGCOLOR
FontColor $PRIMARY_TEXT
HyperLinkColor $INFO_BG
LineColor $PRIMARY_DARK
LineThickness 1
Margin 10
Padding 6
Shadowing 0.0
}
node {
$primary_scheme()
Padding 15
RoundCorner 20
}
caption {
LineThickness 0
}
footer {
LineThickness 0
}
groupHeader {
BackgroundColor $SECONDARY_BG
FontColor $INFO_BG
FontStyle bold
}
header {
LineThickness 0
}
referenceHeader {
BackgroundColor $PUML_BGCOLOR
FontColor $DARK_BG
FontStyle bold
}
separator {
BackgroundColor $FGCOLOR
FontColor $PUML_BGCOLOR
FontStyle bold
}
title {
FontSize 20
BorderRoundCorner 8
BorderThickness 1
BackgroundColor $SECONDARY_LIGHT-$SECONDARY_BG
FontColor $PRIMARY_TEXT
BorderColor $SECONDARY_BG
}
}
nwdiagDiagram {
network {
$primary_scheme()
LineColor $PRIMARY_BG
LineThickness 1.0
FontColor $PRIMARY_DARK
}
server {
$primary_scheme()
}
arrow {
FontColor $PRIMARY_DARK
LineColor $PRIMARY_DARK
}
group {
BackGroundColor $LIGHT_BG
LineColor $LIGHT_DARK
LineThickness 2.0
Margin 5
Padding 5
}
}
ganttDiagram {
task {
$primary_scheme()
LineColor $PRIMARY_BG
Margin 10
Padding 6
}
note {
FontColor $INFO_TEXT
LineColor $INFO_DARK
BackGroundColor $INFO_BG
}
separator {
LineColor $SECONDARY_BG
BackGroundColor $secondary_scheme()
FontColor $SECONDARY_TEXT
}
milestone {
FontColor $INFO_BG
FontSize 16
FontStyle italic
BackGroundColor $DIAMOND_BG
LineColor $SECONDARY_DARK
}
timeline {
BackgroundColor $SECONDARY_BG
FontColor $SECONDARY_TEXT
}
closed {
BackgroundColor $WARNING_DARK
FontColor $WARNING_TEXT
}
}
</style>
!endsub