fix: minor bug fix

https://github.com/plantuml/plantuml/issues/1422
This commit is contained in:
Arnaud Roques 2023-05-10 20:43:48 +02:00
parent 26874fe610
commit 475f814b65
3 changed files with 21 additions and 14 deletions

View File

@ -61,7 +61,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
public static final String endingGroup() {
return "(" //
+ ";(?:[%s]*\\<\\<\\w+\\>\\>)?" //
+ ";(?:[%s]*(\\<\\<\\w+\\>\\>))?" //
+ "|" //
+ Matcher.quoteReplacement("\\\\") // that is simply \ character
+ "|" //
@ -77,7 +77,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
private static final String endingGroupShort() {
return "(" //
+ ";(?:[%s]*\\<\\<\\w+\\>\\>)?" //
+ ";(?:[%s]*(\\<\\<\\w+\\>\\>))?" //
+ "|" //
+ Matcher.quoteReplacement("\\\\") // that is simply \ character
+ "|" //
@ -130,13 +130,19 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String stereo = arg.get("STEREO", 0);
String stereo = arg.get("STEREO", 0);
if (stereo == null)
stereo = arg.get("STYLE", 1);
Stereotype stereotype = null;
if (stereo != null) {
stereotype = Stereotype.build(stereo);
colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground);
}
final BoxStyle style = BoxStyle.fromString(arg.get("STYLE", 0));
BoxStyle style = BoxStyle.fromString(arg.get("STEREO", 0));
if (style == BoxStyle.PLAIN)
style = BoxStyle.fromString(arg.get("STYLE", 0));
final Display display = Display.getWithNewlines2(arg.get("LABEL", 0));
return diagram.addActivity(display, style, url, colors, stereotype);
}

View File

@ -154,17 +154,18 @@ public enum BoxStyle {
}
public static BoxStyle fromString(String style) {
if (style.length() == 1)
if (style != null) {
if (style.length() == 1)
for (BoxStyle bs : BoxStyle.values())
if (bs.style == style.charAt(0))
return bs;
style = style.replaceAll("\\W", "");
for (BoxStyle bs : BoxStyle.values())
if (bs.style == style.charAt(0))
if (style.equalsIgnoreCase(bs.stereotype))
return bs;
style = style.replaceAll("\\W", "");
for (BoxStyle bs : BoxStyle.values())
if (style.equalsIgnoreCase(bs.stereotype))
return bs;
}
return PLAIN;
}

View File

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