From c95bbfe5855c4189150df7ec440ee88236c2eabf Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Wed, 31 May 2023 20:51:54 +0200 Subject: [PATCH] fix: minor issues https://github.com/plantuml/plantuml/issues/1442 https://github.com/plantuml/plantuml/issues/1436 --- gradle.properties | 2 +- .../plantuml/descdiagram/DescriptionDiagram.java | 10 ++++------ .../plantuml/elk/CucaDiagramFileMakerElk.java | 7 +++---- src/net/sourceforge/plantuml/klimt/font/UFont.java | 10 +++++----- .../plantuml/sdot/CucaDiagramFileMakerSmetana.java | 1 + .../sourceforge/plantuml/style/parser/StyleParser.java | 3 +++ src/net/sourceforge/plantuml/version/Version.java | 2 +- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/gradle.properties b/gradle.properties index 570627a5e..f329e3bb0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ # Warning, "version" should be the same in gradle.properties and Version.java # Any idea anyone how to magically synchronize those :-) ? -version = 1.2023.9beta1 +version = 1.2023.9beta2 org.gradle.workers.max = 3 \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java index e8f2f0a4a..f361f0c6f 100644 --- a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java +++ b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java @@ -69,9 +69,9 @@ public class DescriptionDiagram extends AbstractEntityDiagram { for (Entity leaf : getEntityFactory().leafs()) { final LeafType type = leaf.getLeafType(); final USymbol usymbol = leaf.getUSymbol(); - if (type == LeafType.USECASE || usymbol == getSkinParam().actorStyle().toUSymbol()) { + if (type == LeafType.USECASE || usymbol == getSkinParam().actorStyle().toUSymbol()) return true; - } + } return false; } @@ -81,11 +81,9 @@ public class DescriptionDiagram extends AbstractEntityDiagram { super.makeDiagramReady(); final LeafType defaultType = LeafType.DESCRIPTION; final USymbol defaultSymbol = isUsecase() ? getSkinParam().actorStyle().toUSymbol() : USymbols.INTERFACE; - for (Entity leaf : getEntityFactory().leafs()) { - if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) { + for (Entity leaf : getEntityFactory().leafs()) + if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) leaf.muteToType(defaultType, defaultSymbol); - } - } } @Override diff --git a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java index 7b5372ae5..588b96538 100644 --- a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java +++ b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java @@ -421,8 +421,7 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker { } if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) { g.muteToType(LeafType.EMPTY_PACKAGE); - System.err.println("STILL IN PROGRESS"); - // printEntityNew(folder); + manageSingleNode(cluster, g); } else { // We create the "cluster" in ELK for this group @@ -467,14 +466,14 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker { } - private void manageSingleNode(final ElkNode root, Entity leaf) { + private void manageSingleNode(ElkNode parent, Entity leaf) { final IEntityImage image = printEntityInternal(leaf); // Expected dimension of the node final XDimension2D dimension = image.calculateDimension(stringBounder); // Here, we try to tell ELK to use this dimension as node dimension - final ElkNode node = ElkGraphUtil.createNode(root); + final ElkNode node = ElkGraphUtil.createNode(parent); node.setDimensions(dimension.getWidth(), dimension.getHeight()); // There is no real "label" here diff --git a/src/net/sourceforge/plantuml/klimt/font/UFont.java b/src/net/sourceforge/plantuml/klimt/font/UFont.java index 32bbdc0f7..3816fd770 100644 --- a/src/net/sourceforge/plantuml/klimt/font/UFont.java +++ b/src/net/sourceforge/plantuml/klimt/font/UFont.java @@ -81,9 +81,9 @@ public class UFont { private static Font buildFont(String fontFamily, int fontStyle, int fontSize) { if (fontFamily.contains(",")) for (String name : fontFamily.split(",")) { - name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name).trim(); + name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(name.trim()).trim(); if (doesFamilyExists(name)) - return new Font(fontFamily, fontStyle, fontSize); + return new Font(name, fontStyle, fontSize); } @@ -169,10 +169,10 @@ public class UFont { return font.getPSName(); } if (context == UFontContext.SVG) { - if (family.equalsIgnoreCase("sansserif")) - return "sans-serif"; + String result = family.replace('\"', '\''); + result = result.replaceAll("(?i)sansserif", "sans-serif"); - return family; + return result; } return family; } diff --git a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java index 18dda025f..e52a7ae44 100644 --- a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java +++ b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java @@ -307,6 +307,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker { if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) { g.muteToType(LeafType.EMPTY_PACKAGE); + printEntity(g); } else { printSingleGroup(g); } diff --git a/src/net/sourceforge/plantuml/style/parser/StyleParser.java b/src/net/sourceforge/plantuml/style/parser/StyleParser.java index 7efd455cf..0541c8104 100644 --- a/src/net/sourceforge/plantuml/style/parser/StyleParser.java +++ b/src/net/sourceforge/plantuml/style/parser/StyleParser.java @@ -183,6 +183,9 @@ public class StyleParser { result.append(' '); result.append(current.getData()); ins.jump(); + } else if (current.getType() == StyleTokenType.COMMA) { + result.append(current.getData()); + ins.jump(); } else if (current.getType() == StyleTokenType.COLON) { result.append(current.getData()); ins.jump(); diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index bd7aa5803..664779c98 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -46,7 +46,7 @@ public class Version { // Warning, "version" should be the same in gradle.properties and Version.java // Any idea anyone how to magically synchronize those :-) ? - private static final String version = "1.2023.9beta1"; + private static final String version = "1.2023.9beta2"; public static String versionString() { return version;