mirror of
https://github.com/octoleo/plantuml.git
synced 2024-06-03 09:00:48 +00:00
Import version 1.2021.15
This commit is contained in:
parent
64510e5c88
commit
2494e6a435
|
@ -83,7 +83,6 @@ import net.sourceforge.plantuml.version.Version;
|
||||||
public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite {
|
public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite {
|
||||||
|
|
||||||
private boolean rotation;
|
private boolean rotation;
|
||||||
private boolean hideUnlinkedData;
|
|
||||||
|
|
||||||
private int minwidth = Integer.MAX_VALUE;
|
private int minwidth = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
@ -120,15 +119,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isHideUnlinkedData() {
|
|
||||||
return hideUnlinkedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void setHideUnlinkedData(boolean hideUnlinkedData) {
|
|
||||||
this.hideUnlinkedData = hideUnlinkedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption)
|
final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
|
@ -253,7 +253,6 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
|
||||||
|
|
||||||
final protected void addCommonHides(List<Command> cmds) {
|
final protected void addCommonHides(List<Command> cmds) {
|
||||||
cmds.add(new CommandHideEmptyDescription());
|
cmds.add(new CommandHideEmptyDescription());
|
||||||
cmds.add(new CommandHideUnlinked());
|
|
||||||
cmds.add(new CommandHideShowByVisibility());
|
cmds.add(new CommandHideShowByVisibility());
|
||||||
cmds.add(new CommandHideShowByGender());
|
cmds.add(new CommandHideShowByGender());
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
||||||
|
|
||||||
public interface Command {
|
public interface Command {
|
||||||
|
|
||||||
|
public String startingChars();
|
||||||
|
|
||||||
public int matchingSize(String line);
|
public int matchingSize(String line);
|
||||||
|
|
||||||
public String executeAndGetRemaining(String line, StripeSimple stripe);
|
public String executeAndGetRemaining(String line, StripeSimple stripe);
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.creole.command;
|
package net.sourceforge.plantuml.creole.command;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ThemeStyle;
|
|
||||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
import net.sourceforge.plantuml.command.regex.Matcher2;
|
||||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||||
import net.sourceforge.plantuml.command.regex.Pattern2;
|
import net.sourceforge.plantuml.command.regex.Pattern2;
|
||||||
|
@ -48,8 +47,12 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
|
||||||
|
|
||||||
public class CommandCreoleColorAndSizeChange implements Command {
|
public class CommandCreoleColorAndSizeChange implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private final Pattern2 mypattern;
|
private final Pattern2 mypattern;
|
||||||
private final ThemeStyle themeStyle;
|
|
||||||
|
|
||||||
public static final String fontPattern = "\\<font(?:[%s]+size[%s]*=[%s]*[%g]?(\\d+)[%g]?|[%s]+color[%s]*=[%s]*[%g]?(#[0-9a-fA-F]{6}|\\w+)[%g]?)+[%s]*\\>";
|
public static final String fontPattern = "\\<font(?:[%s]+size[%s]*=[%s]*[%g]?(\\d+)[%g]?|[%s]+color[%s]*=[%s]*[%g]?(#[0-9a-fA-F]{6}|\\w+)[%g]?)+[%s]*\\>";
|
||||||
|
|
||||||
|
@ -57,45 +60,40 @@ public class CommandCreoleColorAndSizeChange implements Command {
|
||||||
|
|
||||||
private static final Pattern2 patternEol = MyPattern.cmpile("^(" + fontPattern + "(.*))$");
|
private static final Pattern2 patternEol = MyPattern.cmpile("^(" + fontPattern + "(.*))$");
|
||||||
|
|
||||||
public static Command create(ThemeStyle themeStyle) {
|
public static Command create() {
|
||||||
return new CommandCreoleColorAndSizeChange(themeStyle, pattern);
|
return new CommandCreoleColorAndSizeChange(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Command createEol(ThemeStyle themeStyle) {
|
public static Command createEol() {
|
||||||
return new CommandCreoleColorAndSizeChange(themeStyle, patternEol);
|
return new CommandCreoleColorAndSizeChange(patternEol);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandCreoleColorAndSizeChange(ThemeStyle themeStyle, Pattern2 pattern) {
|
private CommandCreoleColorAndSizeChange(Pattern2 pattern) {
|
||||||
this.mypattern = pattern;
|
this.mypattern = pattern;
|
||||||
this.themeStyle = themeStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int matchingSize(String line) {
|
public int matchingSize(String line) {
|
||||||
final Matcher2 m = mypattern.matcher(line);
|
final Matcher2 m = mypattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return m.group(1).length();
|
return m.group(1).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
|
public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
|
||||||
final Matcher2 m = mypattern.matcher(line);
|
final Matcher2 m = mypattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
// for (int i = 1; i <= m.groupCount(); i++) {
|
|
||||||
// System.err.println("i=" + i + " " + m.group(i));
|
|
||||||
// }
|
|
||||||
|
|
||||||
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
||||||
FontConfiguration fc2 = fc1;
|
FontConfiguration fc2 = fc1;
|
||||||
if (m.group(2) != null) {
|
if (m.group(2) != null)
|
||||||
fc2 = fc2.changeSize(Integer.parseInt(m.group(2)));
|
fc2 = fc2.changeSize(Integer.parseInt(m.group(2)));
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (m.group(3) != null) {
|
if (m.group(3) != null) {
|
||||||
final String s = m.group(3);
|
final String s = m.group(3);
|
||||||
final HColor color = HColorSet.instance().getColor(themeStyle, s);
|
final HColor color = HColorSet.instance().getColor(stripe.getSkinParam().getThemeStyle(), s);
|
||||||
fc2 = fc2.changeColor(color);
|
fc2 = fc2.changeColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,4 +105,5 @@ public class CommandCreoleColorAndSizeChange implements Command {
|
||||||
throw new NoSuchColorRuntimeException();
|
throw new NoSuchColorRuntimeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.creole.command;
|
package net.sourceforge.plantuml.creole.command;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ThemeStyle;
|
|
||||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
import net.sourceforge.plantuml.command.regex.Matcher2;
|
||||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||||
import net.sourceforge.plantuml.command.regex.Pattern2;
|
import net.sourceforge.plantuml.command.regex.Pattern2;
|
||||||
|
@ -49,44 +48,46 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
|
||||||
|
|
||||||
public class CommandCreoleColorChange implements Command {
|
public class CommandCreoleColorChange implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
|
||||||
|
|
||||||
private static final Pattern2 patternEol = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*)$)");
|
private static final Pattern2 patternEol = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*)$)");
|
||||||
|
|
||||||
private final Pattern2 mypattern;
|
private final Pattern2 mypattern;
|
||||||
private final ThemeStyle themeStyle;
|
|
||||||
|
|
||||||
public static Command create(ThemeStyle themeStyle) {
|
public static Command create() {
|
||||||
return new CommandCreoleColorChange(themeStyle, pattern);
|
return new CommandCreoleColorChange(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Command createEol(ThemeStyle themeStyle) {
|
public static Command createEol() {
|
||||||
return new CommandCreoleColorChange(themeStyle, patternEol);
|
return new CommandCreoleColorChange(patternEol);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandCreoleColorChange(ThemeStyle themeStyle, Pattern2 pattern) {
|
private CommandCreoleColorChange(Pattern2 pattern) {
|
||||||
this.mypattern = pattern;
|
this.mypattern = pattern;
|
||||||
this.themeStyle = themeStyle;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int matchingSize(String line) {
|
public int matchingSize(String line) {
|
||||||
final Matcher2 m = mypattern.matcher(line);
|
final Matcher2 m = mypattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return m.group(2).length();
|
return m.group(2).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
|
public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
|
||||||
final Matcher2 m = mypattern.matcher(line);
|
final Matcher2 m = mypattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
||||||
final String s = m.group(2);
|
final String s = m.group(2);
|
||||||
try {
|
try {
|
||||||
final HColor color = HColorSet.instance().getColor(themeStyle, s);
|
final HColor color = HColorSet.instance().getColor(stripe.getSkinParam().getThemeStyle(), s);
|
||||||
final FontConfiguration fc2 = fc1.changeColor(color);
|
final FontConfiguration fc2 = fc1.changeColor(color);
|
||||||
stripe.setActualFontConfiguration(fc2);
|
stripe.setActualFontConfiguration(fc2);
|
||||||
} catch (NoSuchColorException e) {
|
} catch (NoSuchColorException e) {
|
||||||
|
|
|
@ -43,6 +43,11 @@ import net.sourceforge.plantuml.graphic.FontPosition;
|
||||||
public class CommandCreoleExposantChange extends CommandCreoleCache implements Command {
|
public class CommandCreoleExposantChange extends CommandCreoleCache implements Command {
|
||||||
|
|
||||||
private final FontPosition position;
|
private final FontPosition position;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private CommandCreoleExposantChange(String p, FontPosition position) {
|
private CommandCreoleExposantChange(String p, FontPosition position) {
|
||||||
super(p);
|
super(p);
|
||||||
|
|
|
@ -44,6 +44,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
|
||||||
|
|
||||||
public class CommandCreoleFontFamilyChange implements Command {
|
public class CommandCreoleFontFamilyChange implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern
|
private static final Pattern2 pattern = MyPattern
|
||||||
.cmpile("^(" + Splitter.fontFamilyPattern + "(.*?)\\</font\\>)");
|
.cmpile("^(" + Splitter.fontFamilyPattern + "(.*?)\\</font\\>)");
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
|
||||||
|
|
||||||
public class CommandCreoleImg implements Command {
|
public class CommandCreoleImg implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.imgPatternNoSrcColon + ")");
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.imgPatternNoSrcColon + ")");
|
||||||
|
|
||||||
private CommandCreoleImg() {
|
private CommandCreoleImg() {
|
||||||
|
|
|
@ -44,6 +44,11 @@ import net.sourceforge.plantuml.math.ScientificEquationSafe;
|
||||||
|
|
||||||
public class CommandCreoleLatex implements Command {
|
public class CommandCreoleLatex implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.latexPattern + ")");
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.latexPattern + ")");
|
||||||
|
|
||||||
private CommandCreoleLatex() {
|
private CommandCreoleLatex() {
|
||||||
|
|
|
@ -44,6 +44,11 @@ import net.sourceforge.plantuml.math.ScientificEquationSafe;
|
||||||
|
|
||||||
public class CommandCreoleMath implements Command {
|
public class CommandCreoleMath implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.mathPattern + ")");
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.mathPattern + ")");
|
||||||
|
|
||||||
private CommandCreoleMath() {
|
private CommandCreoleMath() {
|
||||||
|
|
|
@ -43,16 +43,19 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
|
|
||||||
public class CommandCreoleMonospaced implements Command {
|
public class CommandCreoleMonospaced implements Command {
|
||||||
|
|
||||||
private final Pattern2 pattern;
|
@Override
|
||||||
private final String monospacedFamily;
|
public String startingChars() {
|
||||||
|
return "\"";
|
||||||
public static Command create(String monospacedFamily) {
|
|
||||||
return new CommandCreoleMonospaced("^(\"\"(.*?)\"\")", monospacedFamily);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandCreoleMonospaced(String p, String monospacedFamily) {
|
private final Pattern2 pattern;
|
||||||
|
|
||||||
|
public static Command create() {
|
||||||
|
return new CommandCreoleMonospaced("^(\"\"(.*?)\"\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommandCreoleMonospaced(String p) {
|
||||||
this.pattern = MyPattern.cmpile(p);
|
this.pattern = MyPattern.cmpile(p);
|
||||||
this.monospacedFamily = monospacedFamily;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int matchingSize(String line) {
|
public int matchingSize(String line) {
|
||||||
|
@ -65,11 +68,11 @@ public class CommandCreoleMonospaced implements Command {
|
||||||
|
|
||||||
public String executeAndGetRemaining(String line, StripeSimple stripe) {
|
public String executeAndGetRemaining(String line, StripeSimple stripe) {
|
||||||
final Matcher2 m = pattern.matcher(line);
|
final Matcher2 m = pattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
||||||
final FontConfiguration fc2 = fc1.changeFamily(monospacedFamily);
|
final FontConfiguration fc2 = fc1.changeFamily(stripe.getSkinParam().getMonospacedFamily());
|
||||||
stripe.setActualFontConfiguration(fc2);
|
stripe.setActualFontConfiguration(fc2);
|
||||||
stripe.analyzeAndAdd(m.group(2));
|
stripe.analyzeAndAdd(m.group(2));
|
||||||
stripe.setActualFontConfiguration(fc1);
|
stripe.setActualFontConfiguration(fc1);
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.creole.command;
|
package net.sourceforge.plantuml.creole.command;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ThemeStyle;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
import net.sourceforge.plantuml.command.regex.Matcher2;
|
||||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||||
import net.sourceforge.plantuml.command.regex.Pattern2;
|
import net.sourceforge.plantuml.command.regex.Pattern2;
|
||||||
|
@ -43,43 +43,43 @@ import net.sourceforge.plantuml.creole.Parser;
|
||||||
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
||||||
import net.sourceforge.plantuml.graphic.Splitter;
|
import net.sourceforge.plantuml.graphic.Splitter;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
|
||||||
|
|
||||||
public class CommandCreoleOpenIcon implements Command {
|
public class CommandCreoleOpenIcon implements Command {
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.openiconPattern + ")");
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
private final HColorSet colorSet;
|
return "<";
|
||||||
private final ThemeStyle themeStyle;
|
|
||||||
|
|
||||||
private CommandCreoleOpenIcon(ThemeStyle themeStyle, HColorSet colorSet) {
|
|
||||||
this.colorSet = colorSet;
|
|
||||||
this.themeStyle = themeStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Command create(ThemeStyle themeStyle, HColorSet colorSet) {
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.openiconPattern + ")");
|
||||||
return new CommandCreoleOpenIcon(themeStyle, colorSet);
|
|
||||||
|
private CommandCreoleOpenIcon() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Command create() {
|
||||||
|
return new CommandCreoleOpenIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int matchingSize(String line) {
|
public int matchingSize(String line) {
|
||||||
final Matcher2 m = pattern.matcher(line);
|
final Matcher2 m = pattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return m.group(1).length();
|
return m.group(1).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String executeAndGetRemaining(String line, StripeSimple stripe) {
|
public String executeAndGetRemaining(String line, StripeSimple stripe) {
|
||||||
final Matcher2 m = pattern.matcher(line);
|
final Matcher2 m = pattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
final String src = m.group(2);
|
final String src = m.group(2);
|
||||||
final double scale = Parser.getScale(m.group(3), 1);
|
final double scale = Parser.getScale(m.group(3), 1);
|
||||||
final String colorName = Parser.getColor(m.group(3));
|
final String colorName = Parser.getColor(m.group(3));
|
||||||
HColor color = null;
|
HColor color = null;
|
||||||
if (colorName != null) {
|
if (colorName != null) {
|
||||||
color = colorSet.getColorOrWhite(themeStyle, colorName);
|
final ISkinSimple skinParam = stripe.getSkinParam();
|
||||||
|
color = skinParam.getIHtmlColorSet().getColorOrWhite(skinParam.getThemeStyle(), colorName);
|
||||||
}
|
}
|
||||||
stripe.addOpenIcon(src, scale, color);
|
stripe.addOpenIcon(src, scale, color);
|
||||||
return line.substring(m.group(1).length());
|
return line.substring(m.group(1).length());
|
||||||
|
|
|
@ -44,6 +44,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
|
||||||
|
|
||||||
public class CommandCreoleQrcode implements Command {
|
public class CommandCreoleQrcode implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.qrcodePattern + ")");
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.qrcodePattern + ")");
|
||||||
|
|
||||||
private CommandCreoleQrcode() {
|
private CommandCreoleQrcode() {
|
||||||
|
|
|
@ -44,6 +44,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
|
||||||
|
|
||||||
public class CommandCreoleSizeChange implements Command {
|
public class CommandCreoleSizeChange implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private final Pattern2 mypattern;
|
private final Pattern2 mypattern;
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern
|
private static final Pattern2 pattern = MyPattern
|
||||||
|
|
|
@ -41,6 +41,11 @@ import net.sourceforge.plantuml.command.regex.Pattern2;
|
||||||
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
||||||
|
|
||||||
public class CommandCreoleSpace implements Command {
|
public class CommandCreoleSpace implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(\\<space:(\\d+)/?\\>)");
|
private static final Pattern2 pattern = MyPattern.cmpile("^(\\<space:(\\d+)/?\\>)");
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.creole.command;
|
package net.sourceforge.plantuml.creole.command;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ThemeStyle;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
import net.sourceforge.plantuml.command.regex.Matcher2;
|
||||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||||
import net.sourceforge.plantuml.command.regex.Pattern2;
|
import net.sourceforge.plantuml.command.regex.Pattern2;
|
||||||
|
@ -43,43 +43,43 @@ import net.sourceforge.plantuml.creole.Parser;
|
||||||
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
||||||
import net.sourceforge.plantuml.graphic.Splitter;
|
import net.sourceforge.plantuml.graphic.Splitter;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
|
||||||
|
|
||||||
public class CommandCreoleSprite implements Command {
|
public class CommandCreoleSprite implements Command {
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.spritePattern2 + ")");
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
private final HColorSet colorSet;
|
return "<";
|
||||||
private final ThemeStyle themeStyle;
|
|
||||||
|
|
||||||
private CommandCreoleSprite(ThemeStyle themeStyle, HColorSet colorSet) {
|
|
||||||
this.colorSet = colorSet;
|
|
||||||
this.themeStyle = themeStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Command create(ThemeStyle themeStyle, HColorSet colorSet) {
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.spritePattern2 + ")");
|
||||||
return new CommandCreoleSprite(themeStyle, colorSet);
|
|
||||||
|
private CommandCreoleSprite() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Command create() {
|
||||||
|
return new CommandCreoleSprite();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int matchingSize(String line) {
|
public int matchingSize(String line) {
|
||||||
final Matcher2 m = pattern.matcher(line);
|
final Matcher2 m = pattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return m.group(1).length();
|
return m.group(1).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String executeAndGetRemaining(String line, StripeSimple stripe) {
|
public String executeAndGetRemaining(String line, StripeSimple stripe) {
|
||||||
final Matcher2 m = pattern.matcher(line);
|
final Matcher2 m = pattern.matcher(line);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
final String src = m.group(2);
|
final String src = m.group(2);
|
||||||
final double scale = Parser.getScale(m.group(3), 1);
|
final double scale = Parser.getScale(m.group(3), 1);
|
||||||
final String colorName = Parser.getColor(m.group(3));
|
final String colorName = Parser.getColor(m.group(3));
|
||||||
HColor color = null;
|
HColor color = null;
|
||||||
if (colorName != null) {
|
if (colorName != null) {
|
||||||
color = colorSet.getColorOrWhite(themeStyle, colorName);
|
final ISkinSimple skinParam = stripe.getSkinParam();
|
||||||
|
color = skinParam.getIHtmlColorSet().getColorOrWhite(skinParam.getThemeStyle(), colorName);
|
||||||
}
|
}
|
||||||
stripe.addSprite(src, scale, color);
|
stripe.addSprite(src, scale, color);
|
||||||
return line.substring(m.group(1).length());
|
return line.substring(m.group(1).length());
|
||||||
|
|
|
@ -44,6 +44,11 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
public class CommandCreoleStyle extends CommandCreoleCache implements Command {
|
public class CommandCreoleStyle extends CommandCreoleCache implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "</*_~-";
|
||||||
|
}
|
||||||
|
|
||||||
private final FontStyle style;
|
private final FontStyle style;
|
||||||
private final boolean tryExtendedColor;
|
private final boolean tryExtendedColor;
|
||||||
|
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
/* ========================================================================
|
|
||||||
* PlantUML : a free UML diagram generator
|
|
||||||
* ========================================================================
|
|
||||||
*
|
|
||||||
* (C) Copyright 2009-2020, Arnaud Roques
|
|
||||||
*
|
|
||||||
* Project Info: http://plantuml.com
|
|
||||||
*
|
|
||||||
* If you like this project or if you find it useful, you can support us at:
|
|
||||||
*
|
|
||||||
* http://plantuml.com/patreon (only 1$ per month!)
|
|
||||||
* http://plantuml.com/paypal
|
|
||||||
*
|
|
||||||
* This file is part of PlantUML.
|
|
||||||
*
|
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* PlantUML distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
||||||
* USA.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Original Author: Arnaud Roques
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package net.sourceforge.plantuml.creole.command;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
|
||||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
|
||||||
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
|
||||||
import net.sourceforge.plantuml.graphic.FontStyle;
|
|
||||||
|
|
||||||
public class CommandCreoleStyle2 extends CommandCreoleCache implements Command {
|
|
||||||
|
|
||||||
public static Command createCreole(FontStyle style) {
|
|
||||||
return new CommandCreoleStyle2("^(" + style.getCreoleSyntax() + "(.+?)" + style.getCreoleSyntax() + ")", style);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Command createLegacy(FontStyle style) {
|
|
||||||
return new CommandCreoleStyle2(
|
|
||||||
"^((" + style.getActivationPattern() + ")(.+?)" + style.getDeactivationPattern() + ")", style);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Command createLegacyEol(FontStyle style) {
|
|
||||||
return new CommandCreoleStyle2("^((" + style.getActivationPattern() + ")(.+))$", style);
|
|
||||||
}
|
|
||||||
|
|
||||||
private CommandCreoleStyle2(String p, FontStyle style) {
|
|
||||||
super(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String executeAndGetRemaining(final String line, StripeSimple stripe) {
|
|
||||||
final Matcher2 m = mypattern.matcher(line);
|
|
||||||
if (m.find() == false) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
final int groupCount = m.groupCount();
|
|
||||||
final String part1 = m.group(groupCount);
|
|
||||||
final String part2 = line.substring(m.group(1).length());
|
|
||||||
return StringUtils.BOLD_START + part1 + StringUtils.BOLD_END + part2;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int matchingSize(String line) {
|
|
||||||
final Matcher2 m = mypattern.matcher(line);
|
|
||||||
if (m.find() == false) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return m.group(1).length();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -45,6 +45,11 @@ import net.sourceforge.plantuml.graphic.SvgAttributes;
|
||||||
|
|
||||||
public class CommandCreoleSvgAttributeChange implements Command {
|
public class CommandCreoleSvgAttributeChange implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String startingChars() {
|
||||||
|
return "<";
|
||||||
|
}
|
||||||
|
|
||||||
public static final String fontPattern = Splitter.svgAttributePattern;
|
public static final String fontPattern = Splitter.svgAttributePattern;
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + fontPattern + "(.*?)\\</text\\>)");
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + fontPattern + "(.*?)\\</text\\>)");
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.creole.command;
|
package net.sourceforge.plantuml.creole.command;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.UrlBuilder;
|
import net.sourceforge.plantuml.UrlBuilder;
|
||||||
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
|
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
|
||||||
|
@ -46,16 +45,18 @@ import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
||||||
|
|
||||||
public class CommandCreoleUrl implements Command {
|
public class CommandCreoleUrl implements Command {
|
||||||
|
|
||||||
private static final Pattern2 pattern = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")");
|
@Override
|
||||||
private final ISkinSimple skinParam;
|
public String startingChars() {
|
||||||
|
return "[";
|
||||||
public static Command create(ISkinSimple skinParam) {
|
|
||||||
return new CommandCreoleUrl(skinParam);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandCreoleUrl(ISkinSimple skinParam) {
|
private static final Pattern2 pattern = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")");
|
||||||
this.skinParam = skinParam;
|
|
||||||
|
|
||||||
|
public static Command create() {
|
||||||
|
return new CommandCreoleUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommandCreoleUrl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int matchingSize(String line) {
|
public int matchingSize(String line) {
|
||||||
|
@ -71,7 +72,7 @@ public class CommandCreoleUrl implements Command {
|
||||||
if (m.find() == false) {
|
if (m.find() == false) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
final UrlBuilder urlBuilder = new UrlBuilder(skinParam.getValue("topurl"), ModeUrl.STRICT);
|
final UrlBuilder urlBuilder = new UrlBuilder(stripe.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
|
||||||
final Url url = urlBuilder.getUrl(m.group(1));
|
final Url url = urlBuilder.getUrl(m.group(1));
|
||||||
stripe.addUrl(url);
|
stripe.addUrl(url);
|
||||||
return line.substring(m.group(1).length());
|
return line.substring(m.group(1).length());
|
||||||
|
|
|
@ -37,7 +37,9 @@ package net.sourceforge.plantuml.creole.legacy;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.BackSlash;
|
import net.sourceforge.plantuml.BackSlash;
|
||||||
|
@ -70,7 +72,6 @@ import net.sourceforge.plantuml.creole.command.CommandCreoleSizeChange;
|
||||||
import net.sourceforge.plantuml.creole.command.CommandCreoleSpace;
|
import net.sourceforge.plantuml.creole.command.CommandCreoleSpace;
|
||||||
import net.sourceforge.plantuml.creole.command.CommandCreoleSprite;
|
import net.sourceforge.plantuml.creole.command.CommandCreoleSprite;
|
||||||
import net.sourceforge.plantuml.creole.command.CommandCreoleStyle;
|
import net.sourceforge.plantuml.creole.command.CommandCreoleStyle;
|
||||||
import net.sourceforge.plantuml.creole.command.CommandCreoleStyle2;
|
|
||||||
import net.sourceforge.plantuml.creole.command.CommandCreoleSvgAttributeChange;
|
import net.sourceforge.plantuml.creole.command.CommandCreoleSvgAttributeChange;
|
||||||
import net.sourceforge.plantuml.creole.command.CommandCreoleUrl;
|
import net.sourceforge.plantuml.creole.command.CommandCreoleUrl;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
|
@ -90,7 +91,10 @@ public class StripeSimple implements Stripe {
|
||||||
final private Atom header;
|
final private Atom header;
|
||||||
|
|
||||||
final private List<Atom> atoms = new ArrayList<>();
|
final private List<Atom> atoms = new ArrayList<>();
|
||||||
final private List<Command> commands = new ArrayList<>();
|
|
||||||
|
// final private List<Command> commands = new ArrayList<>();
|
||||||
|
final private Map<Character, List<Command>> commands = new HashMap<>();
|
||||||
|
|
||||||
private HorizontalAlignment align = HorizontalAlignment.LEFT;
|
private HorizontalAlignment align = HorizontalAlignment.LEFT;
|
||||||
|
|
||||||
public void setCellAlignment(HorizontalAlignment align) {
|
public void setCellAlignment(HorizontalAlignment align) {
|
||||||
|
@ -115,64 +119,55 @@ public class StripeSimple implements Stripe {
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static boolean TSPAN = false;
|
|
||||||
|
|
||||||
public StripeSimple(FontConfiguration fontConfiguration, StripeStyle style, CreoleContext context,
|
public StripeSimple(FontConfiguration fontConfiguration, StripeStyle style, CreoleContext context,
|
||||||
ISkinSimple skinParam, CreoleMode modeSimpleLine) {
|
ISkinSimple skinParam, CreoleMode modeSimpleLine) {
|
||||||
this.fontConfiguration = fontConfiguration;
|
this.fontConfiguration = fontConfiguration;
|
||||||
this.style = style;
|
this.style = style;
|
||||||
this.skinParam = skinParam;
|
this.skinParam = skinParam;
|
||||||
|
|
||||||
// class Splitter
|
addCommand(CommandCreoleStyle.createCreole(FontStyle.BOLD));
|
||||||
if (TSPAN) {
|
addCommand(CommandCreoleStyle.createLegacy(FontStyle.BOLD));
|
||||||
this.commands.add(CommandCreoleStyle2.createCreole(FontStyle.BOLD));
|
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.BOLD));
|
||||||
this.commands.add(CommandCreoleStyle2.createLegacy(FontStyle.BOLD));
|
|
||||||
this.commands.add(CommandCreoleStyle2.createLegacyEol(FontStyle.BOLD));
|
|
||||||
} else {
|
|
||||||
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.BOLD));
|
|
||||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.BOLD));
|
|
||||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.BOLD));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.ITALIC));
|
addCommand(CommandCreoleStyle.createCreole(FontStyle.ITALIC));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.ITALIC));
|
addCommand(CommandCreoleStyle.createLegacy(FontStyle.ITALIC));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.ITALIC));
|
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.ITALIC));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.PLAIN));
|
addCommand(CommandCreoleStyle.createLegacy(FontStyle.PLAIN));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.PLAIN));
|
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.PLAIN));
|
||||||
if (modeSimpleLine == CreoleMode.FULL) {
|
if (modeSimpleLine == CreoleMode.FULL) {
|
||||||
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.UNDERLINE));
|
addCommand(CommandCreoleStyle.createCreole(FontStyle.UNDERLINE));
|
||||||
}
|
}
|
||||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.UNDERLINE));
|
addCommand(CommandCreoleStyle.createLegacy(FontStyle.UNDERLINE));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.UNDERLINE));
|
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.UNDERLINE));
|
||||||
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.STRIKE));
|
addCommand(CommandCreoleStyle.createCreole(FontStyle.STRIKE));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.STRIKE));
|
addCommand(CommandCreoleStyle.createLegacy(FontStyle.STRIKE));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.STRIKE));
|
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.STRIKE));
|
||||||
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.WAVE));
|
addCommand(CommandCreoleStyle.createCreole(FontStyle.WAVE));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.WAVE));
|
addCommand(CommandCreoleStyle.createLegacy(FontStyle.WAVE));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.WAVE));
|
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.WAVE));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.BACKCOLOR));
|
addCommand(CommandCreoleStyle.createLegacy(FontStyle.BACKCOLOR));
|
||||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.BACKCOLOR));
|
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.BACKCOLOR));
|
||||||
this.commands.add(CommandCreoleSizeChange.create());
|
addCommand(CommandCreoleSizeChange.create());
|
||||||
this.commands.add(CommandCreoleSizeChange.createEol());
|
addCommand(CommandCreoleSizeChange.createEol());
|
||||||
this.commands.add(CommandCreoleColorChange.create(skinParam.getThemeStyle()));
|
addCommand(CommandCreoleColorChange.create());
|
||||||
this.commands.add(CommandCreoleColorChange.createEol(skinParam.getThemeStyle()));
|
addCommand(CommandCreoleColorChange.createEol());
|
||||||
this.commands.add(CommandCreoleColorAndSizeChange.create(skinParam.getThemeStyle()));
|
addCommand(CommandCreoleColorAndSizeChange.create());
|
||||||
this.commands.add(CommandCreoleColorAndSizeChange.createEol(skinParam.getThemeStyle()));
|
addCommand(CommandCreoleColorAndSizeChange.createEol());
|
||||||
this.commands.add(CommandCreoleExposantChange.create(FontPosition.EXPOSANT));
|
addCommand(CommandCreoleExposantChange.create(FontPosition.EXPOSANT));
|
||||||
this.commands.add(CommandCreoleExposantChange.create(FontPosition.INDICE));
|
addCommand(CommandCreoleExposantChange.create(FontPosition.INDICE));
|
||||||
this.commands.add(CommandCreoleImg.create());
|
addCommand(CommandCreoleImg.create());
|
||||||
this.commands.add(CommandCreoleQrcode.create());
|
addCommand(CommandCreoleQrcode.create());
|
||||||
this.commands.add(CommandCreoleOpenIcon.create(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()));
|
addCommand(CommandCreoleOpenIcon.create());
|
||||||
this.commands.add(CommandCreoleMath.create());
|
addCommand(CommandCreoleMath.create());
|
||||||
this.commands.add(CommandCreoleLatex.create());
|
addCommand(CommandCreoleLatex.create());
|
||||||
this.commands.add(CommandCreoleSprite.create(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()));
|
addCommand(CommandCreoleSprite.create());
|
||||||
this.commands.add(CommandCreoleSpace.create());
|
addCommand(CommandCreoleSpace.create());
|
||||||
this.commands.add(CommandCreoleFontFamilyChange.create());
|
addCommand(CommandCreoleFontFamilyChange.create());
|
||||||
this.commands.add(CommandCreoleFontFamilyChange.createEol());
|
addCommand(CommandCreoleFontFamilyChange.createEol());
|
||||||
this.commands.add(CommandCreoleMonospaced.create(skinParam.getMonospacedFamily()));
|
addCommand(CommandCreoleMonospaced.create());
|
||||||
this.commands.add(CommandCreoleUrl.create(skinParam));
|
addCommand(CommandCreoleUrl.create());
|
||||||
if (SecurityUtils.allowSvgText()) {
|
if (SecurityUtils.allowSvgText()) {
|
||||||
this.commands.add(CommandCreoleSvgAttributeChange.create());
|
addCommand(CommandCreoleSvgAttributeChange.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.header = style.getHeader(fontConfiguration, context);
|
this.header = style.getHeader(fontConfiguration, context);
|
||||||
|
@ -182,6 +177,19 @@ public class StripeSimple implements Stripe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addCommand(Command cmd) {
|
||||||
|
final String starters = cmd.startingChars();
|
||||||
|
for (int i = 0; i < starters.length(); i++) {
|
||||||
|
final char ch = starters.charAt(i);
|
||||||
|
List<Command> localList = commands.get(ch);
|
||||||
|
if (localList == null) {
|
||||||
|
localList = new ArrayList<Command>();
|
||||||
|
commands.put(ch, localList);
|
||||||
|
}
|
||||||
|
localList.add(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Atom> getAtoms() {
|
public List<Atom> getAtoms() {
|
||||||
if (atoms.size() == 0) {
|
if (atoms.size() == 0) {
|
||||||
atoms.add(AtomTextUtils.createLegacy(" ", fontConfiguration));
|
atoms.add(AtomTextUtils.createLegacy(" ", fontConfiguration));
|
||||||
|
@ -285,13 +293,19 @@ public class StripeSimple implements Stripe {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Command searchCommand(String line) {
|
private Command searchCommand(String line) {
|
||||||
for (Command cmd : commands) {
|
final List<Command> localList = commands.get(line.charAt(0));
|
||||||
final int i = cmd.matchingSize(line);
|
if (localList != null)
|
||||||
if (i != 0) {
|
for (Command cmd : localList) {
|
||||||
return cmd;
|
final int i = cmd.matchingSize(line);
|
||||||
|
if (i != 0) {
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ISkinSimple getSkinParam() {
|
||||||
|
return skinParam;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,11 +108,6 @@ public class MindMap implements UDrawable {
|
||||||
|
|
||||||
CommandExecutionResult addIdeaInternal(String stereotype, HColor backColor, int level, Display label,
|
CommandExecutionResult addIdeaInternal(String stereotype, HColor backColor, int level, Display label,
|
||||||
IdeaShape shape, Direction direction) {
|
IdeaShape shape, Direction direction) {
|
||||||
|
|
||||||
if (level == 0 && this.right.hasRoot())
|
|
||||||
return CommandExecutionResult.error(
|
|
||||||
"I don't know how to draw multi-root diagram. You should suggest an image so that the PlantUML team implements it :-)");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.left.hasRoot() == false && this.right.hasRoot() == false)
|
if (this.left.hasRoot() == false && this.right.hasRoot() == false)
|
||||||
level = 0;
|
level = 0;
|
||||||
|
@ -132,4 +127,8 @@ public class MindMap implements UDrawable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isFull(int level) {
|
||||||
|
return level == 0 && this.right.hasRoot();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,10 @@ import java.awt.geom.Dimension2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.Direction;
|
import net.sourceforge.plantuml.Direction;
|
||||||
import net.sourceforge.plantuml.FileFormatOption;
|
import net.sourceforge.plantuml.FileFormatOption;
|
||||||
import net.sourceforge.plantuml.UmlDiagram;
|
import net.sourceforge.plantuml.UmlDiagram;
|
||||||
|
@ -54,11 +57,12 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
public class MindMapDiagram extends UmlDiagram {
|
public class MindMapDiagram extends UmlDiagram {
|
||||||
|
|
||||||
private final MindMap mindmap;
|
private final List<MindMap> mindmaps = new ArrayList<>();
|
||||||
|
|
||||||
private Direction defaultDirection = Direction.RIGHT;
|
private Direction defaultDirection = Direction.RIGHT;
|
||||||
|
|
||||||
|
@ -72,7 +76,7 @@ public class MindMapDiagram extends UmlDiagram {
|
||||||
|
|
||||||
public MindMapDiagram(UmlSource source) {
|
public MindMapDiagram(UmlSource source) {
|
||||||
super(source, UmlDiagramType.MINDMAP);
|
super(source, UmlDiagramType.MINDMAP);
|
||||||
this.mindmap = new MindMap(getSkinParam());
|
this.mindmaps.add(new MindMap(getSkinParam()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,7 +90,11 @@ public class MindMapDiagram extends UmlDiagram {
|
||||||
return new TextBlockBackcolored() {
|
return new TextBlockBackcolored() {
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
mindmap.drawU(ug);
|
for (MindMap mindmap : mindmaps) {
|
||||||
|
mindmap.drawU(ug);
|
||||||
|
final Dimension2D dim = mindmap.calculateDimension(ug.getStringBounder());
|
||||||
|
ug = ug.apply(UTranslate.dy(dim.getHeight()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
|
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
|
||||||
|
@ -94,7 +102,14 @@ public class MindMapDiagram extends UmlDiagram {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||||
return mindmap.calculateDimension(stringBounder);
|
double width = 0;
|
||||||
|
double height = 0;
|
||||||
|
for (MindMap mindmap : mindmaps) {
|
||||||
|
final Dimension2D dim = mindmap.calculateDimension(stringBounder);
|
||||||
|
height += dim.getHeight();
|
||||||
|
width = Math.max(width, dim.getWidth());
|
||||||
|
}
|
||||||
|
return new Dimension2DDouble(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinMax getMinMax(StringBounder stringBounder) {
|
public MinMax getMinMax(StringBounder stringBounder) {
|
||||||
|
@ -111,18 +126,28 @@ public class MindMapDiagram extends UmlDiagram {
|
||||||
return addIdea(backColor, level, label, shape, defaultDirection);
|
return addIdea(backColor, level, label, shape, defaultDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MindMap last() {
|
||||||
|
return mindmaps.get(mindmaps.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
public CommandExecutionResult addIdea(HColor backColor, int level, Display label, IdeaShape shape,
|
public CommandExecutionResult addIdea(HColor backColor, int level, Display label, IdeaShape shape,
|
||||||
Direction direction) {
|
Direction direction) {
|
||||||
String stereotype = label.getEndingStereotype();
|
String stereotype = label.getEndingStereotype();
|
||||||
if (stereotype != null) {
|
if (stereotype != null) {
|
||||||
label = label.removeEndingStereotype();
|
label = label.removeEndingStereotype();
|
||||||
}
|
}
|
||||||
return mindmap.addIdeaInternal(stereotype, backColor, level, label, shape, direction);
|
if (last().isFull(level))
|
||||||
|
this.mindmaps.add(new MindMap(getSkinParam()));
|
||||||
|
|
||||||
|
return last().addIdeaInternal(stereotype, backColor, level, label, shape, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandExecutionResult addIdea(String stereotype, HColor backColor, int level, Display label,
|
public CommandExecutionResult addIdea(String stereotype, HColor backColor, int level, Display label,
|
||||||
IdeaShape shape) {
|
IdeaShape shape) {
|
||||||
return mindmap.addIdeaInternal(stereotype, backColor, level, label, shape, defaultDirection);
|
if (last().isFull(level))
|
||||||
|
this.mindmaps.add(new MindMap(getSkinParam()));
|
||||||
|
|
||||||
|
return last().addIdeaInternal(stereotype, backColor, level, label, shape, defaultDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String first;
|
private String first;
|
||||||
|
|
|
@ -228,7 +228,7 @@ public class PicoWebServer implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (system.getTitleDisplay() != null && system.getTitleDisplay().size() == 1) {
|
if (system.getTitleDisplay() != null && system.getTitleDisplay().size() == 1) {
|
||||||
final String encode = URLEncoder.encode(system.getTitleDisplay().toString(), "UTF-8");
|
final String encode = URLEncoder.encode(system.getTitleDisplay().asList().get(0).toString(), "UTF-8");
|
||||||
if (encode.length() < 256)
|
if (encode.length() < 256)
|
||||||
write(out, "X-PlantUML-Diagram-Title: " + encode);
|
write(out, "X-PlantUML-Diagram-Title: " + encode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,10 +140,10 @@ public class SURL {
|
||||||
/**
|
/**
|
||||||
* Create a secure URL from a String.
|
* Create a secure URL from a String.
|
||||||
* <p>
|
* <p>
|
||||||
* The url must be http or https.
|
* The url must be http or https. Return null in case of error or if
|
||||||
* Return null in case of error or if <code>url</code> is null
|
* <code>url</code> is null
|
||||||
*
|
*
|
||||||
* @param url plain url starting by http:// or https//
|
* @param url plain url starting by http:// or https//
|
||||||
* @return the secure URL or null
|
* @return the secure URL or null
|
||||||
*/
|
*/
|
||||||
public static SURL create(String url) {
|
public static SURL create(String url) {
|
||||||
|
@ -165,7 +165,7 @@ public class SURL {
|
||||||
* It takes into account credentials.
|
* It takes into account credentials.
|
||||||
*
|
*
|
||||||
* @param url
|
* @param url
|
||||||
* @return the secure URL
|
* @return the secure URL
|
||||||
* @throws MalformedURLException if <code>url</code> is null
|
* @throws MalformedURLException if <code>url</code> is null
|
||||||
*/
|
*/
|
||||||
public static SURL create(URL url) throws MalformedURLException {
|
public static SURL create(URL url) throws MalformedURLException {
|
||||||
|
@ -252,7 +252,7 @@ public class SURL {
|
||||||
for (String allow : getAllowList())
|
for (String allow : getAllowList())
|
||||||
if (full.startsWith(cleanPath(allow)))
|
if (full.startsWith(cleanPath(allow)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,16 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
|
|
||||||
public class SequenceDiagram extends UmlDiagram {
|
public class SequenceDiagram extends UmlDiagram {
|
||||||
|
|
||||||
|
private boolean hideUnlinkedData;
|
||||||
|
|
||||||
|
public final boolean isHideUnlinkedData() {
|
||||||
|
return hideUnlinkedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setHideUnlinkedData(boolean hideUnlinkedData) {
|
||||||
|
this.hideUnlinkedData = hideUnlinkedData;
|
||||||
|
}
|
||||||
|
|
||||||
private final List<Participant> participantsList = new ArrayList<>();
|
private final List<Participant> participantsList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandFootbox;
|
||||||
import net.sourceforge.plantuml.sequencediagram.command.CommandFootboxOld;
|
import net.sourceforge.plantuml.sequencediagram.command.CommandFootboxOld;
|
||||||
import net.sourceforge.plantuml.sequencediagram.command.CommandGrouping;
|
import net.sourceforge.plantuml.sequencediagram.command.CommandGrouping;
|
||||||
import net.sourceforge.plantuml.sequencediagram.command.CommandHSpace;
|
import net.sourceforge.plantuml.sequencediagram.command.CommandHSpace;
|
||||||
|
import net.sourceforge.plantuml.sequencediagram.command.CommandHideUnlinked;
|
||||||
import net.sourceforge.plantuml.sequencediagram.command.CommandIgnoreNewpage;
|
import net.sourceforge.plantuml.sequencediagram.command.CommandIgnoreNewpage;
|
||||||
import net.sourceforge.plantuml.sequencediagram.command.CommandLinkAnchor;
|
import net.sourceforge.plantuml.sequencediagram.command.CommandLinkAnchor;
|
||||||
import net.sourceforge.plantuml.sequencediagram.command.CommandNewpage;
|
import net.sourceforge.plantuml.sequencediagram.command.CommandNewpage;
|
||||||
|
@ -91,6 +92,7 @@ public class SequenceDiagramFactory extends PSystemCommandFactory {
|
||||||
final List<Command> cmds = new ArrayList<>();
|
final List<Command> cmds = new ArrayList<>();
|
||||||
|
|
||||||
addCommonCommands1(cmds);
|
addCommonCommands1(cmds);
|
||||||
|
cmds.add(new CommandHideUnlinked());
|
||||||
|
|
||||||
cmds.add(new CommandActivate());
|
cmds.add(new CommandActivate());
|
||||||
cmds.add(new CommandDeactivateShort());
|
cmds.add(new CommandDeactivateShort());
|
||||||
|
|
|
@ -33,16 +33,18 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.command;
|
package net.sourceforge.plantuml.sequencediagram.command;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.LineLocation;
|
import net.sourceforge.plantuml.LineLocation;
|
||||||
import net.sourceforge.plantuml.UmlDiagram;
|
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||||
|
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
|
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||||
|
|
||||||
public class CommandHideUnlinked extends SingleLineCommand2<UmlDiagram> {
|
public class CommandHideUnlinked extends SingleLineCommand2<SequenceDiagram> {
|
||||||
|
|
||||||
public CommandHideUnlinked() {
|
public CommandHideUnlinked() {
|
||||||
super(getRegexConcat());
|
super(getRegexConcat());
|
||||||
|
@ -52,12 +54,12 @@ public class CommandHideUnlinked extends SingleLineCommand2<UmlDiagram> {
|
||||||
return RegexConcat.build(CommandHideUnlinked.class.getName(), RegexLeaf.start(), //
|
return RegexConcat.build(CommandHideUnlinked.class.getName(), RegexLeaf.start(), //
|
||||||
new RegexLeaf("HIDE", "(hide|show)"), //
|
new RegexLeaf("HIDE", "(hide|show)"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("unlinked"), //
|
new RegexLeaf("@?unlinked"), //
|
||||||
RegexLeaf.end()); //
|
RegexLeaf.end()); //
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
|
protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
|
||||||
diagram.setHideUnlinkedData(arg.get("HIDE", 0).equalsIgnoreCase("hide"));
|
diagram.setHideUnlinkedData(arg.get("HIDE", 0).equalsIgnoreCase("hide"));
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@ public class Version {
|
||||||
private static final int MAJOR_SEPARATOR = 1000000;
|
private static final int MAJOR_SEPARATOR = 1000000;
|
||||||
|
|
||||||
public static int version() {
|
public static int version() {
|
||||||
return 1202114;
|
return 1202115;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int versionPatched() {
|
public static int versionPatched() {
|
||||||
|
@ -80,7 +80,7 @@ public class Version {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 9;
|
final int beta = 0;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class Version {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long compileTime() {
|
public static long compileTime() {
|
||||||
return 1636735610350L;
|
return 1638290734924L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String compileTimeString() {
|
public static String compileTimeString() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user