Skip to content

Commit

Permalink
🚧 prepare jaws deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudroques committed Dec 11, 2024
1 parent 8824e08 commit 3554de7
Show file tree
Hide file tree
Showing 23 changed files with 206 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public String getPatternEnd() {
}

public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines, ParserPass currentPass) throws NoSuchColorException {
lines = lines.subExtract(1, 1);
lines = lines.subExtract(1, 1).expandsJaws5();
lines = lines.removeEmptyColumns();
final Display strings = lines.toDisplay();
if (strings.size() > 0) {
Expand Down
20 changes: 11 additions & 9 deletions src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import net.sourceforge.plantuml.klimt.color.ColorParser;
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
Expand All @@ -61,7 +62,7 @@
import net.sourceforge.plantuml.utils.LineLocation;

public final class CommandFactoryNote implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
// ::remove folder when __HAXE__
// ::remove folder when __HAXE__

private IRegex getRegexConcatMultiLine() {
return RegexConcat.build(CommandFactoryNote.class.getName() + "multi", RegexLeaf.start(), //
Expand Down Expand Up @@ -102,10 +103,10 @@ public Command<AbstractEntityDiagram> createSingleLine() {
return new SingleLineCommand2<AbstractEntityDiagram>(getRegexConcatSingleLine()) {

@Override
protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location,
protected CommandExecutionResult executeArg(final AbstractEntityDiagram diagram, LineLocation location,
RegexResult arg, ParserPass currentPass) throws NoSuchColorException {
final String display = arg.get("DISPLAY", 0);
return executeInternal(system, arg, BlocLines.getWithNewlines(display));
final Display display = Display.getWithNewlines(diagram.getPragma(), arg.get("DISPLAY", 0));
return executeInternal(diagram, arg, display);
}

};
Expand All @@ -121,26 +122,27 @@ public String getPatternEnd() {
}

@Override
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines, ParserPass currentPass)
throws NoSuchColorException {
protected CommandExecutionResult executeNow(final AbstractEntityDiagram diagram, BlocLines lines,
ParserPass currentPass) throws NoSuchColorException {
// StringUtils.trim(lines, false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
return executeInternal(system, line0, lines);
final Display display = lines.toDisplay();
return executeInternal(diagram, line0, display);
}
};
}

private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display)
private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, Display display)
throws NoSuchColorException {
final String idShort = arg.get("CODE", 0);
final Quark<Entity> quark = diagram.quarkInContext(false, diagram.cleanId(idShort));

if (quark.getData() != null)
return CommandExecutionResult.error("Note already created: " + quark.getName());

final Entity entity = diagram.reallyCreateLeaf(quark, display.toDisplay(), LeafType.NOTE, null);
final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.NOTE, null);

assert entity != null;
final String s = arg.get("COLOR", 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.Colors;
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
Expand Down Expand Up @@ -167,10 +168,10 @@ public Command<AbstractEntityDiagram> createSingleLine() {
return new SingleLineCommand2<AbstractEntityDiagram>(getRegexConcatSingleLine(partialPattern)) {

@Override
protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location,
protected CommandExecutionResult executeArg(final AbstractEntityDiagram diagram, LineLocation location,
RegexResult arg, ParserPass currentPass) throws NoSuchColorException {
final String s = arg.get("NOTE", 0);
return executeInternal(arg, system, null, BlocLines.getWithNewlines(s));
final Display display = Display.getWithNewlines(diagram.getPragma(), arg.get("NOTE", 0));
return executeInternal(arg, diagram, null, display);
}

@Override
Expand All @@ -193,12 +194,13 @@ public String getPatternEnd() {
}

@Override
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines, ParserPass currentPass)
throws NoSuchColorException {
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines,
ParserPass currentPass) throws NoSuchColorException {
// StringUtils.trim(lines, false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
final Display display = lines.toDisplay();

Url url = null;
if (line0.get("URL", 0) != null) {
Expand All @@ -207,7 +209,7 @@ protected CommandExecutionResult executeNow(final AbstractEntityDiagram system,
url = urlBuilder.getUrl(line0.get("URL", 0));
}

return executeInternal(line0, system, url, lines);
return executeInternal(line0, system, url, display);
}

@Override
Expand All @@ -219,7 +221,7 @@ public boolean isEligibleFor(ParserPass pass) {
}

private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
BlocLines strings) throws NoSuchColorException {
Display display) throws NoSuchColorException {
final String pos = line0.get("POSITION", 0);
final String idShort = diagram.cleanId(line0.get("CODE", 0));
final Entity cl1;
Expand Down Expand Up @@ -248,13 +250,13 @@ private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntity
}

if (diagram.getPragma().useKermor() && cl1.isGroup()) {
cl1.addNote(strings.toDisplay(), position, colors);
cl1.addNote(display, position, colors);
return CommandExecutionResult.ok();
}

final String tmp = diagram.getUniqueSequence("GMN");
final Quark<Entity> quark = diagram.quarkInContext(true, tmp);
final Entity note = diagram.reallyCreateLeaf(quark, strings.toDisplay(), LeafType.NOTE, null);
final Entity note = diagram.reallyCreateLeaf(quark, display, LeafType.NOTE, null);

if (stereotypeString != null)
note.setStereotype(stereotype);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.Colors;
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
Expand All @@ -62,7 +63,7 @@
import net.sourceforge.plantuml.utils.Position;

public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand<CucaDiagram> {

private final ParserPass selectedpass;

public CommandFactoryNoteOnLink(ParserPass selectedpass) {
Expand Down Expand Up @@ -113,45 +114,45 @@ public String getPatternEnd() {
}

@Override
protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines, ParserPass currentPass)
throws NoSuchColorException {
protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines,
ParserPass currentPass) throws NoSuchColorException {
final String line0 = lines.getFirst().getTrimmed().getString();
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
if (lines.size() > 0) {
final RegexResult arg = getStartingPattern().matcher(line0);
return executeInternal(system, lines, arg);
final Display display = lines.toDisplay();
return executeInternal(system, arg, display);
}
return CommandExecutionResult.error("No note defined");
}

@Override
public boolean isEligibleFor(ParserPass pass) {
return pass == selectedpass;
}


};
}

public Command<CucaDiagram> createSingleLine() {
return new SingleLineCommand2<CucaDiagram>(getRegexConcatSingleLine()) {

@Override
protected CommandExecutionResult executeArg(final CucaDiagram system, LineLocation location,
protected CommandExecutionResult executeArg(final CucaDiagram diagram, LineLocation location,
RegexResult arg, ParserPass currentPass) throws NoSuchColorException {
final BlocLines note = BlocLines.getWithNewlines(arg.get("NOTE", 0));
return executeInternal(system, note, arg);
final Display display = Display.getWithNewlines(diagram.getPragma(), arg.get("NOTE", 0));
return executeInternal(diagram, arg, display);
}

@Override
public boolean isEligibleFor(ParserPass pass) {
return pass == selectedpass;
}
};
}

private CommandExecutionResult executeInternal(CucaDiagram diagram, BlocLines note, final RegexResult arg)
private CommandExecutionResult executeInternal(CucaDiagram diagram, final RegexResult arg, Display display)
throws NoSuchColorException {
final Link link = diagram.getLastLink();
if (link == null)
Expand All @@ -167,7 +168,7 @@ private CommandExecutionResult executeInternal(CucaDiagram diagram, BlocLines no
url = urlBuilder.getUrl(arg.get("URL", 0));
}
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
link.addNote(CucaNote.build(note.toDisplay(), position, colors));
link.addNote(CucaNote.build(display, position, colors));
return CommandExecutionResult.ok();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ protected CommandExecutionResult executeNow(final AbstractEntityDiagram system,
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
final Display display = lines.toDisplay();

Url url = null;
if (line0.get("URL", 0) != null) {
Expand All @@ -151,13 +152,13 @@ protected CommandExecutionResult executeNow(final AbstractEntityDiagram system,
url = urlBuilder.getUrl(line0.get("URL", 0));
}

return executeInternal(line0, system, url, lines);
return executeInternal(line0, system, url, display);
}
};
}

private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
BlocLines lines) throws NoSuchColorException {
Display display) throws NoSuchColorException {

final String pos = line0.get("POSITION", 0);

Expand All @@ -177,7 +178,8 @@ private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntity
Entity tips = identTip.getData();

if (tips == null) {
tips = diagram.reallyCreateLeaf(identTip, Display.getWithNewlines(diagram.getPragma(), ""), LeafType.TIPS, null);
tips = diagram.reallyCreateLeaf(identTip, Display.getWithNewlines(diagram.getPragma(), ""), LeafType.TIPS,
null);
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
final Link link;
if (position == Position.RIGHT)
Expand All @@ -189,7 +191,7 @@ private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntity

diagram.addLink(link);
}
tips.putTip(member, lines.toDisplay());
tips.putTip(member, display);

Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ public Command<SequenceDiagram> createSingleLine() {
return new SingleLineCommand2<SequenceDiagram>(getRegexConcatSingleLine()) {

@Override
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
protected CommandExecutionResult executeArg(final SequenceDiagram diagram, LineLocation location,
RegexResult arg, ParserPass currentPass) throws NoSuchColorException {
final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0));

return executeInternal(system, arg, strings);
final Display display = Display.getWithNewlines(diagram.getPragma(), arg.get("NOTE", 0));
return executeInternal(diagram, arg, diagram.manageVariable(display));
}

};
Expand All @@ -127,32 +126,26 @@ public String getPatternEnd() {
}

@Override
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines, ParserPass currentPass)
throws NoSuchColorException {
protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines,
ParserPass currentPass) throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
return executeInternal(system, line0, lines);
final Display display = lines.toDisplay();
return executeInternal(diagram, line0, diagram.manageVariable(display));
}

};
}

private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines)
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, Display display)
throws NoSuchColorException {
// final Participant p1 = diagram.getOrCreateParticipant(StringUtils
// .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
// final Participant p2 = diagram.getOrCreateParticipant(StringUtils
// .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P2", 0)));

final String across = line0.get("ACROSS", 0);
if (across.equalsIgnoreCase("accross")) {
if (across.equalsIgnoreCase("accross"))
return CommandExecutionResult.error("Use 'across' instead of 'accross'");
}

if (lines.size() > 0) {
if (display.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null;
final Display display = diagram.manageVariable(lines.toDisplay());
final Note note = new Note((Participant) null, (Participant) null, display,
diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
Expand All @@ -164,9 +157,6 @@ private CommandExecutionResult executeInternal(SequenceDiagram diagram, final Re
note.setStereotype(stereotype);
}
note.setColors(colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",
// 0)));
note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ public String getPatternEnd() {
}

@Override
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines, ParserPass currentPass)
throws NoSuchColorException {
protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines,
ParserPass currentPass) throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
return executeInternal(system, line0, lines);
final Display display = lines.toDisplay();
return executeInternal(diagram, line0, diagram.manageVariable(display));
}
};
}
Expand All @@ -137,23 +138,24 @@ public Command<SequenceDiagram> createSingleLine() {
@Override
protected CommandExecutionResult executeArg(final SequenceDiagram diagram, LineLocation location,
RegexResult arg, ParserPass currentPass) throws NoSuchColorException {
return executeInternal(diagram, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0)));
final Display display = Display.getWithNewlines(diagram.getPragma(), arg.get("NOTE", 0));
return executeInternal(diagram, arg, diagram.manageVariable(display));
}

};
}

private CommandExecutionResult executeInternal(SequenceDiagram diagram, RegexResult arg, BlocLines strings)
private CommandExecutionResult executeInternal(SequenceDiagram diagram, RegexResult arg, Display display)
throws NoSuchColorException {
final Participant p = diagram.getOrCreateParticipant(
StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0)));

final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(arg.get("POSITION", 0)));

if (strings.size() > 0) {
if (display.size() > 0) {
final boolean tryMerge = arg.get("VMERGE", 0) != null;
final boolean parallel = arg.get("PARALLEL", 0) != null;
final Display display = diagram.manageVariable(strings.toDisplay());

final Note note = new Note(p, position, display, diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = arg.getLazzy("STEREO", 0);
Expand Down
Loading

0 comments on commit 3554de7

Please sign in to comment.