1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-10 15:50:57 +00:00

fix: minor issue on nesting packages

https://github.com/plantuml/plantuml/issues/1550
This commit is contained in:
Arnaud Roques 2023-10-04 19:11:39 +02:00
parent c72487595b
commit 5d38bb6ef4
2 changed files with 17 additions and 16 deletions

View File

@ -134,28 +134,25 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
@Override @Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException { throws NoSuchColorException {
final String codeRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0)); final String codeArg = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0));
final String displayRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0)); final Quark<Entity> ident = diagram.quarkInContext(false,
diagram.cleanId(codeArg.length() == 0 ? diagram.getUniqueSequence("##") : codeArg));
final String displayArg = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0));
final String display; final String display;
final String idShort;
if (codeRaw.length() == 0) { if (codeArg.length() == 0)
idShort = diagram.getUniqueSequence("##");
display = null; display = null;
} else { else if (displayArg == null)
idShort = codeRaw; display = ident.getName();
if (displayRaw == null) else
display = idShort; display = displayArg;
else
display = displayRaw;
}
final Quark<Entity> ident = diagram.quarkInContext(false, diagram.cleanId(idShort));
final CommandExecutionResult status = diagram.gotoGroup(ident, Display.getWithNewlines(display), final CommandExecutionResult status = diagram.gotoGroup(ident, Display.getWithNewlines(display),
GroupType.PACKAGE); GroupType.PACKAGE);
if (status.isOk() == false) if (status.isOk() == false)
return status; return status;
final Entity p = diagram.getCurrentGroup(); final Entity p = diagram.getCurrentGroup();
final String symbol = arg.get("SYMBOL", 0); final String symbol = arg.get("SYMBOL", 0);

View File

@ -133,7 +133,11 @@ public class StateDiagram extends AbstractEntityDiagram {
final Entity g = getCurrentGroup(); final Entity g = getCurrentGroup();
final String tmp = "*historical*" + g.getName(); final String tmp = "*historical*" + g.getName();
final Quark<Entity> ident = quarkInContext(true, tmp); final Quark<Entity> ident = quarkInContext(true, tmp);
final Entity result = reallyCreateLeaf(ident, Display.getWithNewlines(ident), LeafType.PSEUDO_STATE, null); final Entity result;
if (ident.getData() == null)
result = reallyCreateLeaf(ident, Display.getWithNewlines(ident), LeafType.PSEUDO_STATE, null);
else
result = ident.getData();
endGroup(); endGroup();
return result; return result;
} }