diff --git a/CONVENTIONAL_COMMIT.md b/CONVENTIONAL_COMMIT.md index 2dd77571e17..35aa56df2fe 100644 --- a/CONVENTIONAL_COMMIT.md +++ b/CONVENTIONAL_COMMIT.md @@ -69,6 +69,7 @@ Each Gitmoji corresponds to a specific type of change: | 🔒 | Fixing security issues | `fix` | | 🌱 | Adding or updating a seed file | `chore` | | 🔥 | Removing code or files | `chore` | +| 🚧 | Work in progress (WIP) | `chore` | #### Guidelines for Using Gitmoji - Place the corresponding emoji at the beginning of the **description** in the commit message header. diff --git a/src/net/atmp/CucaDiagram.java b/src/net/atmp/CucaDiagram.java index d8ea7a58614..84a7cf76093 100644 --- a/src/net/atmp/CucaDiagram.java +++ b/src/net/atmp/CucaDiagram.java @@ -308,7 +308,7 @@ private void eventuallyBuildPhantomGroups() { int countChildren = quark.countChildren(); if (countChildren > 0) { // final Display display = Display.getWithNewlines(quark.getQualifiedName()); - final Display display = Display.getWithNewlines(legacyReplaceBackslashNByNewline(), quark.getName()); + final Display display = Display.getWithNewlines(getPragma(), quark.getName()); final Entity result = this.createGroup(quark, GroupType.PACKAGE); result.setDisplay(display); } diff --git a/src/net/atmp/ImageBuilder.java b/src/net/atmp/ImageBuilder.java index e0a1fa5ded9..a664d70a578 100644 --- a/src/net/atmp/ImageBuilder.java +++ b/src/net/atmp/ImageBuilder.java @@ -63,6 +63,7 @@ import net.sourceforge.plantuml.klimt.color.ColorMapper; import net.sourceforge.plantuml.klimt.color.HColor; import net.sourceforge.plantuml.klimt.color.HColorGradient; +import net.sourceforge.plantuml.klimt.color.HColorSet; import net.sourceforge.plantuml.klimt.color.HColorSimple; import net.sourceforge.plantuml.klimt.color.HColors; import net.sourceforge.plantuml.klimt.drawing.LimitFinder; @@ -78,11 +79,14 @@ import net.sourceforge.plantuml.klimt.drawing.tikz.UGraphicTikz; import net.sourceforge.plantuml.klimt.drawing.txt.UGraphicTxt; import net.sourceforge.plantuml.klimt.drawing.visio.UGraphicVdx; +import net.sourceforge.plantuml.klimt.font.FontConfiguration; import net.sourceforge.plantuml.klimt.font.StringBounder; +import net.sourceforge.plantuml.klimt.font.UFont; import net.sourceforge.plantuml.klimt.geom.XDimension2D; import net.sourceforge.plantuml.klimt.shape.TextBlock; import net.sourceforge.plantuml.klimt.shape.UDrawable; import net.sourceforge.plantuml.klimt.shape.URectangle; +import net.sourceforge.plantuml.klimt.shape.UText; import net.sourceforge.plantuml.skin.ColorParam; import net.sourceforge.plantuml.skin.CornerParam; import net.sourceforge.plantuml.skin.LineParam; @@ -116,6 +120,7 @@ public class ImageBuilder { private TitledDiagram titledDiagram; private boolean randomPixel; private String warningOrError; + private boolean warningN; public static ImageBuilder imageBuilder(FileFormatOption fileFormatOption) { return new ImageBuilder(fileFormatOption); @@ -215,6 +220,7 @@ public ImageBuilder styled(TitledDiagram diagram) { seed = diagram.seed(); titledDiagram = diagram; warningOrError = diagram.getWarningOrError(); + warningN = diagram.getPragma().isBackslashNWarning(); return this; } @@ -240,6 +246,8 @@ public byte[] writeByteArray() throws IOException { private ImageData writeImageInternal(OutputStream os) throws IOException { XDimension2D dim = getFinalDimension(); + if (warningN) + dim = dim.delta(0, 60); final Scale scale = titledDiagram == null ? null : titledDiagram.getScale(); final double scaleFactor = (scale == null ? 1 : scale.getScale(dim.getWidth(), dim.getHeight())) * getDpi() / 96.0; @@ -247,7 +255,12 @@ private ImageData writeImageInternal(OutputStream os) throws IOException { throw new IllegalStateException("Bad scaleFactor"); WasmLog.log("...image drawing..."); UGraphic ug = createUGraphic(dim, scaleFactor, - titledDiagram == null ? new Pragma() : titledDiagram.getPragma()); + titledDiagram == null ? Pragma.createEmpty() : titledDiagram.getPragma()); + if (warningN) { + drawWarning(ug.apply(new UTranslate(margin.getLeft(), 5)), dim.getWidth()); + ug = ug.apply(UTranslate.dy(60)); + } + maybeDrawBorder(ug, dim); if (randomPixel) drawRandomPoint(ug); @@ -268,6 +281,24 @@ private ImageData writeImageInternal(OutputStream os) throws IOException { return createImageData(dim); } + private void drawWarning(UGraphic ug, double width) { + + final HColorSet set = HColorSet.instance(); + + final HColor back = set.getColorOrWhite("ffcccc"); + final HColor border = set.getColorOrWhite("ff9999"); + ug = ug.apply(back.bg()).apply(border); + final URectangle rect = URectangle.build(width - margin.getLeft() - margin.getRight(), 50).rounded(5); + ug.apply(UStroke.withThickness(3)).draw(rect); + + ug = ug.apply(HColors.BLACK); + + final FontConfiguration fc = FontConfiguration.blackBlueTrue(UFont.monospaced(10)); + final String text = "Warning: you are using \\n!"; + ug.apply(new UTranslate(10, 25)).draw(UText.build(text, fc)); + + } + private void maybeDrawBorder(UGraphic ug, XDimension2D dim) { if (skinParam == null) return; diff --git a/src/net/sourceforge/plantuml/TitledDiagram.java b/src/net/sourceforge/plantuml/TitledDiagram.java index 885d51089c0..a4db522d71d 100644 --- a/src/net/sourceforge/plantuml/TitledDiagram.java +++ b/src/net/sourceforge/plantuml/TitledDiagram.java @@ -87,14 +87,10 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram, private final SkinParam skinParam; - public Pragma getPragma() { - return skinParam.getPragma(); - } - public TitledDiagram(UmlSource source, UmlDiagramType type, Map orig) { super(source); this.type = type; - this.skinParam = SkinParam.create(type, new Pragma()); + this.skinParam = SkinParam.create(type, Pragma.createEmpty()); if (orig != null) this.skinParam.copyAllFrom(orig); @@ -261,9 +257,10 @@ public void exportDiagramGraphic(UGraphic ug, FileFormatOption fileFormatOption) textBlock.drawU(ug); } - final public boolean legacyReplaceBackslashNByNewline() { - return skinParam.legacyReplaceBackslashNByNewline(); + final public Pragma getPragma() { + return skinParam.getPragma(); } + } diff --git a/src/net/sourceforge/plantuml/abel/Entity.java b/src/net/sourceforge/plantuml/abel/Entity.java index b991cc59e7c..051659ddf8c 100644 --- a/src/net/sourceforge/plantuml/abel/Entity.java +++ b/src/net/sourceforge/plantuml/abel/Entity.java @@ -603,9 +603,9 @@ public TextBlock getStateHeader(ISkinParam skinParam) { Display display = null; for (CharSequence s : details) if (display == null) - display = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), s.toString()); + display = Display.getWithNewlines(skinParam.getPragma(), s.toString()); else - display = display.addAll(Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), s.toString())); + display = display.addAll(Display.getWithNewlines(skinParam.getPragma(), s.toString())); final HorizontalAlignment horizontalAlignment = style.getHorizontalAlignment(); return display.create(fontConfiguration, horizontalAlignment, skinParam); diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java index 7de04320d1b..6e05b475ddb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java +++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java @@ -80,7 +80,7 @@ public void endif() { public Entity getStart() { final Quark quark = quarkInContext(true, "start"); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), "start"), LeafType.CIRCLE_START, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), "start"), LeafType.CIRCLE_START, null); return quark.getData(); } @@ -89,7 +89,7 @@ public Entity getEnd(String suppId) { final String tmp = suppId == null ? "end" : "end$" + suppId; final Quark quark = quarkInContext(true, tmp); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), "end"), LeafType.CIRCLE_END, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), "end"), LeafType.CIRCLE_END, null); return quark.getData(); } @@ -142,7 +142,7 @@ public Entity createInnerActivity() { final String idShort = "##" + this.getUniqueSequence(""); final Quark quark = quarkInContext(true, idShort); - gotoGroup(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), quark.getName()), GroupType.INNER_ACTIVITY); + gotoGroup(quark, Display.getWithNewlines(getPragma(), quark.getName()), GroupType.INNER_ACTIVITY); final Entity g = getCurrentGroup(); lastEntityConsulted = null; @@ -161,7 +161,7 @@ public void concurrentActivity(String name) { throw new IllegalStateException("type=" + getCurrentGroup().getGroupType()); final Quark idNewLong = quarkInContext(true, idShort); - gotoGroup(idNewLong, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), "code"), GroupType.CONCURRENT_ACTIVITY); + gotoGroup(idNewLong, Display.getWithNewlines(getPragma(), "code"), GroupType.CONCURRENT_ACTIVITY); lastEntityConsulted = null; lastEntityBrancheConsulted = null; } diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java index 96cd8d31c92..33670f8786a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java @@ -125,7 +125,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocatio final Entity branch = diagram.getCurrentContext().getBranch(); - final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("BRACKET", 0)), lenght); + final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.getPragma(), arg.get("BRACKET", 0)), lenght); Link link = new Link(diagram, diagram.getSkinParam().getCurrentStyleBuilder(), entity1, branch, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), linkArg.withQuantifier(null, ifLabel) .withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle())); diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java index b29a3b2322f..f9f1bb5a1ef 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java @@ -146,7 +146,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocatio if (arg.get("STEREOTYPE2", 0) != null) entity2.setStereotype(Stereotype.build(arg.get("STEREOTYPE2", 0))); - final Display linkLabel = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("BRACKET", 0)); + final Display linkLabel = Display.getWithNewlines(diagram.getPragma(), arg.get("BRACKET", 0)); final String arrowBody1 = CommandLinkClass.notNull(arg.get("ARROW_BODY1", 0)); final String arrowBody2 = CommandLinkClass.notNull(arg.get("ARROW_BODY2", 0)); @@ -215,7 +215,7 @@ static Entity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean final LeafType type = getTypeIfExisting(diagram, ident); Entity result = ident.getData(); if (result == null) - result = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), idShort), type, null); + result = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(diagram.getPragma(), idShort), type, null); if (partition != null) diagram.endGroup(); @@ -227,7 +227,7 @@ static Entity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean final Quark quark = diagram.quarkInContext(true, diagram.cleanId(bar)); Entity result = quark.getData(); if (result == null) - result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), bar), LeafType.SYNCHRO_BAR, null); + result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), bar), LeafType.SYNCHRO_BAR, null); return result; } final RegexPartialMatch quoted = arg.get("QUOTED" + suf); @@ -235,7 +235,7 @@ static Entity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1); if (partition != null) { final Quark quark = diagram.quarkInContext(true, diagram.cleanId(partition)); - diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), partition), GroupType.PACKAGE); + diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), partition), GroupType.PACKAGE); } final Quark quark = diagram.quarkInContext(true, diagram.cleanId(quotedString)); @@ -243,7 +243,7 @@ static Entity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean final LeafType type = getTypeIfExisting(diagram, quark); Entity result = quark.getData(); if (result == null) - result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quoted.get(0)), type, null); + result = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), quoted.get(0)), type, null); if (partition != null) diagram.endGroup(); @@ -258,7 +258,7 @@ static Entity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean final Quark identInvisible = diagram.quarkInContext(true, diagram.cleanId(quoteInvisibleString)); Entity result = identInvisible.getData(); if (result == null) - result = diagram.reallyCreateLeaf(identInvisible, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), identInvisible.getName()), + result = diagram.reallyCreateLeaf(identInvisible, Display.getWithNewlines(diagram.getPragma(), identInvisible.getName()), LeafType.ACTIVITY, null); if (partition != null) diagram.endGroup(); diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java index 8290f966caf..3351d0442fa 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java @@ -178,13 +178,13 @@ protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocL } if (partition != null) { final Quark idNewLong = diagram.quarkInContext(true, diagram.cleanId(partition)); - diagram.gotoGroup(idNewLong, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), partition), GroupType.PACKAGE); + diagram.gotoGroup(idNewLong, Display.getWithNewlines(diagram.getPragma(), partition), GroupType.PACKAGE); } final Quark ident = diagram.quarkInContext(true, diagram.cleanId(idShort)); Entity entity2 = ident.getData(); if (entity2 == null) - entity2 = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString), LeafType.ACTIVITY, null); + entity2 = diagram.reallyCreateLeaf(ident, Display.getWithNewlines(diagram.getPragma(), displayString), LeafType.ACTIVITY, null); diagram.setLastEntityConsulted(entity2); @@ -210,7 +210,7 @@ protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocL final int lenght = arrow.length() - 1; - final Display linkLabel = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), line0.get("BRACKET", 0)); + final Display linkLabel = Display.getWithNewlines(diagram.getPragma(), line0.get("BRACKET", 0)); LinkType type = new LinkType(LinkDecor.ARROW, LinkDecor.NONE); if (arrow.contains(".")) diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java index 77c0d97601c..074c7071251 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java @@ -85,7 +85,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocatio throws NoSuchColorException { final Quark quark = diagram.quarkInContext(true, diagram.cleanId(arg.get("NAME", 0))); - diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()), GroupType.PACKAGE); + diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), quark.getName()), GroupType.PACKAGE); final Entity p = diagram.getCurrentGroup(); final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java index d83124144d4..910a5621c11 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java @@ -143,7 +143,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati if (style == BoxStyle.PLAIN) style = BoxStyle.fromString(arg.get("STYLE", 0)); - final Display display = Display.getWithNewlines2(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display display = Display.getWithNewlines2(diagram.getPragma(), arg.get("LABEL", 0)); return diagram.addActivity(display, style, url, colors, stereotype); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java index d9d0a4d8aa4..8286c1d72dc 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java @@ -63,7 +63,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - return diagram.addActivity(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)), BoxStyle.PLAIN, null, Colors.empty(), + return diagram.addActivity(Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)), BoxStyle.PLAIN, null, Colors.empty(), null); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java index 7265960bfe6..fb254b638d6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java @@ -80,7 +80,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati } final String label = arg.get("LABEL", 0); if (label != null && label.length() > 0) - diagram.setLabelNextArrow(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), label)); + diagram.setLabelNextArrow(Display.getWithNewlines(diagram.getPragma(), label)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java index 5dbc6b26490..c1939afc0ef 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java @@ -104,7 +104,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati if (stereo != null) stereotype = Stereotype.build(stereo); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); final LinkRendering in = getBackRendering(diagram, arg, "INCOMING"); final LinkRendering out = getBackRendering(diagram, arg, "OUTCOMING"); @@ -121,7 +121,7 @@ static public LinkRendering getBackRendering(ActivityDiagram3 diagram, RegexResu else in = LinkRendering.create(incomingColor); final String label = arg.get(name, 0); - return in.withDisplay(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), label)); + return in.withDisplay(Display.getWithNewlines(diagram.getPragma(), label)); } static private Rainbow getRainbow(String key, ActivityDiagram3 diagram, RegexResult arg) diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java index b191e73fccb..be41b00ba65 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java @@ -70,7 +70,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati test = null; } - return diagram.switchCase(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), test)); + return diagram.switchCase(Display.getWithNewlines(diagram.getPragma(), test)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java index d9528071d85..1c70159b669 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java @@ -110,7 +110,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati final LinkRendering incoming = CommandBackward3.getBackRendering(diagram, arg, "INCOMING"); final LinkRendering when = CommandBackward3.getBackRendering(diagram, arg, "WHEN"); - return diagram.elseIf(incoming, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), test), when, color); + return diagram.elseIf(incoming, Display.getWithNewlines(diagram.getPragma(), test), when, color); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf3.java index cfa45552d0f..68fa2a3224d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf3.java @@ -115,7 +115,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati final LinkRendering incoming = CommandBackward3.getBackRendering(diagram, arg, "INCOMING"); final LinkRendering when = CommandBackward3.getBackRendering(diagram, arg, "WHEN"); - return diagram.elseIf(incoming, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), test), when, color); + return diagram.elseIf(incoming, Display.getWithNewlines(diagram.getPragma(), test), when, color); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java index 5da889907c0..90117de2f62 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java @@ -70,7 +70,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati // if (getSystem().getLastEntityConsulted() == null) { // return CommandExecutionResult.error("No if for this endif"); // } - final Display when = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("WHEN", 0)); + final Display when = Display.getWithNewlines(diagram.getPragma(), arg.get("WHEN", 0)); return diagram.else2(LinkRendering.none().withDisplay(when)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java index cfe7ae2419b..0d34f87a198 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java @@ -100,7 +100,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati } final Stereotype stereotype = Stereotype.build(arg.get("STEREO", 0)); - diagram.startIf(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), test), Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("WHEN", 0)), color, url, stereotype); + diagram.startIf(Display.getWithNewlines(diagram.getPragma(), test), Display.getWithNewlines(diagram.getPragma(), arg.get("WHEN", 0)), color, url, stereotype); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java index 56e07291054..fe606292399 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java @@ -86,7 +86,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati if (test.length() == 0) test = null; - diagram.startIf(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), test), Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("WHEN", 0)), color, null, null); + diagram.startIf(Display.getWithNewlines(diagram.getPragma(), test), Display.getWithNewlines(diagram.getPragma(), arg.get("WHEN", 0)), color, null, null); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java index aef11d356c9..bd146830fcc 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java @@ -72,7 +72,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - diagram.startIf(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("TEST", 0)), Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("WHEN", 0)), null, + diagram.startIf(Display.getWithNewlines(diagram.getPragma(), arg.get("TEST", 0)), Display.getWithNewlines(diagram.getPragma(), arg.get("WHEN", 0)), null, null, null); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java index 3f9379891a5..3eaa16cb395 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java @@ -62,7 +62,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { // diagram.setColorNextArrow(color); - diagram.setLabelNextArrow(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), "NOLINK")); + diagram.setLabelNextArrow(Display.getWithNewlines(diagram.getPragma(), "NOLINK")); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java index 20d0b2ee184..ce1c82a2548 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java @@ -85,7 +85,7 @@ static IRegex getRegexConcat() { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg, ParserPass currentPass) throws NoSuchColorException { final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final Display note = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("NOTE", 0)); + final Display note = Display.getWithNewlines(diagram.getPragma(), arg.get("NOTE", 0)); final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0)); final NoteType type = NoteType.defaultType(arg.get("TYPE", 0)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java index 784736ffbb4..172250a7218 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java @@ -132,7 +132,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati // final HColor titleColor = HColors.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet()); // final double roundCorner = stylePartition.value(PName.RoundCorner).asDouble(); - diagram.startGroup(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), partitionTitle), backColor, symbol, stylePartition); + diagram.startGroup(Display.getWithNewlines(diagram.getPragma(), partitionTitle), backColor, symbol, stylePartition); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java index e081cfd6e93..f83a74d04d6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java @@ -83,7 +83,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati throws NoSuchColorException { final String s = arg.get("COLOR", 0); final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); final BoxStyle boxStyle; final String styleString = arg.get("STYLE", 0); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java index f7b04c3581e..b522e02009b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java @@ -104,9 +104,9 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg, ParserPass currentPass) throws NoSuchColorException { - final Display test = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("TEST", 0)); - final Display yes = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("WHEN", 0)); - final Display out = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("OUT", 0)); + final Display test = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("TEST", 0)); + final Display yes = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("WHEN", 0)); + final Display out = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("OUT", 0)); final String colorString = arg.get("COLOR", 0); final Rainbow rainbow; @@ -117,7 +117,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati diagram.getSkinParam().colorArrowSeparationSpace()); } - final Display linkLabel = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display linkLabel = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); return diagram.repeatWhile(test, yes, out, linkLabel, rainbow); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java index f5128362a93..5b51fc8706c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java @@ -93,7 +93,7 @@ protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines // 0)); final String test = line0.get("TEST1", 0); - Display testDisplay = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), test); + Display testDisplay = Display.getWithNewlines(diagram.getPragma(), test); for (StringLocated s : lines.subExtract(1, 1)) { testDisplay = testDisplay.add(s.getString()); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java index c300888144d..57f78898db8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java @@ -71,7 +71,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati final String s = arg.get("COLOR", 0); final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s); final String name = arg.get("SWIMLANE", 0); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); return diagram.swimlane(name, color, label); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java index 86c511b7d33..9a3b1cb8b9c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java @@ -79,7 +79,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati final String s = arg.get("COLOR", 0); final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s); final String name = arg.get("SWIMLANE", 0); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); return diagram.swimlane(name, color, label); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java index 21dcd7e5d39..9d0ea6580ca 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java @@ -77,7 +77,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati if (test.length() == 0) test = null; - diagram.startSwitch(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), test), color); + diagram.startSwitch(Display.getWithNewlines(diagram.getPragma(), test), color); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java index 013b28b2be9..04631458fbb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java @@ -78,7 +78,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati throws NoSuchColorException { final String s = arg.get("COLOR", 0); final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s); - diagram.doWhile(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("TEST", 0)), Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("YES", 0)), color); + diagram.doWhile(Display.getWithNewlines(diagram.getPragma(), arg.get("TEST", 0)), Display.getWithNewlines(diagram.getPragma(), arg.get("YES", 0)), color); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java index 8ce9fafdc0d..972ce759a1d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java @@ -76,7 +76,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - return diagram.endwhile(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("OUT", 0))); + return diagram.endwhile(Display.getWithNewlines(diagram.getPragma(), arg.get("OUT", 0))); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java index 823142785c3..6c077e1292e 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.klimt.color.HColor; import net.sourceforge.plantuml.klimt.creole.Display; import net.sourceforge.plantuml.klimt.geom.MinMax; +import net.sourceforge.plantuml.skin.Pragma; public class Swimlane implements SpecificBackcolorable, Comparable { @@ -54,9 +55,9 @@ public class Swimlane implements SpecificBackcolorable, Comparable { private UTranslate translate = UTranslate.none(); private double actualWidth; - public Swimlane(String name, int order) { + public Swimlane(String name, int order, Pragma pragma) { this.name = name; - this.display = Display.getWithNewlines(false, name); + this.display = Display.getWithNewlines(pragma, name); this.order = order; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java index 0df019d31c9..8072598412f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java @@ -111,7 +111,7 @@ private List swimlanes() { private List swimlanesSpecial() { if (swimlanesSpecial.size() == 0) { swimlanesSpecial.addAll(swimlanesRaw); - final Swimlane last = new Swimlane("", Integer.MAX_VALUE); + final Swimlane last = new Swimlane("", Integer.MAX_VALUE, pragma); last.setMinMax(MinMax.getEmpty(true)); swimlanesSpecial.add(last); } @@ -165,7 +165,7 @@ private Swimlane getOrCreate(String name) { if (s.getName().equals(name)) return s; - final Swimlane result = new Swimlane(name, swimlanesRaw.size()); + final Swimlane result = new Swimlane(name, swimlanesRaw.size(), pragma); swimlanesRaw.add(result); return result; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java index 351de86f04a..772922d648f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java @@ -114,7 +114,7 @@ protected Ftile doStep2(Ftile middle, Ftile result) { ((FtileBlackBlock) out).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), barHeight); if (label != null) - ((FtileBlackBlock) out).setLabel(getTextBlock(Display.getWithNewlines(skinParam().legacyReplaceBackslashNByNewline(), label))); + ((FtileBlackBlock) out).setLabel(getTextBlock(Display.getWithNewlines(skinParam().getPragma(), label))); result = new FtileAssemblySimple(result, out); final List conns = new ArrayList<>(); diff --git a/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java b/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java index 04917dfb876..f4f3f10fbdb 100644 --- a/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java +++ b/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java @@ -38,6 +38,8 @@ import java.util.EnumSet; import java.util.Set; +import net.sourceforge.plantuml.skin.Pragma; + abstract class AbstractConnectorPuzzle implements ConnectorPuzzle { // ::remove folder when __HAXE__ @@ -65,5 +67,9 @@ public final void append(ConnectorPuzzle other) { protected final Set connections() { return connections; } + + protected Pragma getPragma() { + return Pragma.createEmpty(); + } } diff --git a/src/net/sourceforge/plantuml/bpm/BpmElement.java b/src/net/sourceforge/plantuml/bpm/BpmElement.java index aaace643f25..3f76b9feb7e 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmElement.java +++ b/src/net/sourceforge/plantuml/bpm/BpmElement.java @@ -70,7 +70,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz public BpmElement(String id, BpmElementType type, String label) { this.id = id; this.type = type; - this.display = Display.getWithNewlines(false, label); + this.display = Display.getWithNewlines(getPragma(), label); } public BpmElement(String id, BpmElementType type) { @@ -162,7 +162,7 @@ public TextBlock toTextBlockInternal(ISkinParam skinParam) { final UFont font = UFont.serif(14); final FontConfiguration fc = FontConfiguration.create(font, HColors.RED, HColors.RED, null); if (Display.isNull(display)) { - return Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), type.toString()).create(fc, HorizontalAlignment.LEFT, skinParam); + return Display.getWithNewlines(skinParam.getPragma(), type.toString()).create(fc, HorizontalAlignment.LEFT, skinParam); } return display.create(fc, HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java index d9ba7999b12..2e70cc8041b 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java @@ -106,7 +106,7 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation linkType = linkType.goBold(); } final Link link = new Link(diagram, diagram.getCurrentStyleBuilder(), entity1, entity2, linkType, - LinkArg.build(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), cardinality), 3)); + LinkArg.build(Display.getWithNewlines(diagram.getPragma(), cardinality), 3)); link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName())); link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet())); diagram.addLink(link); diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java index d2ec4535f61..402d4139cef 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java @@ -112,7 +112,7 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation Entity entity = quark.getData(); if (entity == null) { - final Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayText); + final Display display = Display.getWithNewlines(diagram.getPragma(), displayText); entity = diagram.reallyCreateLeaf(quark, display, type, null); } else { return CommandExecutionResult.error("Attribute already exists"); diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java index 8ed1dee8001..d0d51d06484 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java @@ -112,7 +112,7 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation Entity entity = quark.getData(); if (entity == null) { - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayText); + Display display = Display.getWithNewlines(diagram.getPragma(), displayText); entity = diagram.reallyCreateLeaf(quark, display, type, null); } else { if (entity.muteToType(type, null) == false) diff --git a/src/net/sourceforge/plantuml/chronology/TimeHeaderChronology.java b/src/net/sourceforge/plantuml/chronology/TimeHeaderChronology.java index 97eb3eda0d5..0d738dfea7b 100644 --- a/src/net/sourceforge/plantuml/chronology/TimeHeaderChronology.java +++ b/src/net/sourceforge/plantuml/chronology/TimeHeaderChronology.java @@ -99,7 +99,7 @@ private void drawSimpleDayCounter(UGraphic ug, TimeScale timeScale) { for (Day i = getMin(); i.compareTo(getMax().increment()) < 0; i = i.increment(printScale)) { final UFont font = thParam.getStyle(SName.timeline, SName.day).getUFont(); final FontConfiguration fontConfiguration = getFontConfiguration(font, false, openFontColor()); - final TextBlock num = Display.getWithNewlines(false, i.toStringShort(thParam.getLocale())) + final TextBlock num = Display.getWithNewlines(getPragma(), i.toStringShort(thParam.getLocale())) .create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final double x1 = timeScale.getStartingPosition(i); final double x2; diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index 57d484512b9..03db5ecda5b 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -126,9 +126,9 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l Entity entity = quark.getData(); if (entity == null) { - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); entity = diagram.reallyCreateLeaf(quark, display, type, null); } else { if (entity.muteToType(type, null) == false) diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index 09fcbea627d..8234a4e0e3e 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -164,10 +164,10 @@ protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines line Entity entity = quark.getData(); - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (entity == null) { if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); entity = diagram.reallyCreateLeaf(quark, display, type, null); } else { if (entity.muteToType(type, null) == false) @@ -274,7 +274,7 @@ public static void manageExtends(String keyword, ClassDiagram diagram, RegexResu final Quark quark = diagram.quarkInContext(false, diagram.cleanId(idShort)); Entity cl2 = quark.getData(); if (cl2 == null) - cl2 = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()), type2, null); + cl2 = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), quark.getName()), type2, null); LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS); if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE) @@ -308,9 +308,9 @@ private Entity executeArg0(ClassDiagram diagram, RegexResult line0) throws NoSuc final Quark quark = diagram.quarkInContext(false, idShort); - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); Entity entity = quark.getData(); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java index 21ab57f7433..25719980ec2 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java @@ -192,7 +192,7 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l } final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); - final Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayRaw == null ? idShort : displayRaw); + final Display display = Display.getWithNewlines(diagram.getPragma(), displayRaw == null ? idShort : displayRaw); final Quark quark = diagram.quarkInContext(true, idShort); Entity entity = quark.getData(); if (entity == null) diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java index b0ee654f23b..60da058d0ba 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java @@ -71,7 +71,7 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l if (quark.getData() != null) return CommandExecutionResult.error("Already existing : " + quark.getName()); - diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), ""), LeafType.ASSOCIATION, null); + diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), ""), LeafType.ASSOCIATION, null); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java index aaa35375f08..ae40c1779e7 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java @@ -208,10 +208,10 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram Entity cl1 = quark1.get().getData(); if (cl1 == null) - cl1 = diagram.reallyCreateLeaf(quark1.get(), Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark1.get().getName()), LeafType.CLASS, null); + cl1 = diagram.reallyCreateLeaf(quark1.get(), Display.getWithNewlines(diagram.getPragma(), quark1.get().getName()), LeafType.CLASS, null); Entity cl2 = quark2.get().getData(); if (cl2 == null) - cl2 = diagram.reallyCreateLeaf(quark2.get(), Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark2.get().getName()), LeafType.CLASS, null); + cl2 = diagram.reallyCreateLeaf(quark2.get(), Display.getWithNewlines(diagram.getPragma(), quark2.get().getName()), LeafType.CLASS, null); final Direction dir = getDirection(arg); final int queue; @@ -226,7 +226,7 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram final String kal2 = arg.get("QUALIFIER2", 0); final LinkArg linkArg = LinkArg - .build(labels.getDisplay(diagram.legacyReplaceBackslashNByNewline()), queue, diagram.getSkinParam().classAttributeIconSize() > 0) + .build(labels.getDisplay(diagram.getPragma()), queue, diagram.getSkinParam().classAttributeIconSize() > 0) .withQuantifier(labels.getFirstLabel(), labels.getSecondLabel()) .withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()).withKal(kal1, kal2); @@ -296,7 +296,7 @@ private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram d else queue = getQueueLength(arg); - final Display labelLink = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL_LINK", 0)); + final Display labelLink = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL_LINK", 0)); final String firstLabel = arg.get("FIRST_LABEL", 0); final String secondLabel = arg.get("SECOND_LABEL", 0); final LinkArg linkArg = LinkArg.build(labelLink, queue, diagram.getSkinParam().classAttributeIconSize() > 0); @@ -334,10 +334,10 @@ private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram d Entity cl2 = ent2.getData(); if (cl2 == null) - cl2 = diagram.reallyCreateLeaf(ent2, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), ent2.getName()), LeafType.CLASS, null); + cl2 = diagram.reallyCreateLeaf(ent2, Display.getWithNewlines(diagram.getPragma(), ent2.getName()), LeafType.CLASS, null); final LinkType linkType = getLinkType(arg); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL_LINK", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL_LINK", 0)); final boolean result = diagram.associationClass(1, cl1A, cl1B, cl2, linkType, label); if (result == false) @@ -367,10 +367,10 @@ private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram d Entity cl1 = (Entity) ent1.getData(); if (cl1 == null) - cl1 = diagram.reallyCreateLeaf(ent1, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), ent1.getName()), LeafType.CLASS, null); + cl1 = diagram.reallyCreateLeaf(ent1, Display.getWithNewlines(diagram.getPragma(), ent1.getName()), LeafType.CLASS, null); final LinkType linkType = getLinkType(arg); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL_LINK", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL_LINK", 0)); final boolean result = diagram.associationClass(2, cl2A, cl2B, cl1, linkType, label); if (result == false) @@ -406,7 +406,7 @@ private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram d final Entity cl2B = (Entity) quark2B.getData(); final LinkType linkType = getLinkType(arg); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL_LINK", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL_LINK", 0)); return diagram.associationClass(cl1A, cl1B, cl2A, cl2B, linkType, label); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java index ed1f1d2fab0..15853db46bc 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java @@ -133,7 +133,7 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram final Quark idNewLong = diagram.quarkInContext(true, diagram.cleanId(ent1) + suffix); final LeafType type = getType(arg.get("ENT_THEN_LOL", 1)); - cl2 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), ent2), type, null); + cl2 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(diagram.getPragma(), ent2), type, null); normalEntity = cl1; // assert arg.get("ENT_THEN_LOL", 0) != null; @@ -152,7 +152,7 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram final Quark idNewLong = diagram.quarkInContext(true, diagram.cleanId(ent2) + suffix); final LeafType type = getType(arg.get("LOL_THEN_ENT", 0)); - cl1 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), ent1), type, null); + cl1 = diagram.reallyCreateLeaf(idNewLong, Display.getWithNewlines(diagram.getPragma(), ent1), type, null); normalEntity = cl2; } @@ -200,7 +200,7 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram } labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink); } - final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), labelLink), length, + final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.getPragma(), labelLink), length, diagram.getSkinParam().classAttributeIconSize() > 0); final Link link = new Link(diagram, diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType, linkArg.withQuantifier(firstLabel, secondLabel) diff --git a/src/net/sourceforge/plantuml/command/CommandCaption.java b/src/net/sourceforge/plantuml/command/CommandCaption.java index 86519d23041..9484c7df884 100644 --- a/src/net/sourceforge/plantuml/command/CommandCaption.java +++ b/src/net/sourceforge/plantuml/command/CommandCaption.java @@ -68,7 +68,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - final Display s = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("DISPLAY", 0)); + final Display s = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("DISPLAY", 0)); diagram.setCaption(DisplayPositioned.single(s, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/net/sourceforge/plantuml/command/CommandFooter.java index 5033bc063b2..041e20add29 100644 --- a/src/net/sourceforge/plantuml/command/CommandFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandFooter.java @@ -78,7 +78,7 @@ protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation ha = FontParam.FOOTER.getStyleDefinition(null).getMergedStyle(diagram.getCurrentStyleBuilder()) .getHorizontalAlignment(); - final Display s = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("LABEL", 0)); + final Display s = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("LABEL", 0)); diagram.getFooter().putDisplay(s, ha); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/net/sourceforge/plantuml/command/CommandHeader.java index ea9c4efc369..df022e25eac 100644 --- a/src/net/sourceforge/plantuml/command/CommandHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandHeader.java @@ -80,7 +80,7 @@ protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation ha = FontParam.HEADER.getStyleDefinition(null).getMergedStyle(diagram.getCurrentStyleBuilder()) .getHorizontalAlignment(); - final Display s = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("LABEL", 0)); + final Display s = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("LABEL", 0)); diagram.getHeader().putDisplay(s, ha); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/CommandLegend.java b/src/net/sourceforge/plantuml/command/CommandLegend.java index e7f10052eac..9bc04f9e684 100644 --- a/src/net/sourceforge/plantuml/command/CommandLegend.java +++ b/src/net/sourceforge/plantuml/command/CommandLegend.java @@ -68,7 +68,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - final Display s = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("LEGEND", 0)); + final Display s = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("LEGEND", 0)); diagram.setLegend(DisplayPositioned.single(s, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/CommandMainframe.java b/src/net/sourceforge/plantuml/command/CommandMainframe.java index 2e6cb2489d7..88c78f8a23a 100644 --- a/src/net/sourceforge/plantuml/command/CommandMainframe.java +++ b/src/net/sourceforge/plantuml/command/CommandMainframe.java @@ -63,7 +63,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); diagram.setMainFrame(label); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace.java b/src/net/sourceforge/plantuml/command/CommandNamespace.java index d432306bfeb..4bd25d9606d 100644 --- a/src/net/sourceforge/plantuml/command/CommandNamespace.java +++ b/src/net/sourceforge/plantuml/command/CommandNamespace.java @@ -87,7 +87,7 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l final USymbol usymbol = USymbols.fromString(stereotype, diagram.getSkinParam().actorStyle(), diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()); - final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()), + final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), quark.getName()), GroupType.PACKAGE, usymbol); if (status.isOk() == false) return status; diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace2.java b/src/net/sourceforge/plantuml/command/CommandNamespace2.java index be8326d496d..4c369389b30 100644 --- a/src/net/sourceforge/plantuml/command/CommandNamespace2.java +++ b/src/net/sourceforge/plantuml/command/CommandNamespace2.java @@ -88,7 +88,7 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l final Quark quark = diagram.quarkInContext(false, diagram.cleanId(idShort)); final String disp = arg.getLazzy("DISPLAY", 0); - final Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), disp); + final Display display = Display.getWithNewlines(diagram.getPragma(), disp); final CommandExecutionResult status = diagram.gotoGroup(quark, display, GroupType.PACKAGE); if (status.isOk() == false) return status; diff --git a/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java index d20c4989512..05bd99ef618 100644 --- a/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java +++ b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java @@ -85,7 +85,7 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l if (quark.getData() != null) return CommandExecutionResult.error("Already exists " + quark.getName()); - final Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getQualifiedName()); + final Display display = Display.getWithNewlines(diagram.getPragma(), quark.getQualifiedName()); final CommandExecutionResult status = diagram.gotoGroup(quark, display, GroupType.PACKAGE); if (status.isOk() == false) return status; diff --git a/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/net/sourceforge/plantuml/command/CommandPackage.java index 9ba8a526cfc..bf280e43ea5 100644 --- a/src/net/sourceforge/plantuml/command/CommandPackage.java +++ b/src/net/sourceforge/plantuml/command/CommandPackage.java @@ -134,7 +134,7 @@ protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineL final USymbol usymbol = USymbols.fromString(stereotype, diagram.getSkinParam().actorStyle(), diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()); - final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), + final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), display), GroupType.PACKAGE, usymbol); if (status.isOk() == false) return status; diff --git a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java index ee74808daea..4402fb23089 100644 --- a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java +++ b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java @@ -95,7 +95,7 @@ protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineL idShort = arg.get("CODE", 0); } final Quark quark = diagram.quarkInContext(false, diagram.cleanId(idShort)); - final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), + final CommandExecutionResult status = diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), display), GroupType.PACKAGE); if (status.isOk() == false) return status; diff --git a/src/net/sourceforge/plantuml/command/CommandTitle.java b/src/net/sourceforge/plantuml/command/CommandTitle.java index 5b52f207a8d..7380bf9bc53 100644 --- a/src/net/sourceforge/plantuml/command/CommandTitle.java +++ b/src/net/sourceforge/plantuml/command/CommandTitle.java @@ -68,7 +68,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - final Display s = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.getLazzy("TITLE", 0)); + final Display s = Display.getWithNewlines(diagram.getPragma(), arg.getLazzy("TITLE", 0)); diagram.setTitle(DisplayPositioned.single(s, HorizontalAlignment.CENTER, VerticalAlignment.TOP)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java index 2633aad67d2..b11bb6a00ec 100644 --- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java +++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java @@ -139,7 +139,7 @@ protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineL final String tmp = diagram.getUniqueSequence("GN"); final Quark quark = diagram.quarkInContext(true, diagram.cleanId(tmp)); - final Entity note = diagram.createNote(quark, tmp, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("NOTE", 0))); + final Entity note = diagram.createNote(quark, tmp, Display.getWithNewlines(diagram.getPragma(), arg.get("NOTE", 0))); return executeInternal(diagram, arg, note); } }; diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java index 7424577bf90..e2cff253b29 100644 --- a/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java +++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java @@ -177,7 +177,7 @@ private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntity Entity tips = identTip.getData(); if (tips == null) { - tips = diagram.reallyCreateLeaf(identTip, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), ""), 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) diff --git a/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java b/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java index 9ef0d9cea9e..25460c62a63 100644 --- a/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java +++ b/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java @@ -80,7 +80,7 @@ protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocati if (display == null) display = quark.getName(); - return diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), GroupType.PACKAGE); + return diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), display), GroupType.PACKAGE); } } diff --git a/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java b/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java index d44a9505696..01df3b32e6c 100644 --- a/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java +++ b/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java @@ -102,7 +102,7 @@ protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocati final String queue = arg.get("QUEUE", 0); - final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("DISPLAY", 0)), queue.length(), + final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.getPragma(), arg.get("DISPLAY", 0)), queue.length(), diagram.getSkinParam().classAttributeIconSize() > 0); final Link link = new Link(diagram, diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType, linkArg); diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java b/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java index 15006c43026..67394b8787a 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodierSimple.java @@ -74,7 +74,7 @@ public void setLeaf(Entity leaf) { @Override public boolean addFieldOrMethod(String s) throws NoSuchColorException { final Display display = Display - .getWithNewlines2(skinParam.legacyReplaceBackslashNByNewline(), s); + .getWithNewlines2(skinParam.getPragma(), s); rawBody.addAll(display.asList()); return true; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhancedAbstract.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhancedAbstract.java index 4b40dac6b29..c37f9263b8e 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhancedAbstract.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhancedAbstract.java @@ -93,7 +93,7 @@ final protected TextBlock getTitle(String s, ISkinSimple spriteContainer) { return null; s = StringUtils.trin(s.substring(2, s.length() - 2)); - return Display.getWithNewlines(spriteContainer.legacyReplaceBackslashNByNewline(), s).create(titleConfig, HorizontalAlignment.LEFT, spriteContainer); + return Display.getWithNewlines(spriteContainer.getPragma(), s).create(titleConfig, HorizontalAlignment.LEFT, spriteContainer); } abstract protected TextBlock getArea(StringBounder stringBounder); diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index 07fe713925a..f7a0a2cf56e 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -242,7 +242,7 @@ private TextBlock createTextBlock(CharSequence cs) { if (m.isStatic()) config = config.underline(); - TextBlock bloc = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), s).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE, + TextBlock bloc = Display.getWithNewlines(skinParam.getPragma(), s).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE, style.wrapWidth()); bloc = TextBlockUtils.fullInnerPosition(bloc, m.getDisplay(false)); return new TextBlockTracer(m, bloc); @@ -251,7 +251,7 @@ private TextBlock createTextBlock(CharSequence cs) { // if (cs instanceof EmbeddedDiagram) // return ((EmbeddedDiagram) cs).asDraw(skinParam); - return Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), cs.toString()).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE, + return Display.getWithNewlines(skinParam.getPragma(), cs.toString()).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE, style.wrapWidth()); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/TextBlockCucaJSon.java b/src/net/sourceforge/plantuml/cucadiagram/TextBlockCucaJSon.java index 620bfe4fe2f..0389f2ad95d 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/TextBlockCucaJSon.java +++ b/src/net/sourceforge/plantuml/cucadiagram/TextBlockCucaJSon.java @@ -179,7 +179,7 @@ public void drawU(UGraphic ug) { } private TextBlock getTextBlock(String key) { - final Display display = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), key); + final Display display = Display.getWithNewlines(skinParam.getPragma(), key); TextBlock result = display.create0(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam, wordWrap, CreoleMode.FULL, null, null); result = TextBlockUtils.withMargin(result, 5, 2); diff --git a/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java b/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java index ea7a2084fb0..d2f0a3ab4d8 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java +++ b/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java @@ -169,7 +169,7 @@ private TextBlock getTextBlock(String key, LineBreakStrategy wordWrap) { if (key.equals("\0")) return new Point(fontConfiguration.getColor()); - final Display display = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), key); + final Display display = Display.getWithNewlines(skinParam.getPragma(), key); TextBlock result = display.create0(fontConfiguration, HorizontalAlignment.LEFT, skinParam, wordWrap, CreoleMode.FULL, null, null); result = TextBlockUtils.withMargin(result, 5, 2); diff --git a/src/net/sourceforge/plantuml/definition/PSystemDefinition.java b/src/net/sourceforge/plantuml/definition/PSystemDefinition.java index 6712a073c70..b538e4a8d31 100644 --- a/src/net/sourceforge/plantuml/definition/PSystemDefinition.java +++ b/src/net/sourceforge/plantuml/definition/PSystemDefinition.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment; import net.sourceforge.plantuml.klimt.shape.UDrawable; import net.sourceforge.plantuml.klimt.sprite.SpriteContainerEmpty; +import net.sourceforge.plantuml.skin.Pragma; public class PSystemDefinition extends PlainDiagram implements UDrawable { // ::remove folder when __HAXE__ @@ -76,7 +77,7 @@ protected UDrawable getRootDrawable(FileFormatOption fileFormatOption) throws IO public void drawU(UGraphic ug) { final UFont font = UFont.sansSerif(14); final FontConfiguration fc = FontConfiguration.create(font, HColors.BLACK, HColors.BLACK, null); - Display.getWithNewlines(false, startLine).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()).drawU(ug); + Display.getWithNewlines(Pragma.createEmpty(), startLine).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()).drawU(ug); } public void doCommandLine(String line) { diff --git a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java index ccd2cac4b9a..2a28ddb56e6 100644 --- a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java +++ b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java @@ -119,7 +119,7 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca if (quark.getData() != null) return CommandExecutionResult.error("Object already exists : " + codeString); - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); final String urlString = arg.get("URL", 0); final String group = arg.get("GROUP", 0); Entity entity; diff --git a/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java b/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java index 2b4fd2d7a76..61747ae1471 100644 --- a/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java +++ b/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java @@ -84,7 +84,7 @@ public EntityImageRequirement(Entity entity) { if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { this.desc = tmp; } else { - final TextBlock stereo = Display.getWithNewlines(getSkinParam().legacyReplaceBackslashNByNewline(), stereotype.getLabel(getSkinParam().guillemet())).create( + final TextBlock stereo = Display.getWithNewlines(getSkinParam().getPragma(), stereotype.getLabel(getSkinParam().guillemet())).create( FontConfiguration.create(getSkinParam(), FontParam.REQUIREMENT_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, getSkinParam()); this.desc = TextBlockUtils.mergeTB(stereo, tmp, HorizontalAlignment.CENTER); diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java index 2f51bd126b0..7f64720e939 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java @@ -114,12 +114,12 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca Entity entity = (Entity) quark.getData(); if (entity == null) - entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), LeafType.DESCRIPTION, + entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), display), LeafType.DESCRIPTION, USymbols.ARCHIMATE); final String icon = StereotypePattern.removeChevronBrackets(arg.getLazzy("STEREOTYPE", 0)); - entity.setDisplay(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display)); + entity.setDisplay(Display.getWithNewlines(diagram.getPragma(), display)); if (icon != null) entity.setStereotype( diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index b80ca53f103..af60f1b1161 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -228,9 +228,9 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca Entity entity = quark.getData(); if (entity == null) - entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), type, usymbol); + entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), display), type, usymbol); - entity.setDisplay(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display)); + entity.setDisplay(Display.getWithNewlines(diagram.getPragma(), display)); if (stereotype != null) entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java index 99c83735150..942bacd156d 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java @@ -163,8 +163,8 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l if (CommandCreateElementFull.existsWithBadType3(diagram, quark, type, usymbol)) return CommandExecutionResult.error("This element (" + quark.getName() + ") is already defined"); - final Entity entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), type, usymbol); - entity.setDisplay(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display)); + final Entity entity = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), display), type, usymbol); + entity.setDisplay(Display.getWithNewlines(diagram.getPragma(), display)); if (stereotype != null) entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java index 3de8871f9c5..772c1dd4b81 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java @@ -276,7 +276,7 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca cl1 = getDummy(diagram, ent1); cl2 = getDummy(diagram, ent2); } - final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), labels.getLabelLink()), queue.length(), + final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(diagram.getPragma(), labels.getLabelLink()), queue.length(), diagram.getSkinParam().classAttributeIconSize() > 0); Link link = new Link(diagram, diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType, linkArg.withQuantifier(labels.getFirstLabel(), labels.getSecondLabel()) @@ -307,7 +307,7 @@ private Entity getDummy(DescriptionDiagram diagram, String ident) { final Quark quark = diagram.quarkInContext(true, ident); if (quark.getData() != null) return quark.getData(); - return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()), LeafType.DESCRIPTION, + return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), quark.getName()), LeafType.DESCRIPTION, USymbols.INTERFACE); } @@ -320,7 +320,7 @@ private Entity getDummy(DescriptionDiagram diagram, String ident) { return quark.getData(); if (quark.getData() != null) return quark.getData(); - final Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()); + final Display display = Display.getWithNewlines(diagram.getPragma(), quark.getName()); if (codeChar == '(') { if (endWithSlash) diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java index 1378e68c766..5bb0b22eca0 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java @@ -154,7 +154,7 @@ else if (displayArg == null) final USymbol usymbol = USymbols.fromString(symbol, diagram.getSkinParam().actorStyle(), diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()); - final CommandExecutionResult status = diagram.gotoGroup(ident, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), + final CommandExecutionResult status = diagram.gotoGroup(ident, Display.getWithNewlines(diagram.getPragma(), display), GroupType.PACKAGE, usymbol); if (status.isOk() == false) return status; diff --git a/src/net/sourceforge/plantuml/descdiagram/command/Labels.java b/src/net/sourceforge/plantuml/descdiagram/command/Labels.java index 923d6acd8ee..84ce89e989e 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/Labels.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/Labels.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.regex.MyPattern; import net.sourceforge.plantuml.regex.Pattern2; import net.sourceforge.plantuml.regex.RegexResult; +import net.sourceforge.plantuml.skin.Pragma; public class Labels { @@ -107,8 +108,8 @@ public final LinkArrow getLinkArrow() { return stringWithArrow.getLinkArrow(); } - public Display getDisplay(boolean flag) { - return stringWithArrow.getDisplay(flag); + public Display getDisplay(Pragma pragma) { + return stringWithArrow.getDisplay(pragma); } } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java b/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java index f7b420b4e25..20586db3584 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.klimt.shape.TextBlock; import net.sourceforge.plantuml.klimt.shape.TextBlockArrow2; import net.sourceforge.plantuml.klimt.shape.TextBlockUtils; +import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.style.ISkinParam; import net.sourceforge.plantuml.svek.GuideLine; @@ -97,8 +98,8 @@ public final LinkArrow getLinkArrow() { return linkArrow; } - public final Display getDisplay(boolean flag) { - return Display.getWithNewlines(flag, label); + public final Display getDisplay(Pragma pragma) { + return Display.getWithNewlines(pragma, label); } static public TextBlock addMagicArrow(TextBlock label, GuideLine guide, FontConfiguration font) { @@ -116,7 +117,7 @@ public static TextBlock addSeveralMagicArrows(Display label, GuideLine guide, Fo TextBlock result = TextBlockUtils.EMPTY_TEXT_BLOCK; for (CharSequence cs : label) { StringWithArrow tmp = new StringWithArrow(cs.toString()); - TextBlock block = tmp.getDisplay(skinParam.legacyReplaceBackslashNByNewline()).create9(font, alignment, skinParam, skinParam.maxMessageSize()); + TextBlock block = tmp.getDisplay(skinParam.getPragma()).create9(font, alignment, skinParam, skinParam.maxMessageSize()); if (tmp.getLinkArrow() != LinkArrow.NONE_OR_SEVERAL) block = StringWithArrow.addMagicArrow2(block, tmp.getLinkArrow().mute(guide), font); diff --git a/src/net/sourceforge/plantuml/dot/CucaDiagramTxtMaker.java b/src/net/sourceforge/plantuml/dot/CucaDiagramTxtMaker.java index a8440f524a2..d480baf7570 100644 --- a/src/net/sourceforge/plantuml/dot/CucaDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/dot/CucaDiagramTxtMaker.java @@ -66,6 +66,7 @@ import net.sourceforge.plantuml.posimo.Path; import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SecurityUtils; +import net.sourceforge.plantuml.skin.Pragma; public final class CucaDiagramTxtMaker { // ::remove file when __CORE__ @@ -74,6 +75,7 @@ public final class CucaDiagramTxtMaker { private final FileFormat fileFormat; private final UGraphicTxt globalUg = new UGraphicTxt(); private final PortionShower portionShower; + private final Pragma pragma; private static double getXPixelPerChar() { return 5; @@ -92,6 +94,7 @@ private boolean showMember(Entity entity) { public CucaDiagramTxtMaker(CucaDiagram diagram, FileFormat fileFormat) throws IOException { this.fileFormat = fileFormat; this.portionShower = diagram; + this.pragma = diagram.getPragma(); final Cluster root = new Cluster(null, 0, 0); int uid = 0; @@ -211,7 +214,7 @@ private int getHeight(Entity entity) { int result = StringUtils.getHeight(entity.getDisplay()); if (showMember(entity)) { for (CharSequence att : entity.getBodier().getRawBody()) - result += StringUtils.getHeight(Display.getWithNewlines(false, att.toString())); + result += StringUtils.getHeight(Display.getWithNewlines(pragma, att.toString())); // for (Member att : entity.getBodier().getMethodsToDisplay()) { // result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true))); @@ -229,7 +232,7 @@ private int getWidth(Entity entity) { int result = StringUtils.getWcWidth(entity.getDisplay()); if (showMember(entity)) { for (CharSequence att : entity.getBodier().getRawBody()) { - final int w = StringUtils.getWcWidth(Display.getWithNewlines(false, att.toString())); + final int w = StringUtils.getWcWidth(Display.getWithNewlines(pragma, att.toString())); if (w > result) result = w; diff --git a/src/net/sourceforge/plantuml/ebnf/CommandComment.java b/src/net/sourceforge/plantuml/ebnf/CommandComment.java index 366f2460987..572e59800c9 100644 --- a/src/net/sourceforge/plantuml/ebnf/CommandComment.java +++ b/src/net/sourceforge/plantuml/ebnf/CommandComment.java @@ -64,7 +64,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(PSystemEbnf diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - final Display note = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("COMMENT", 0)); + final Display note = Display.getWithNewlines(diagram.getPragma(), arg.get("COMMENT", 0)); return diagram.addNote(note, null); } diff --git a/src/net/sourceforge/plantuml/ebnf/ETileBox.java b/src/net/sourceforge/plantuml/ebnf/ETileBox.java index ee870fdd7e6..b51230b0064 100644 --- a/src/net/sourceforge/plantuml/ebnf/ETileBox.java +++ b/src/net/sourceforge/plantuml/ebnf/ETileBox.java @@ -195,7 +195,7 @@ private TextBlock getNoteAbove(StringBounder stringBounder) { if (commentAbove == null) return TextBlockUtils.EMPTY_TEXT_BLOCK; - final FloatingNote note = FloatingNote.createOpale(Display.getWithNewlines(false, commentAbove), skinParam, + final FloatingNote note = FloatingNote.createOpale(Display.getWithNewlines(skinParam.getPragma(), commentAbove), skinParam, SName.ebnf); final XDimension2D dim = note.calculateDimension(stringBounder); final double pos = dim.getWidth() * .5; @@ -209,7 +209,7 @@ private TextBlock getNoteBelow(StringBounder stringBounder) { if (commentBelow == null) return TextBlockUtils.EMPTY_TEXT_BLOCK; - final FloatingNote note = FloatingNote.createOpale(Display.getWithNewlines(false, commentBelow), skinParam, + final FloatingNote note = FloatingNote.createOpale(Display.getWithNewlines(skinParam.getPragma(), commentBelow), skinParam, SName.ebnf); final XDimension2D dim = note.calculateDimension(stringBounder); final double pos = dim.getWidth() * .5; diff --git a/src/net/sourceforge/plantuml/ebnf/ETileOptional.java b/src/net/sourceforge/plantuml/ebnf/ETileOptional.java index 6ab8b3f3a41..bc2f95297a3 100644 --- a/src/net/sourceforge/plantuml/ebnf/ETileOptional.java +++ b/src/net/sourceforge/plantuml/ebnf/ETileOptional.java @@ -151,14 +151,14 @@ protected void addCommentBelow(String comment) { private TextBlock getNoteAbove(StringBounder stringBounder) { if (commentAbove == null) return TextBlockUtils.EMPTY_TEXT_BLOCK; - final FloatingNote note = FloatingNote.create(Display.getWithNewlines(false, commentAbove), skinParam, SName.ebnf); + final FloatingNote note = FloatingNote.create(Display.getWithNewlines(skinParam.getPragma(), commentAbove), skinParam, SName.ebnf); return TextBlockUtils.withMargin(note, 0, 0, 0, 10); } private TextBlock getNoteBelow(StringBounder stringBounder) { if (commentBelow == null) return TextBlockUtils.EMPTY_TEXT_BLOCK; - final FloatingNote note = FloatingNote.create(Display.getWithNewlines(false, commentBelow), skinParam, SName.ebnf); + final FloatingNote note = FloatingNote.create(Display.getWithNewlines(skinParam.getPragma(), commentBelow), skinParam, SName.ebnf); return TextBlockUtils.withMargin(note, 0, 0, 10, 0); } diff --git a/src/net/sourceforge/plantuml/ebnf/EbnfExpression.java b/src/net/sourceforge/plantuml/ebnf/EbnfExpression.java index 8732419ed12..432f0ae4fce 100644 --- a/src/net/sourceforge/plantuml/ebnf/EbnfExpression.java +++ b/src/net/sourceforge/plantuml/ebnf/EbnfExpression.java @@ -172,14 +172,14 @@ public TextBlock getUDrawable(ISkinParam skinParam) { private TextBlock getNoteAbove(ISkinParam skinParam) { if (commentAbove == null) return null; - final FloatingNote note = FloatingNote.create(Display.getWithNewlines(false, commentAbove), skinParam, SName.ebnf); + final FloatingNote note = FloatingNote.create(Display.getWithNewlines(skinParam.getPragma(), commentAbove), skinParam, SName.ebnf); return note; } private TextBlock getNoteBelow(ISkinParam skinParam) { if (commentBelow == null) return null; - final FloatingNote note = FloatingNote.create(Display.getWithNewlines(false, commentBelow), skinParam, SName.ebnf); + final FloatingNote note = FloatingNote.create(Display.getWithNewlines(skinParam.getPragma(), commentBelow), skinParam, SName.ebnf); return note; } diff --git a/src/net/sourceforge/plantuml/eggs/PSystemColors.java b/src/net/sourceforge/plantuml/eggs/PSystemColors.java index 7cde486785e..0d43036f283 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemColors.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemColors.java @@ -66,6 +66,7 @@ import net.sourceforge.plantuml.klimt.shape.UPolygon; import net.sourceforge.plantuml.klimt.shape.URectangle; import net.sourceforge.plantuml.klimt.sprite.SpriteContainerEmpty; +import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.text.BackSlash; // http://www.redblobgames.com/grids/hexagons/ @@ -262,7 +263,7 @@ private void drawFull(UGraphic ug) { private TextBlock getTextName(final UFont font, String name, final HColor color) { final HColor opposite = color.opposite(); final FontConfiguration fc = FontConfiguration.create(font, opposite, HColors.BLUE, UStroke.simple()); - final TextBlock tt = Display.getWithNewlines(false, name).create(fc, HorizontalAlignment.CENTER, + final TextBlock tt = Display.getWithNewlines(Pragma.createEmpty(), name).create(fc, HorizontalAlignment.CENTER, new SpriteContainerEmpty()); return tt; } diff --git a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java index 4dfcbc7f370..485fdb15694 100644 --- a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java +++ b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java @@ -260,7 +260,7 @@ private TextBlock getQuantifier(StringBounder stringBounder, Link link, int n) { final ISkinParam skinParam = diagram.getSkinParam(); final FontConfiguration labelFont = FontConfiguration.create(skinParam, FontParam.ARROW, null); - final TextBlock label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), tmp).create(labelFont, + final TextBlock label = Display.getWithNewlines(diagram.getPragma(), tmp).create(labelFont, skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam); if (TextBlockUtils.isEmpty(label, stringBounder)) return null; diff --git a/src/net/sourceforge/plantuml/elk/MyElkDrawing.java b/src/net/sourceforge/plantuml/elk/MyElkDrawing.java index 8e06d645de0..9edca0ed2cf 100644 --- a/src/net/sourceforge/plantuml/elk/MyElkDrawing.java +++ b/src/net/sourceforge/plantuml/elk/MyElkDrawing.java @@ -300,7 +300,7 @@ private TextBlock getQuantifier(StringBounder stringBounder, Link link, int n) { final ISkinParam skinParam = diagram.getSkinParam(); final FontConfiguration labelFont = FontConfiguration.create(skinParam, FontParam.ARROW, null); - final TextBlock label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), tmp).create(labelFont, + final TextBlock label = Display.getWithNewlines(diagram.getPragma(), tmp).create(labelFont, skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam); if (TextBlockUtils.isEmpty(label, stringBounder)) return null; diff --git a/src/net/sourceforge/plantuml/filesdiagram/FEntry.java b/src/net/sourceforge/plantuml/filesdiagram/FEntry.java index 731e9ecb374..7ea2fe0a6c7 100644 --- a/src/net/sourceforge/plantuml/filesdiagram/FEntry.java +++ b/src/net/sourceforge/plantuml/filesdiagram/FEntry.java @@ -139,7 +139,7 @@ private TextBlock getTextBlock(FontConfiguration fontConfiguration, ISkinParam s if (type == FilesType.NOTE) return createOpale(skinParam); - final Display display = Display.getWithNewlines(false, getEmoticon() + getName()); + final Display display = Display.getWithNewlines(skinParam.getPragma(), getEmoticon() + getName()); TextBlock result = display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam, CreoleMode.NO_CREOLE); return result; diff --git a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java index e2a58cf39ce..27fd9cad461 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java +++ b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java @@ -130,7 +130,7 @@ private void drawInternal(UGraphic ug) { ug = new UGraphicHandwritten(ug); if (root == null) { final Display display = Display - .getWithNewlines(false, "Your data does not sound like " + getUmlDiagramType() + " data"); + .getWithNewlines(getSkinParam().getPragma(), "Your data does not sound like " + getUmlDiagramType() + " data"); final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(UFont.courier(14)); TextBlock result = display.create(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam()); result = TextBlockUtils.withMargin(result, 5, 2); diff --git a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java index 27af719f380..119adc6004b 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java +++ b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java @@ -101,7 +101,7 @@ public Diagram createSystem(UmlSource source, Map skinMap) { } final String title = styleExtractor.getTitle(); if (title != null) - result.setTitle(DisplayPositioned.single(Display.getWithNewlines(result.legacyReplaceBackslashNByNewline(), title), HorizontalAlignment.CENTER, + result.setTitle(DisplayPositioned.single(Display.getWithNewlines(result.getPragma(), title), HorizontalAlignment.CENTER, VerticalAlignment.CENTER)); } return result; diff --git a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java index 0232b05ad53..b028ce45329 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java +++ b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java @@ -339,7 +339,7 @@ public double[] getAllHeights(StringBounder stringBounder) { } private TextBlock getTextBlock(Style style, String key) { - final Display display = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), key); + final Display display = Display.getWithNewlines(skinParam.getPragma(), key); final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getIHtmlColorSet()); final LineBreakStrategy wrap = style.wrapWidth(); final HorizontalAlignment horizontalAlignment = style.getHorizontalAlignment(); diff --git a/src/net/sourceforge/plantuml/klimt/creole/CreoleHorizontalLine.java b/src/net/sourceforge/plantuml/klimt/creole/CreoleHorizontalLine.java index df53287133b..e965b0e9365 100644 --- a/src/net/sourceforge/plantuml/klimt/creole/CreoleHorizontalLine.java +++ b/src/net/sourceforge/plantuml/klimt/creole/CreoleHorizontalLine.java @@ -83,7 +83,7 @@ private TextBlock getTitle() { return TextBlockUtils.empty(0, 0); final SheetBuilder parser = skinParam.sheet(fontConfiguration, HorizontalAlignment.LEFT, CreoleMode.FULL); - final Sheet sheet = parser.createSheet(Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), line)); + final Sheet sheet = parser.createSheet(Display.getWithNewlines(skinParam.getPragma(), line)); final TextBlock tb = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); return tb; } diff --git a/src/net/sourceforge/plantuml/klimt/creole/Display.java b/src/net/sourceforge/plantuml/klimt/creole/Display.java index 3bceb83af06..ddcc0bc14b3 100644 --- a/src/net/sourceforge/plantuml/klimt/creole/Display.java +++ b/src/net/sourceforge/plantuml/klimt/creole/Display.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.abel.Entity; import net.sourceforge.plantuml.jaws.Jaws; -import net.sourceforge.plantuml.jaws.JawsFlags; import net.sourceforge.plantuml.jaws.JawsStrange; import net.sourceforge.plantuml.klimt.LineBreakStrategy; import net.sourceforge.plantuml.klimt.UStroke; @@ -68,6 +67,7 @@ import net.sourceforge.plantuml.regex.MyPattern; import net.sourceforge.plantuml.regex.Pattern2; import net.sourceforge.plantuml.sequencediagram.MessageNumber; +import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.stereo.Stereotype; import net.sourceforge.plantuml.style.ISkinSimple; @@ -202,11 +202,11 @@ public static Display create(Collection other) { } public static Display getWithNewlines(Quark s) { - return getWithNewlines(false, s.getName()); + return getWithNewlines(Pragma.createEmpty(), s.getName()); } - public static Display getWithNewlines2(boolean legacyReplaceBackslashNByNewline, String s) throws NoSuchColorException { - final Display result = getWithNewlines(legacyReplaceBackslashNByNewline, s); + public static Display getWithNewlines2(Pragma pragma, String s) throws NoSuchColorException { + final Display result = getWithNewlines(pragma, s); CreoleParser.checkColor(result); return result; } @@ -238,7 +238,7 @@ public static List getWithNewlines3(CharSequence s) { return Collections.unmodifiableList(result); } - public static Display getWithNewlines(boolean legacyReplaceBackslashNByNewline, String s) { + public static Display getWithNewlines(Pragma pragma, String s) { if (s == null) return NULL; @@ -264,7 +264,8 @@ else if (sub.startsWith("") || sub.startsWith("") || sub.startsWi current.setLength(0); i += 3; // throw new IllegalStateException(); - } else if (/*legacyReplaceBackslashNByNewline &&*/ rawMode == false && c == '\\' && i < s.length() - 1) { + } else if (pragma.legacyReplaceBackslashNByNewline() && rawMode == false && c == '\\' + && i < s.length() - 1) { final char c2 = s.charAt(i + 1); i++; if (c2 == 'n' || c2 == 'r' || c2 == 'l') { @@ -283,6 +284,7 @@ else if (c2 == 'l') current.append(c); current.append(c2); } + pragma.addBackslashNWarning(); } else if (c == Jaws.BLOCK_E1_REAL_BACKSLASH) { current.append('\\'); } else if (c == Jaws.BLOCK_E1_NEWLINE) { diff --git a/src/net/sourceforge/plantuml/klimt/creole/legacy/AtomTextUtils.java b/src/net/sourceforge/plantuml/klimt/creole/legacy/AtomTextUtils.java index 2777f430b46..91e950efb96 100644 --- a/src/net/sourceforge/plantuml/klimt/creole/legacy/AtomTextUtils.java +++ b/src/net/sourceforge/plantuml/klimt/creole/legacy/AtomTextUtils.java @@ -77,7 +77,7 @@ public static Atom create(String text, FontConfiguration fontConfiguration) { public static Atom createUrl(Url url, FontConfiguration fontConfiguration, ISkinSimple skinSimple) { fontConfiguration = fontConfiguration.hyperlink(); - final Display display = Display.getWithNewlines(skinSimple.legacyReplaceBackslashNByNewline(), url.getLabel()); + final Display display = Display.getWithNewlines(skinSimple.getPragma(), url.getLabel()); if (display.size() > 1) { final List all = new ArrayList<>(); for (CharSequence s : display.asList()) diff --git a/src/net/sourceforge/plantuml/klimt/creole/legacy/PSystemCreole.java b/src/net/sourceforge/plantuml/klimt/creole/legacy/PSystemCreole.java index 1800036e640..9b049334e69 100644 --- a/src/net/sourceforge/plantuml/klimt/creole/legacy/PSystemCreole.java +++ b/src/net/sourceforge/plantuml/klimt/creole/legacy/PSystemCreole.java @@ -77,7 +77,7 @@ protected UDrawable getRootDrawable(FileFormatOption fileFormatOption) { final Display display = Display.create(lines); final UFont font = UFont.serif(14); final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font); - final SkinParam skinParam = SkinParam.create(UmlDiagramType.SEQUENCE, new Pragma()); + final SkinParam skinParam = SkinParam.create(UmlDiagramType.SEQUENCE, Pragma.createEmpty()); final Sheet sheet = skinParam.sheet(fontConfiguration, HorizontalAlignment.LEFT, CreoleMode.FULL) .createSheet(display); return new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); diff --git a/src/net/sourceforge/plantuml/klimt/sprite/SpriteContainerEmpty.java b/src/net/sourceforge/plantuml/klimt/sprite/SpriteContainerEmpty.java index 36040449d5d..58dfae836d6 100644 --- a/src/net/sourceforge/plantuml/klimt/sprite/SpriteContainerEmpty.java +++ b/src/net/sourceforge/plantuml/klimt/sprite/SpriteContainerEmpty.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.klimt.creole.legacy.CreoleParser; import net.sourceforge.plantuml.klimt.font.FontConfiguration; import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment; +import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.style.ISkinSimple; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.text.Guillemet; @@ -122,8 +123,8 @@ public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignme } @Override - public boolean legacyReplaceBackslashNByNewline() { - return false; + public Pragma getPragma() { + return Pragma.createEmpty(); } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java index d988eb86680..33fc6f14ef7 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java @@ -73,7 +73,7 @@ protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation if (stringColor != null) backColor = diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor); - return diagram.addIdea(backColor, diagram.getSmartLevel(type), Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), label), + return diagram.addIdea(backColor, diagram.getSmartLevel(type), Display.getWithNewlines(diagram.getPragma(), label), IdeaShape.fromDesc(arg.get("SHAPE", 0))); } } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java index 3832998d824..219f82cff0a 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java @@ -74,7 +74,7 @@ protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation backColor = diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor); } final boolean direction = type.contains("-") ? false : true; - return diagram.addIdea(backColor, type.length() - 1, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), label), + return diagram.addIdea(backColor, type.length() - 1, Display.getWithNewlines(diagram.getPragma(), label), IdeaShape.fromDesc(arg.get("SHAPE", 0)), direction); } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java index ec73f020298..99ec31d266c 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java @@ -61,7 +61,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, 0, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), label), IdeaShape.BOX, true); + return diagram.addIdea(null, 0, Display.getWithNewlines(diagram.getPragma(), label), IdeaShape.BOX, true); } } diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java index 0cc930e4233..84a3e87f95e 100644 --- a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java +++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java @@ -359,7 +359,7 @@ private TextBlock toTextBlockForNetworkName(String name, String s) { final StyleBuilder styleBuilder = getSkinParam().getCurrentStyleBuilder(); final Style style = getStyleDefinitionNetwork(SName.network).getMergedStyle(styleBuilder); final FontConfiguration fontConfiguration = style.getFontConfiguration(getSkinParam().getIHtmlColorSet()); - return Display.getWithNewlines(legacyReplaceBackslashNByNewline(), name).create(fontConfiguration, HorizontalAlignment.RIGHT, + return Display.getWithNewlines(getPragma(), name).create(fontConfiguration, HorizontalAlignment.RIGHT, new SpriteContainerEmpty()); } diff --git a/src/net/sourceforge/plantuml/nwdiag/core/NServer.java b/src/net/sourceforge/plantuml/nwdiag/core/NServer.java index bf7a2115fc9..9b86dfae509 100644 --- a/src/net/sourceforge/plantuml/nwdiag/core/NServer.java +++ b/src/net/sourceforge/plantuml/nwdiag/core/NServer.java @@ -145,7 +145,7 @@ public TextBlock toTextBlock(SName sname, String s) { return TextBlockUtils.empty(0, 0); s = s.replace(", ", "\\n"); - return Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), s).create(getFontConfiguration(sname), HorizontalAlignment.LEFT, skinParam); + return Display.getWithNewlines(skinParam.getPragma(), s).create(getFontConfiguration(sname), HorizontalAlignment.LEFT, skinParam); } private StyleSignatureBasic getStyleDefinition(SName sname) { diff --git a/src/net/sourceforge/plantuml/nwdiag/core/NwGroup.java b/src/net/sourceforge/plantuml/nwdiag/core/NwGroup.java index 72b8252fc1e..f4a65c2afd3 100644 --- a/src/net/sourceforge/plantuml/nwdiag/core/NwGroup.java +++ b/src/net/sourceforge/plantuml/nwdiag/core/NwGroup.java @@ -168,7 +168,7 @@ private TextBlock buildHeaderName(ISkinParam skinParam) { final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder(); final Style style = getStyleDefinition().getMergedStyle(styleBuilder); - return Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), getDescription()) + return Display.getWithNewlines(skinParam.getPragma(), getDescription()) .create(style.getFontConfiguration(skinParam.getIHtmlColorSet()), HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java b/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java index caac11e69cf..f58106da762 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java +++ b/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java @@ -118,10 +118,10 @@ public CommandExecutionResult associationClass(Entity entity1A, Entity entity1B, final String tmp2 = this.getUniqueSequence("apoint"); final Quark code1 = getCurrentGroup().getQuark().child(tmp1); - final Entity point1 = reallyCreateLeaf(code1, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.POINT_FOR_ASSOCIATION, + final Entity point1 = reallyCreateLeaf(code1, Display.getWithNewlines(getPragma(), ""), LeafType.POINT_FOR_ASSOCIATION, null); final Quark code2 = getCurrentGroup().getQuark().child(tmp2); - final Entity point2 = reallyCreateLeaf(code2, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.POINT_FOR_ASSOCIATION, + final Entity point2 = reallyCreateLeaf(code2, Display.getWithNewlines(getPragma(), ""), LeafType.POINT_FOR_ASSOCIATION, null); insertPointBetween(entity1A, entity1B, point1); @@ -222,7 +222,7 @@ public Association(int mode, Entity entity1, Entity entity2, Entity associed) { quark = entity1.getQuark().getParent().child(idShort); else quark = quarkInContext(true, cleanId(idShort)); - point = reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.POINT_FOR_ASSOCIATION, null); + point = reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.POINT_FOR_ASSOCIATION, null); } diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java index 2459d41e669..52f0dc4d860 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java @@ -89,9 +89,9 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram if (quark.getData() != null) return CommandExecutionResult.error("Object already exists : " + quark.getData()); - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null); if (stereotype != null) diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java index 47c5c93825c..d38ec1aac2f 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java @@ -114,9 +114,9 @@ private Entity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult lin final String displayString = line0.getLazzy("DISPLAY", 0); final String stereotype = line0.get("STEREO", 0); - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); Entity entity = quark.getData(); if (entity == null) entity = diagram.reallyCreateLeaf(quark, display, LeafType.OBJECT, null); diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJson.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJson.java index 7af3757c1ea..a1f53748cfa 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJson.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJson.java @@ -161,9 +161,9 @@ private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) thr final String displayString = line0.getLazzy("DISPLAY", 0); final String stereotype = line0.get("STEREO", 0); - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), quark.getName()).withCreoleMode(CreoleMode.SIMPLE_LINE); final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.JSON, null); if (stereotype != null) diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJsonSingleLine.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJsonSingleLine.java index 999d553088d..96a2b4779b4 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJsonSingleLine.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateJsonSingleLine.java @@ -127,9 +127,9 @@ private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) thr final String displayString = line0.get("NAME", 0); final String stereotype = line0.get("STEREO", 0); - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), name).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), name).withCreoleMode(CreoleMode.SIMPLE_LINE); final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.JSON, null); if (stereotype != null) diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java index 607c170e024..c80395ce057 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java @@ -148,9 +148,9 @@ private Entity executeArg0(AbstractEntityDiagram diagram, RegexResult line0) thr if (quark.getData() != null) return null; - Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), displayString); + Display display = Display.getWithNewlines(diagram.getPragma(), displayString); if (Display.isNull(display)) - display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), name).withCreoleMode(CreoleMode.SIMPLE_LINE); + display = Display.getWithNewlines(diagram.getPragma(), name).withCreoleMode(CreoleMode.SIMPLE_LINE); final Entity entity = diagram.reallyCreateLeaf(quark, display, LeafType.MAP, null); if (stereotype != null) diff --git a/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java b/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java index 8aa775778ef..b39a59c2a4c 100644 --- a/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java +++ b/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.stereo.Stereotype; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.PName; @@ -194,5 +195,9 @@ protected CenterBorderColor getColors() { protected int getCompletion() { return completion; } + + protected Pragma getPragma() { + return styleBuilder.getSkinParam().getPragma(); + } } diff --git a/src/net/sourceforge/plantuml/project/draw/ResourceDrawBasic.java b/src/net/sourceforge/plantuml/project/draw/ResourceDrawBasic.java index 6abeab90173..cec6e6f9cfc 100644 --- a/src/net/sourceforge/plantuml/project/draw/ResourceDrawBasic.java +++ b/src/net/sourceforge/plantuml/project/draw/ResourceDrawBasic.java @@ -71,7 +71,7 @@ public ResourceDrawBasic(GanttDiagram gantt, Resource res, TimeScale timeScale, } public void drawU(UGraphic ug) { - final TextBlock title = Display.getWithNewlines(gantt.legacyReplaceBackslashNByNewline(), res.getName()).create(getFontConfiguration(13), + final TextBlock title = Display.getWithNewlines(gantt.getPragma(), res.getName()).create(getFontConfiguration(13), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); title.drawU(ug); final ULine line = ULine.hline(timeScale.getEndingPosition(max) - timeScale.getStartingPosition(min)); @@ -91,7 +91,7 @@ public void drawU(UGraphic ug) { if (totalLoad > 0) { final FontConfiguration fontConfiguration = getFontConfiguration(9, isRed ? HColors.RED : HColors.BLACK); - final TextBlock value = Display.getWithNewlines(false, "" + totalLoad).create(fontConfiguration, + final TextBlock value = Display.getWithNewlines(gantt.getSkinParam().getPragma(), "" + totalLoad).create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); if (startingPosition == -1) startingPosition = timeScale.getStartingPosition(i); diff --git a/src/net/sourceforge/plantuml/project/draw/ResourceDrawVersion2.java b/src/net/sourceforge/plantuml/project/draw/ResourceDrawVersion2.java index 1521a6a2d2c..585f8267a27 100644 --- a/src/net/sourceforge/plantuml/project/draw/ResourceDrawVersion2.java +++ b/src/net/sourceforge/plantuml/project/draw/ResourceDrawVersion2.java @@ -88,7 +88,7 @@ public void drawU(UGraphic ug) { } - final TextBlock title = Display.getWithNewlines(gantt.legacyReplaceBackslashNByNewline(), res.getName()).create(getFontConfiguration(13), + final TextBlock title = Display.getWithNewlines(gantt.getPragma(), res.getName()).create(getFontConfiguration(13), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); title.drawU(ug); final ULine line = ULine.hline(timeScale.getEndingPosition(max) - timeScale.getStartingPosition(min)); diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java index 3cc2e268a69..d412619371a 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java @@ -127,7 +127,7 @@ final public void drawTitle(UGraphic ug, LabelStrategy labelStrategy, double col @Override protected TextBlock getTitle() { - return Display.getWithNewlines(getStyleBuilder().getSkinParam().legacyReplaceBackslashNByNewline(), prettyDisplay).create(getFontConfiguration(), HorizontalAlignment.LEFT, + return Display.getWithNewlines(getStyleBuilder().getSkinParam().getPragma(), prettyDisplay).create(getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); } @@ -154,7 +154,7 @@ public void drawU(UGraphic ug) { ug = ug.apply(UTranslate.dx(delta / 2)); drawShape(applyColors(ug)); } else { - final TextBlock draw = Display.getWithNewlines(getStyleBuilder().getSkinParam().legacyReplaceBackslashNByNewline(), displayString).create(getFontConfiguration(), + final TextBlock draw = Display.getWithNewlines(getStyleBuilder().getSkinParam().getPragma(), displayString).create(getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); draw.drawU(ug); } diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawGroup.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawGroup.java index e3c7b93e3a0..3dd2d6d93e6 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawGroup.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawGroup.java @@ -114,7 +114,7 @@ public void drawTitle(UGraphic ug, LabelStrategy labelStrategy, double colTitles @Override protected TextBlock getTitle() { - return Display.getWithNewlines(false, prettyDisplay).create(getFontConfiguration(), HorizontalAlignment.LEFT, + return Display.getWithNewlines(getPragma(), prettyDisplay).create(getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); } diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java index 2417b4efbc8..e88ea8e4da1 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java @@ -143,7 +143,7 @@ public void drawTitle(UGraphic ug, LabelStrategy labelStrategy, double colTitles @Override protected TextBlock getTitle() { - return Display.getWithNewlines(false, prettyDisplay).create(getFontConfiguration(), HorizontalAlignment.LEFT, + return Display.getWithNewlines(getPragma(), prettyDisplay).create(getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); } diff --git a/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java b/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java index 88a109c023b..1bcb492378c 100644 --- a/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java +++ b/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java @@ -93,11 +93,11 @@ public void drawTitle(UGraphic ug, LabelStrategy labelStrategy, double colTitles final double dx = margin.getLeft() + padding.getLeft(); final double dy = margin.getTop() + padding.getTop(); final double x; - if (labelStrategy.titleInFirstColumn()) { + if (labelStrategy.titleInFirstColumn()) x = colTitles; - } else { + else x = 0; - } + getTitle().drawU(ug.apply(new UTranslate(x + dx, dy))); } @@ -116,11 +116,11 @@ private Style getStyle() { } private TextBlock getTitle() { - if (name == null) { + if (name == null) return TextBlockUtils.empty(0, 0); - } - return Display.getWithNewlines(false, this.name).create(getFontConfiguration(), HorizontalAlignment.LEFT, - new SpriteContainerEmpty()); + + return Display.getWithNewlines(styleBuilder.getSkinParam().getPragma(), this.name) + .create(getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); } private FontConfiguration getFontConfiguration() { @@ -204,7 +204,8 @@ public TaskDraw getTrueRow() { } @Override - public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note, Stereotype noteStereotype) { + public void setColorsAndCompletion(CenterBorderColor colors, int completion, Url url, Display note, + Stereotype noteStereotype) { } @Override diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java index dd5a1e1ad85..d54081e6a53 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.project.TimeHeaderParameters; import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.timescale.TimeScale; +import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; @@ -130,7 +131,7 @@ final protected FontConfiguration getFontConfiguration(UFont font, boolean bold, protected final TextBlock getTextBlock(SName param, String text, boolean bold, HColor color) { final UFont font = thParam.getStyle(SName.timeline, param).getUFont(); final FontConfiguration fontConfiguration = getFontConfiguration(font, bold, color); - return Display.getWithNewlines(false, text).create(fontConfiguration, HorizontalAlignment.LEFT, + return Display.getWithNewlines(getPragma(), text).create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); } @@ -171,5 +172,10 @@ protected void printVerticalSeparators(UGraphic ug, double totalHeightWithoutFoo drawVline(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(ug.getStringBounder()), totalHeightWithoutFooter); } + + + protected Pragma getPragma() { + return Pragma.createEmpty(); + } } diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java index e286fd586da..2e4e3f67983 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java @@ -103,7 +103,7 @@ private void drawSimpleDayCounter(UGraphic ug, TimeScale timeScale) { value = i.getAbsoluteDayNum() + 1; final UFont font = thParam.getStyle(SName.timeline, SName.day).getUFont(); final FontConfiguration fontConfiguration = getFontConfiguration(font, false, openFontColor()); - final TextBlock num = Display.getWithNewlines(false, "" + value).create(fontConfiguration, + final TextBlock num = Display.getWithNewlines(getPragma(), "" + value).create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final double x1 = timeScale.getStartingPosition(i); final double x2; diff --git a/src/net/sourceforge/plantuml/salt/SaltDictionary.java b/src/net/sourceforge/plantuml/salt/SaltDictionary.java index e0f02104262..55c28b8a4fa 100644 --- a/src/net/sourceforge/plantuml/salt/SaltDictionary.java +++ b/src/net/sourceforge/plantuml/salt/SaltDictionary.java @@ -50,6 +50,7 @@ import net.sourceforge.plantuml.klimt.sprite.SpriteContainer; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.element.WrappedElement; +import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.style.ISkinSimple; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.text.Guillemet; @@ -146,8 +147,8 @@ public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignme } @Override - public boolean legacyReplaceBackslashNByNewline() { - return false; + public Pragma getPragma() { + return Pragma.createEmpty(); } } diff --git a/src/net/sourceforge/plantuml/salt/element/AbstractElement.java b/src/net/sourceforge/plantuml/salt/element/AbstractElement.java index 2e64b63a7bf..7c373813212 100644 --- a/src/net/sourceforge/plantuml/salt/element/AbstractElement.java +++ b/src/net/sourceforge/plantuml/salt/element/AbstractElement.java @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.klimt.color.HColors; import net.sourceforge.plantuml.klimt.font.FontConfiguration; import net.sourceforge.plantuml.klimt.font.UFont; +import net.sourceforge.plantuml.skin.Pragma; public abstract class AbstractElement implements Element { @@ -80,5 +81,9 @@ private HColor buildColor(String color1, String color2) { final protected FontConfiguration blackBlueTrue(UFont font) { return FontConfiguration.blackBlueTrue(font); } + + final protected Pragma getPragma() { + return Pragma.createEmpty(); + } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java b/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java index fdfaa903576..73924ceaa1c 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java @@ -76,7 +76,7 @@ public ElementPyramid(Positionner2 positionner, TableStrategy tableStrategy, Str if (title != null) { final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(UFont.byDefault(10)); - this.title = Display.getWithNewlines(false, title).create(fontConfiguration, HorizontalAlignment.LEFT, + this.title = Display.getWithNewlines(getPragma(), title).create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); } else { this.title = TextBlockUtils.empty(0, 0); diff --git a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java index 09593c49242..0d28abafc43 100644 --- a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java +++ b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java @@ -634,7 +634,7 @@ private TextBlock getQuantifier(StringBounder stringBounder, Link link, int n) { ISkinParam skinParam = diagram.getSkinParam(); final Style style = getStyle(); final FontConfiguration labelFont = style.getFontConfiguration(skinParam.getIHtmlColorSet()); - final TextBlock label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), tmp).create(labelFont, + final TextBlock label = Display.getWithNewlines(diagram.getPragma(), tmp).create(labelFont, skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam); if (TextBlockUtils.isEmpty(label, stringBounder)) return label; diff --git a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java index 30c1dbc6ae0..7788ab55d32 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java +++ b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java @@ -108,7 +108,7 @@ public void drawAnchor(UGraphic ug, CommonTile tile1, CommonTile tile2, ISkinPar final Rainbow rainbow = Rainbow.fromColor(color, null); - final Display display = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), message); + final Display display = Display.getWithNewlines(skinParam.getPragma(), message); final TextBlock title = display.create(fontConfiguration, HorizontalAlignment.CENTER, skinParam); final Snake snake = Snake.create(skinParam, skinParam.arrows().asToUp(), rainbow, skinParam.arrows().asToDown()) .withLabel(title, HorizontalAlignment.CENTER); diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index 92b8ee1e374..3aaf216b122 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -101,7 +101,7 @@ public SequenceDiagram(UmlSource source, Map skinMap) { @Deprecated public Participant getOrCreateParticipant(String code) { - return getOrCreateParticipant(code, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), code)); + return getOrCreateParticipant(code, Display.getWithNewlines(getPragma(), code)); } public Participant getOrCreateParticipant(String code, Display display) { @@ -145,7 +145,7 @@ public Participant createNewParticipant(ParticipantType type, String code, Displ if (Display.isNull(display)) { // display = Arrays.asList(code); - display = Display.getWithNewlines(legacyReplaceBackslashNByNewline(), code); + display = Display.getWithNewlines(getPragma(), code); } final Participant result = new Participant(type, code, display, hiddenPortions, order, getSkinParam().getCurrentStyleBuilder()); diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java index fdcd0a9df9a..b9557fb1b42 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java @@ -156,16 +156,16 @@ private Participant getOrCreateParticipant(SequenceDiagram system, RegexResult a final Display display; if (arg2.get(n + "CODE", 0) != null) { code = arg2.get(n + "CODE", 0); - display = Display.getWithNewlines(system.legacyReplaceBackslashNByNewline(), code); + display = Display.getWithNewlines(system.getPragma(), code); } else if (arg2.get(n + "LONG", 0) != null) { code = arg2.get(n + "LONG", 0); - display = Display.getWithNewlines(system.legacyReplaceBackslashNByNewline(), code); + display = Display.getWithNewlines(system.getPragma(), code); } else if (arg2.get(n + "LONGCODE", 0) != null) { - display = Display.getWithNewlines(system.legacyReplaceBackslashNByNewline(), arg2.get(n + "LONGCODE", 0)); + display = Display.getWithNewlines(system.getPragma(), arg2.get(n + "LONGCODE", 0)); code = arg2.get(n + "LONGCODE", 1); } else if (arg2.get(n + "CODELONG", 0) != null) { code = arg2.get(n + "CODELONG", 0); - display = Display.getWithNewlines(system.legacyReplaceBackslashNByNewline(), arg2.get(n + "CODELONG", 1)); + display = Display.getWithNewlines(system.getPragma(), arg2.get(n + "CODELONG", 1)); return system.getOrCreateParticipant(code, display); } else { throw new IllegalStateException(); @@ -257,7 +257,7 @@ else if (xInDressing1 || xInDressing2) } else { // final String message = UrlBuilder.multilineTooltip(arg.get("MESSAGE", 0)); final String message = arg.get("MESSAGE", 0); - labels = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), message); + labels = Display.getWithNewlines(diagram.getPragma(), message); } ArrowConfiguration config = hasDressing1butx && hasDressing2butx ? ArrowConfiguration.withDirectionBoth() diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java index ffbc1b5661d..2ecc5b45c7d 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java @@ -98,7 +98,7 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); final String title = argTitle == null ? "" : argTitle; - diagram.boxStart(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), title), colors.getColor(ColorType.BACK), stereotype); + diagram.boxStart(Display.getWithNewlines(diagram.getPragma(), title), colors.getColor(ColorType.BACK), stereotype); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java index 4c6a24bd624..741a6985742 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java @@ -62,7 +62,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { final Display strings = arg.get("LABEL", 0) == null ? Display.empty() - : Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + : Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); diagram.delay(strings); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java index 3acc705a44d..bcd5d514686 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java @@ -63,7 +63,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { - final Display strings = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display strings = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); diagram.divider(strings); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java index b7025fb0f20..d7c702e9bdb 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java @@ -83,7 +83,7 @@ final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineL if (arg.get("LABEL", 0) == null) labels = Display.create(""); else - labels = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + labels = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); final boolean bothDirection = arg.get("ARROW_BOTHDRESSING", 0) != null; diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java index 81afd1d13e3..9d7ea0092ec 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java @@ -68,7 +68,7 @@ static IRegex getRegexConcat() { protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg, ParserPass currentPass) { final String label = arg.get("LABEL", 0); - final Display strings = label == null ? Display.NULL : Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), label); + final Display strings = label == null ? Display.NULL : Display.getWithNewlines(diagram.getPragma(), label); diagram.newpage(strings); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java index 18e0304db5f..d99ffedf7d8 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java @@ -94,7 +94,7 @@ final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineL Display strings = Display.NULL; if (arg.get("FULL", 0) != null) - strings = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("FULL", 0)); + strings = Display.getWithNewlines(diagram.getPragma(), arg.get("FULL", 0)); final String typeString1 = arg.get("TYPE", 0); final String typeCreate1 = arg.get("CREATE", 0); diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java index bcc76edba88..d56470758c5 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java @@ -96,7 +96,7 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio for (String s : participants) p.add(diagram.getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s))); - final Display strings = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), text); + final Display strings = Display.getWithNewlines(diagram.getPragma(), text); final UrlBuilder b = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); Url u = null; diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java index d6c84dc5879..76b40c7b23a 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java @@ -96,7 +96,7 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio if (color != null) arrow = arrow.withColor(HColorSet.instance().getColor(color)); - final Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("MESSAGE", 0)); + final Display display = Display.getWithNewlines(diagram.getPragma(), arg.get("MESSAGE", 0)); final AbstractMessage message2; if (message1 instanceof MessageExo) { final MessageExo exo1 = (MessageExo) message1; diff --git a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index 088c0e8a755..3cbd905723b 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -69,7 +69,7 @@ public abstract class AbstractTextualComponent extends AbstractComponent { public AbstractTextualComponent(Style style, LineBreakStrategy maxMessageSize, int marginX1, int marginX2, int marginY, ISkinSimple spriteContainer, CharSequence label) { this(style, style, maxMessageSize, marginX1, marginX2, marginY, spriteContainer, - Display.getWithNewlines(spriteContainer.legacyReplaceBackslashNByNewline(), label == null ? "" : label.toString()), false); + Display.getWithNewlines(spriteContainer.getPragma(), label == null ? "" : label.toString()), false); } public AbstractTextualComponent(Style style, LineBreakStrategy maxMessageSize, int marginX1, int marginX2, diff --git a/src/net/sourceforge/plantuml/skin/Pragma.java b/src/net/sourceforge/plantuml/skin/Pragma.java index a16dbefeb7e..522024ed2c5 100644 --- a/src/net/sourceforge/plantuml/skin/Pragma.java +++ b/src/net/sourceforge/plantuml/skin/Pragma.java @@ -41,6 +41,14 @@ public class Pragma { private final Map values = new LinkedHashMap(); + private boolean backslashNWarning; + + private Pragma() { + } + + public static Pragma createEmpty() { + return new Pragma(); + } public void define(String name, String value) { values.put(name, value); @@ -94,4 +102,16 @@ public boolean useIntermediatePackages() { return !isFalse(getValue("useintermediatepackages")); } + public boolean legacyReplaceBackslashNByNewline() { + return true; + } + + public void addBackslashNWarning() { + // this.backslashNWarning = true; + } + + public boolean isBackslashNWarning() { + return backslashNWarning; + } + } diff --git a/src/net/sourceforge/plantuml/skin/SkinParam.java b/src/net/sourceforge/plantuml/skin/SkinParam.java index 4ef6e667eb7..0683e897626 100644 --- a/src/net/sourceforge/plantuml/skin/SkinParam.java +++ b/src/net/sourceforge/plantuml/skin/SkinParam.java @@ -112,10 +112,6 @@ private SkinParam(UmlDiagramType type, Pragma pragma) { this.pragma = pragma; } - public final Pragma getPragma() { - return pragma; - } - @Override public StyleBuilder getCurrentStyleBuilder() { if (styleBuilder == null) @@ -1235,8 +1231,8 @@ public Arrows arrows() { } @Override - public boolean legacyReplaceBackslashNByNewline() { - return true; + public final Pragma getPragma() { + return pragma; } } diff --git a/src/net/sourceforge/plantuml/skin/SkinParamDelegator.java b/src/net/sourceforge/plantuml/skin/SkinParamDelegator.java index 42cd58e618b..d491b4d8616 100644 --- a/src/net/sourceforge/plantuml/skin/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/skin/SkinParamDelegator.java @@ -462,8 +462,8 @@ public Arrows arrows() { } @Override - public boolean legacyReplaceBackslashNByNewline() { - return skinParam.legacyReplaceBackslashNByNewline(); + public Pragma getPragma() { + return skinParam.getPragma(); } } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java index 10c394a35b9..58ed9aade61 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java @@ -84,7 +84,7 @@ public ComponentRoseGroupingHeader(boolean teoz, Style style, Style styleHeader, if (strings.size() == 1 || strings.get(1) == null) { this.commentTextBlock = null; } else { - final Display display = Display.getWithNewlines(spriteContainer.legacyReplaceBackslashNByNewline(), "[" + strings.get(1) + "]"); + final Display display = Display.getWithNewlines(spriteContainer.getPragma(), "[" + strings.get(1) + "]"); this.commentTextBlock = display.create(smallFont2, HorizontalAlignment.LEFT, spriteContainer); } Objects.requireNonNull(this.background); diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java index b4f7acf26a6..874293a8471 100644 --- a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java +++ b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java @@ -93,13 +93,13 @@ public Entity getStart() { final String idShort = "*start*"; final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.CIRCLE_START, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.CIRCLE_START, null); return quark.getData(); } final String idShort = "*start*" + g.getName(); final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.CIRCLE_START, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.CIRCLE_START, null); return quark.getData(); } @@ -109,13 +109,13 @@ public Entity getEnd() { final String idShort = "*end*"; final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.CIRCLE_END, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.CIRCLE_END, null); return quark.getData(); } final String idShort = "*end*" + p.getName(); final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.CIRCLE_END, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.CIRCLE_END, null); return quark.getData(); } @@ -125,13 +125,13 @@ public Entity getHistorical() { final String idShort = "*historical*"; final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.PSEUDO_STATE, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.PSEUDO_STATE, null); return quark.getData(); } final String idShort = "*historical*" + g.getName(); final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.PSEUDO_STATE, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.PSEUDO_STATE, null); return quark.getData(); } @@ -143,7 +143,7 @@ public Entity getHistorical(String idShort) { final Quark ident = quarkInContext(true, tmp); final Entity result; if (ident.getData() == null) - result = reallyCreateLeaf(ident, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.PSEUDO_STATE, null); + result = reallyCreateLeaf(ident, Display.getWithNewlines(getPragma(), ""), LeafType.PSEUDO_STATE, null); else result = ident.getData(); endGroup(); @@ -156,14 +156,14 @@ public Entity getDeepHistory() { final String idShort = "*deephistory*"; final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.DEEP_HISTORY, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.DEEP_HISTORY, null); return quark.getData(); } final String idShort = "*deephistory*" + g.getName(); final Quark quark = quarkInContext(true, cleanId(idShort)); if (quark.getData() == null) - reallyCreateLeaf(quark, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.DEEP_HISTORY, null); + reallyCreateLeaf(quark, Display.getWithNewlines(getPragma(), ""), LeafType.DEEP_HISTORY, null); return quark.getData(); } @@ -177,7 +177,7 @@ public Entity getDeepHistory(String idShort) { final Quark ident = quarkInContext(true, cleanId(tmp)); final Entity result; if (ident.getData() == null) - result = reallyCreateLeaf(ident, Display.getWithNewlines(legacyReplaceBackslashNByNewline(), ""), LeafType.DEEP_HISTORY, null); + result = reallyCreateLeaf(ident, Display.getWithNewlines(getPragma(), ""), LeafType.DEEP_HISTORY, null); else result = ident.getData(); endGroup(); diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java index 562ee3445db..c5d6e911918 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java @@ -121,7 +121,7 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l if (display == null) display = quark.getName(); - diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), GroupType.PACKAGE, USymbols.FRAME); + diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), display), GroupType.PACKAGE, USymbols.FRAME); final Entity p = diagram.getCurrentGroup(); final String stereotype = arg.get("STEREOTYPE", 0); if (stereotype != null) diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java index c06a2764d2e..392823ffd25 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java @@ -125,10 +125,10 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l final String display = getNotNull(arg, "DISPLAY1", "DISPLAY2"); - diagram.gotoGroup(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display == null ? quark.getName() : display), GroupType.STATE); + diagram.gotoGroup(quark, Display.getWithNewlines(diagram.getPragma(), display == null ? quark.getName() : display), GroupType.STATE); final Entity p = diagram.getCurrentGroup(); if (display != null) - p.setDisplay(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display)); + p.setDisplay(Display.getWithNewlines(diagram.getPragma(), display)); final String stereotype = arg.get("STEREOTYPE", 0); if (stereotype != null) diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java index b999912bead..d95090c1495 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java @@ -134,7 +134,7 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l Entity ent = quark.getData(); if (ent == null) - ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display), type, null); + ent = diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), display), type, null); else diagram.setLastEntity(ent); @@ -142,7 +142,7 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l if (currentPass == ParserPass.ONE) { - ent.setDisplay(Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), display)); + ent.setDisplay(Display.getWithNewlines(diagram.getPragma(), display)); if (stereotype != null) ent.setStereotype(Stereotype.build(stereotype)); diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandLinkStateCommon.java b/src/net/sourceforge/plantuml/statediagram/command/CommandLinkStateCommon.java index 01038475fdf..5e8371f706f 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandLinkStateCommon.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandLinkStateCommon.java @@ -120,7 +120,7 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l final LinkType linkType = new LinkType(circleEnd ? LinkDecor.ARROW_AND_CIRCLE : LinkDecor.ARROW, crossStart ? LinkDecor.CIRCLE_CROSS : LinkDecor.NONE); - final Display label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("LABEL", 0)); + final Display label = Display.getWithNewlines(diagram.getPragma(), arg.get("LABEL", 0)); final LinkArg linkArg = LinkArg.build(label, lenght, diagram.getSkinParam().classAttributeIconSize() > 0); Link link = new Link(diagram, diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType, linkArg); @@ -189,7 +189,7 @@ private Entity getEntity(StateDiagram diagram, final String code) { if (quark.getData() != null) return quark.getData(); - return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), quark.getName()), LeafType.STATE, null); + return diagram.reallyCreateLeaf(quark, Display.getWithNewlines(diagram.getPragma(), quark.getName()), LeafType.STATE, null); } private String removeEquals(String code) { diff --git a/src/net/sourceforge/plantuml/style/ISkinSimple.java b/src/net/sourceforge/plantuml/style/ISkinSimple.java index 3332e8da14e..da5ceadea58 100644 --- a/src/net/sourceforge/plantuml/style/ISkinSimple.java +++ b/src/net/sourceforge/plantuml/style/ISkinSimple.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.klimt.font.FontConfiguration; import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment; import net.sourceforge.plantuml.klimt.sprite.SpriteContainer; +import net.sourceforge.plantuml.skin.Pragma; public interface ISkinSimple extends SpriteContainer { // ::remove file when __HAXE__ @@ -69,6 +70,6 @@ public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignme public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, CreoleMode creoleMode, FontConfiguration stereo); - public boolean legacyReplaceBackslashNByNewline(); + public Pragma getPragma(); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/Kal.java b/src/net/sourceforge/plantuml/svek/Kal.java index 78484cc3796..3d9d4074544 100644 --- a/src/net/sourceforge/plantuml/svek/Kal.java +++ b/src/net/sourceforge/plantuml/svek/Kal.java @@ -98,7 +98,7 @@ public Kal(SvekEdge SvekEdge, String text, ISkinParam skinParam, Entity entity, final FontConfiguration font = style.getFontConfiguration(skinParam.getIHtmlColorSet()); - this.textBlock = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), text).create7(font, HorizontalAlignment.LEFT, skinParam, + this.textBlock = Display.getWithNewlines(skinParam.getPragma(), text).create7(font, HorizontalAlignment.LEFT, skinParam, CreoleMode.SIMPLE_LINE); this.dim = this.textBlock.calculateDimension(stringBounder).delta(4, 2); diff --git a/src/net/sourceforge/plantuml/svek/SvekEdge.java b/src/net/sourceforge/plantuml/svek/SvekEdge.java index 070170e4bee..4234fd0fc54 100644 --- a/src/net/sourceforge/plantuml/svek/SvekEdge.java +++ b/src/net/sourceforge/plantuml/svek/SvekEdge.java @@ -316,13 +316,13 @@ else if (note.getPosition() == Position.TOP) if (link.getQuantifier1() == null) startTailText = null; else - startTailText = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), link.getQuantifier1()).create(cardinalityFont, + startTailText = Display.getWithNewlines(skinParam.getPragma(), link.getQuantifier1()).create(cardinalityFont, HorizontalAlignment.CENTER, skinParam); if (link.getQuantifier2() == null) endHeadText = null; else - endHeadText = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), link.getQuantifier2()).create(cardinalityFont, + endHeadText = Display.getWithNewlines(skinParam.getPragma(), link.getQuantifier2()).create(cardinalityFont, HorizontalAlignment.CENTER, skinParam); if (link.getType().getMiddleDecor() == LinkMiddleDecor.NONE) diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java index f2a88f1d0b2..4949209b9bb 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java @@ -70,7 +70,7 @@ public EntityImageArcCircle(Entity entity) { if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { this.stereo = null; } else { - this.stereo = Display.getWithNewlines(getSkinParam().legacyReplaceBackslashNByNewline(), stereotype.getLabel(getSkinParam().guillemet())).create( + this.stereo = Display.getWithNewlines(getSkinParam().getPragma(), stereotype.getLabel(getSkinParam().guillemet())).create( FontConfiguration.create(getSkinParam(), FontParam.COMPONENT_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, getSkinParam()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java index 78c27513603..753fd439029 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java @@ -133,7 +133,7 @@ public EntityImageClassHeader(Entity entity, PortionShower portionShower) { .with(entity.getStereostyles()) // .getMergedStyle(getSkinParam().getCurrentStyleBuilder()); - genericBlock = Display.getWithNewlines(getSkinParam().legacyReplaceBackslashNByNewline(), generic).create( + genericBlock = Display.getWithNewlines(getSkinParam().getPragma(), generic).create( FontConfiguration.create(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, getSkinParam()); genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index ee24d3871c8..a0f7d1b9e94 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -171,7 +171,7 @@ else if (symbol == USymbols.INTERFACE) ctx = new Fashion(backcolor, forecolor).withStroke(stroke).withShadow(deltaShadow).withCorner(roundCorner, diagonalCorner); - final Display codeDisplay = Display.getWithNewlines(getSkinParam().legacyReplaceBackslashNByNewline(), entity.getName()); + final Display codeDisplay = Display.getWithNewlines(getSkinParam().getPragma(), entity.getName()); if ((entity.getDisplay().equalsLike(codeDisplay) && symbol.getSName() == SName.package_) || entity.getDisplay().isWhite()) desc = TextBlockUtils.empty(style.value(PName.MinimumWidth).asDouble(), 0); diff --git a/src/net/sourceforge/plantuml/timingdiagram/Player.java b/src/net/sourceforge/plantuml/timingdiagram/Player.java index a7eb2000582..8c58505e36c 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Player.java +++ b/src/net/sourceforge/plantuml/timingdiagram/Player.java @@ -71,7 +71,7 @@ public Player(String title, ISkinParam skinParam, TimingRuler ruler, boolean com this.skinParam = skinParam; this.compact = compact; this.ruler = ruler; - this.title = Display.getWithNewlines(false, title); + this.title = Display.getWithNewlines(skinParam.getPragma(), title); } public boolean isCompact() { diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java index 9e66b5565c6..0c376784c97 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java @@ -246,7 +246,7 @@ private void drawScaleLabel(UGraphic ug, double value, double fullAvailableWidth } private TextBlock getTextBlock(double value) { - final Display display = Display.getWithNewlines(false, "" + value); + final Display display = Display.getWithNewlines(skinParam.getPragma(), "" + value); return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java index d71701b5e64..81384eed51d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java @@ -236,7 +236,7 @@ final protected FontConfiguration getCommentFontConfiguration() { } private TextBlock getTextBlock(String value) { - final Display display = Display.getWithNewlines(false, value); + final Display display = Display.getWithNewlines(skinParam.getPragma(), value); return display.create(getCommentFontConfiguration(), HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java index 1d1fe9071e9..15d19212c7a 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java @@ -74,7 +74,7 @@ public TimeConstraint(double marginx, TimeTick tick1, TimeTick tick2, String lab this.marginx = marginx; this.tick1 = Objects.requireNonNull(tick1); this.tick2 = Objects.requireNonNull(tick2); - this.label = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), label); + this.label = Display.getWithNewlines(skinParam.getPragma(), label); this.skinParam = skinParam; this.styleBuilder = skinParam.getCurrentStyleBuilder(); this.config = config; diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java b/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java index 0fac7781cc7..1a025857a66 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeMessage.java @@ -62,7 +62,7 @@ public TimeMessage(TickInPlayer tickInPlayer1, TickInPlayer tickInPlayer2, Strin this.styleBuilder = skinParam.getCurrentStyleBuilder(); this.tickInPlayer1 = tickInPlayer1; this.tickInPlayer2 = tickInPlayer2; - this.label = Display.getWithNewlines(false, label); + this.label = Display.getWithNewlines(skinParam.getPragma(), label); this.setSpecificColor(getColor()); this.type = new LinkType(LinkDecor.NONE, LinkDecor.NONE); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java index 4b99a332d8a..dbbb5db0328 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java @@ -194,7 +194,7 @@ private TextBlock getTimeTextBlock(long time) { } private TextBlock getTimeTextBlock(String string) { - final Display display = Display.getWithNewlines(false, string); + final Display display = Display.getWithNewlines(skinParam.getPragma(), string); final FontConfiguration fontConfiguration = FontConfiguration.create(skinParam, getStyleTimeline()); return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java index 3bca17f3fb1..bd4c1d78f21 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java @@ -89,7 +89,7 @@ final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLoc throws NoSuchColorException { final TimeTick tickFrom = TimeTickBuilder.parseTimeTick("FROM", arg, diagram); final TimeTick tickTo = TimeTickBuilder.parseTimeTick("TO", arg, diagram); - final Display display = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("CAPTION", 0)); + final Display display = Display.getWithNewlines(diagram.getPragma(), arg.get("CAPTION", 0)); final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); return diagram.highlight(tickFrom, tickTo, display, colors); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/command/CommandNote.java b/src/net/sourceforge/plantuml/timingdiagram/command/CommandNote.java index 95840cc0e77..1f11b1a4d5d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/command/CommandNote.java +++ b/src/net/sourceforge/plantuml/timingdiagram/command/CommandNote.java @@ -88,7 +88,7 @@ final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLoc if (player == null) return CommandExecutionResult.error("Unkown \"" + code + "\""); - final Display note = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), arg.get("NOTE", 0)); + final Display note = Display.getWithNewlines(diagram.getPragma(), arg.get("NOTE", 0)); final TimeTick now = diagram.getNow(); final String stereotypeString = arg.get("STEREO", 0); diff --git a/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java index 0af3d600d4a..901af6d8d71 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java @@ -411,7 +411,7 @@ private double stepHeight() { } private TextBlock getTextBlock(String value) { - final Display display = Display.getWithNewlines(false, value); + final Display display = Display.getWithNewlines(skinParam.getPragma(), value); return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java index dcb33a52d49..27eaebf87d1 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java @@ -117,7 +117,7 @@ private FontConfiguration getFontConfiguration() { } private TextBlock createTextBlock(String value) { - final Display display = Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), value); + final Display display = Display.getWithNewlines(skinParam.getPragma(), value); return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); } diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java index 44e516e2713..3a8fa2f511d 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java @@ -141,7 +141,7 @@ public CommandExecutionResult addIdea(String code, HColor backColor, int level, label = m.group(1); stereotype = m.group(2); } - final Display display = Display.getWithNewlines(legacyReplaceBackslashNByNewline(), label); + final Display display = Display.getWithNewlines(getPragma(), label); return addIdea(code, backColor, level, display, Stereotype.build(stereotype), direction, shape); } diff --git a/src/net/sourceforge/plantuml/wire/CommandWLink.java b/src/net/sourceforge/plantuml/wire/CommandWLink.java index a2f398ed2c1..782dc776ef3 100644 --- a/src/net/sourceforge/plantuml/wire/CommandWLink.java +++ b/src/net/sourceforge/plantuml/wire/CommandWLink.java @@ -106,7 +106,7 @@ protected CommandExecutionResult executeArg(WireDiagram diagram, LineLocation lo label = Display.NULL; } else { final String message = arg.get("MESSAGE", 0); - label = Display.getWithNewlines(diagram.legacyReplaceBackslashNByNewline(), message); + label = Display.getWithNewlines(diagram.getPragma(), message); } if (orientation == WOrientation.VERTICAL) diff --git a/src/net/sourceforge/plantuml/wire/WBlock.java b/src/net/sourceforge/plantuml/wire/WBlock.java index 1d9ddec5834..215e9e5133c 100644 --- a/src/net/sourceforge/plantuml/wire/WBlock.java +++ b/src/net/sourceforge/plantuml/wire/WBlock.java @@ -185,7 +185,7 @@ public CommandExecutionResult wmove(int level, double x, double y) { public CommandExecutionResult print(StringBounder stringBounder, ISkinParam skinParam, int level, String text) { if (level == 0) { - final WPrint print = new WPrint(skinParam, getNextPosition(), null, Display.getWithNewlines(skinParam.legacyReplaceBackslashNByNewline(), text)); + final WPrint print = new WPrint(skinParam, getNextPosition(), null, Display.getWithNewlines(skinParam.getPragma(), text)); this.prints.add(print); this.cursor = this.cursor.compose(UTranslate.dy(print.getHeight(stringBounder))); diff --git a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java index 9dae2ae27a1..ce2e1d9ee0c 100644 --- a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java @@ -95,7 +95,7 @@ public Diagram createSystem(UmlSource source, Map skinMap) { } final String title = styleExtractor.getTitle(); if (title != null) - result.setTitle(DisplayPositioned.single(Display.getWithNewlines(result.legacyReplaceBackslashNByNewline(), title), HorizontalAlignment.CENTER, + result.setTitle(DisplayPositioned.single(Display.getWithNewlines(result.getPragma(), title), HorizontalAlignment.CENTER, VerticalAlignment.CENTER)); } return result;