1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-29 00:06:34 +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; break;
line = data.next(); line = data.next();
} }
} else if (line.getString().trim().startsWith("!assume ")) {
// Ignore
} else if (line.getString().trim().startsWith("!pragma ")) { } else if (line.getString().trim().startsWith("!pragma ")) {
// Ignore // Ignore
} else if (line.getString().trim().startsWith("title ")) { } else if (line.getString().trim().startsWith("title ")) {

View File

@ -60,40 +60,14 @@ public class FromSkinparamToStyle {
static { static {
addConvert("participantClickableBackgroundColor", PName.BackGroundColor, SName.participant, SName.clickable); addConvert("participantClickableBackgroundColor", PName.BackGroundColor, SName.participant, SName.clickable);
addConvert("participantClickableBorderColor", PName.LineColor, SName.participant, SName.clickable); addConvert("participantClickableBorderColor", PName.LineColor, SName.participant, SName.clickable);
addConvert("participantBackgroundColor", PName.BackGroundColor, SName.participant); addMagic(SName.participant);
addConvert("participantBorderColor", PName.LineColor, SName.participant);
addConvert("participantBorderThickness", PName.LineThickness, SName.participant);
addConFont("participant", SName.participant);
addConvert("boundaryBackgroundColor", PName.BackGroundColor, SName.boundary); addMagic(SName.boundary);
addConvert("boundaryBorderColor", PName.LineColor, SName.boundary); addMagic(SName.control);
addConvert("boundaryBorderThickness", PName.LineThickness, SName.boundary); addMagic(SName.collections);
addConFont("boundary", SName.boundary); addMagic(SName.actor);
addMagic(SName.database);
addConvert("controlBackgroundColor", PName.BackGroundColor, SName.control); addMagic(SName.entity);
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);
addConFont("header", SName.header); addConFont("header", SName.header);
addConFont("footer", SName.footer); addConFont("footer", SName.footer);
@ -130,6 +104,8 @@ public class FromSkinparamToStyle {
addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group); addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group);
addConvert("packageBorderColor", PName.LineColor, SName.group); addConvert("packageBorderColor", PName.LineColor, SName.group);
addMagic(SName.package_);
addConvert("PartitionBorderColor", PName.LineColor, SName.partition); addConvert("PartitionBorderColor", PName.LineColor, SName.partition);
addConvert("PartitionBackgroundColor", PName.BackGroundColor, SName.partition); addConvert("PartitionBackgroundColor", PName.BackGroundColor, SName.partition);
@ -196,6 +172,33 @@ public class FromSkinparamToStyle {
addConFont("stateAttribute", SName.state); addConFont("stateAttribute", SName.state);
addConvert("stateBorderThickness", PName.LineThickness, 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<>(); private final List<Style> styles = new ArrayList<>();

View File

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

View File

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

View File

@ -183,115 +183,6 @@ skinparam useBetaStyle false
!_PATCH = "<color #b5bd00>PATCH</color>" !_PATCH = "<color #b5bd00>PATCH</color>"
!_HEAD = "<color #9012fe>HEAD</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 '' Global Default Values
'' ''
skinparam defaultFontName "Verdana" skinparam defaultFontName "Verdana"
@ -639,9 +530,127 @@ skinparam file {
!endsub !endsub
!startsub stack !startsub stack
skinparam stack { skinparam stack {
$primary_scheme() $primary_scheme()
} }
!endsub !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>