1
0
mirror of https://github.com/octoleo/plantuml.git synced 2025-01-01 22:32:56 +00:00
Arnaud Roques 2022-12-16 19:37:14 +01:00
parent 5deec17711
commit 4044c73d06
9 changed files with 24 additions and 23 deletions

View File

@ -49,7 +49,7 @@ public enum ComponentStyle {
case UML2: case UML2:
return USymbols.COMPONENT2; return USymbols.COMPONENT2;
case RECTANGLE: case RECTANGLE:
return USymbols.RECTANGLE; return USymbols.COMPONENT_RECTANGLE;
} }
throw new AssertionError(); throw new AssertionError();
} }

View File

@ -94,49 +94,44 @@ public class UrlBuilder {
public Url getUrl(String s) { public Url getUrl(String s) {
Matcher2 m; Matcher2 m;
m = QUOTED.matcher(s); m = QUOTED.matcher(s);
if (matchesOrFind(m)) { if (matchesOrFind(m))
return new Url(withTopUrl(m.group(1)), m.group(2), m.group(3)); return new Url(withTopUrl(m.group(1)), m.group(2), m.group(3));
}
m = ONLY_TOOLTIP.matcher(s); m = ONLY_TOOLTIP.matcher(s);
if (matchesOrFind(m)) { if (matchesOrFind(m))
return new Url("", m.group(1), null); return new Url("", m.group(1), null);
}
m = ONLY_TOOLTIP_AND_LABEL.matcher(s); m = ONLY_TOOLTIP_AND_LABEL.matcher(s);
if (matchesOrFind(m)) { if (matchesOrFind(m))
return new Url("", m.group(1), m.group(2)); return new Url("", m.group(1), m.group(2));
}
m = LINK_TOOLTIP_NOLABEL.matcher(s); m = LINK_TOOLTIP_NOLABEL.matcher(s);
if (matchesOrFind(m)) { if (matchesOrFind(m))
return new Url(withTopUrl(m.group(1)), m.group(2), null); return new Url(withTopUrl(m.group(1)), m.group(2), null);
}
m = LINK_WITH_OPTIONAL_TOOLTIP_WITH_OPTIONAL_LABEL.matcher(s); m = LINK_WITH_OPTIONAL_TOOLTIP_WITH_OPTIONAL_LABEL.matcher(s);
if (matchesOrFind(m)) { if (matchesOrFind(m))
return new Url(withTopUrl(m.group(1)), m.group(2), m.group(3)); return new Url(withTopUrl(m.group(1)), m.group(2), m.group(3));
}
return null; return null;
} }
private boolean matchesOrFind(Matcher2 m) { private boolean matchesOrFind(Matcher2 m) {
if (mode == UrlMode.STRICT) { if (mode == UrlMode.STRICT)
return m.matches(); return m.matches();
} else if (mode == UrlMode.ANYWHERE) { else if (mode == UrlMode.ANYWHERE)
return m.find(); return m.find();
} else { else
throw new IllegalStateException(); throw new IllegalStateException();
}
} }
private String withTopUrl(String url) { private String withTopUrl(String url) {
if (url.startsWith("http:") == false && url.startsWith("https:") == false && url.startsWith("file:") == false if (url.startsWith("http:") == false && url.startsWith("https:") == false && url.startsWith("file:") == false
&& topurl != null) { && topurl != null)
return topurl + url; return topurl + url;
}
return url; return url;
} }

View File

@ -68,7 +68,8 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexOptional(new RegexLeaf("is")), // new RegexOptional(new RegexLeaf("is")), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")"), RegexLeaf.end()); // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")"), //
RegexLeaf.end()); //
} }
@Override @Override

View File

@ -82,7 +82,8 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), RegexLeaf.end()); new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.end());
} }
private IRegex getRegexConcatSingleLine() { private IRegex getRegexConcatSingleLine() {

View File

@ -81,7 +81,8 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), // ColorParser.exp1(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), RegexLeaf.end()); new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.end());
} }
private IRegex getRegexConcatSingleLine() { private IRegex getRegexConcatSingleLine() {

View File

@ -87,7 +87,8 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), RegexLeaf.end() // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.end() //
); );
} }

View File

@ -83,6 +83,7 @@ public abstract class USymbols {
public final static USymbol USECASE = null; public final static USymbol USECASE = null;
public final static USymbol COMPONENT1 = record("COMPONENT1", new USymbolComponent1()); public final static USymbol COMPONENT1 = record("COMPONENT1", new USymbolComponent1());
public final static USymbol COMPONENT2 = record("COMPONENT2", new USymbolComponent2()); public final static USymbol COMPONENT2 = record("COMPONENT2", new USymbolComponent2());
public final static USymbol COMPONENT_RECTANGLE = record("COMPONENT_RECTANGLE", new USymbolRectangle(SName.component));
public final static USymbol BOUNDARY = record("BOUNDARY", new USymbolBoundary()); public final static USymbol BOUNDARY = record("BOUNDARY", new USymbolBoundary());
public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", new USymbolEntityDomain()); public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", new USymbolEntityDomain());
public final static USymbol CONTROL = record("CONTROL", new USymbolControl()); public final static USymbol CONTROL = record("CONTROL", new USymbolControl());

View File

@ -65,7 +65,8 @@ public class CommandUrl extends SingleLineCommand2<SequenceDiagram> {
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexOptional(new RegexLeaf("is")), // new RegexOptional(new RegexLeaf("is")), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")"), RegexLeaf.end()); // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")"), //
RegexLeaf.end()); //
} }
@Override @Override

View File

@ -81,7 +81,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 5; final int beta = 6;
return beta; return beta;
} }