Skip to content

Commit

Permalink
Fix link on ref
Browse files Browse the repository at this point in the history
  • Loading branch information
gwilherm committed Mar 28, 2022
1 parent a38383b commit 429f4b1
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@

import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.sequencediagram.Participant;
Expand All @@ -72,7 +70,6 @@ private static RegexConcat getConcat() {
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("URL", "\\[\\[([^|]*)(?:\\|([^|]*))?\\]\\]")), //
new RegexLeaf("TEXT", "(.*)"), RegexLeaf.end());
}

Expand All @@ -86,24 +83,16 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio
// HtmlColorSetSimple.instance().getColorIfValid(arg.get("REF").get(1));

final List<String> participants = StringUtils.splitComma(arg.get("PARTS", 0));
final String url = arg.get("URL", 0);
final String title = arg.get("URL", 1);
final String text = StringUtils.trin(arg.get("TEXT", 0));

final List<Participant> p = new ArrayList<>();
for (String s : participants) {
p.add(diagram.getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s)));
}

final Display strings = Display.getWithNewlines(text);

Url u = null;
if (url != null) {
u = new Url(url, title);
}

final HColor backColorGeneral = null;
final Reference ref = new Reference(p, u, strings, backColorGeneral, backColorElement,
final Reference ref = new Reference(p, null, strings, backColorGeneral, backColorElement,
diagram.getSkinParam().getCurrentStyleBuilder());
diagram.addReference(ref);
return CommandExecutionResult.ok();
Expand Down

0 comments on commit 429f4b1

Please sign in to comment.