diff options
Diffstat (limited to 'src/net/sourceforge/plantuml/creole/StripeTree.java')
-rw-r--r-- | src/net/sourceforge/plantuml/creole/StripeTree.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/net/sourceforge/plantuml/creole/StripeTree.java b/src/net/sourceforge/plantuml/creole/StripeTree.java index 161b722..c955720 100644 --- a/src/net/sourceforge/plantuml/creole/StripeTree.java +++ b/src/net/sourceforge/plantuml/creole/StripeTree.java @@ -2,7 +2,7 @@ * PlantUML : a free UML diagram generator * ======================================================================== * - * (C) Copyright 2009-2017, Arnaud Roques + * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: http://plantuml.com * @@ -61,18 +61,38 @@ public class StripeTree implements Stripe { return Collections.<Atom> singletonList(marged); } + public Atom getHeader() { + return null; + } + public void analyzeAndAdd(String line) { final List<String> lines = StripeTable.getWithNewlinesInternal(line); for (String s : lines) { final StripeSimple cell = new StripeSimple(fontConfiguration, stripeStyle, new CreoleContext(), skinParam, CreoleMode.FULL); - // EMTEC final String text = s.replaceFirst("^\\s*\\|_", ""); - final int level = (s.length() - text.length()) / 2; + final int level = computeLevel(s); cell.analyzeAndAdd(text); this.tree.addCell(StripeTable.asAtom(Collections.singletonList(cell), 0), level); } } + private int computeLevel(String s) { + int result = 1; + while (s.length() > 0) { + if (s.startsWith(" ")) { + result++; + s = s.substring(2); + continue; + } else if (s.startsWith("\t")) { + result++; + s = s.substring(1); + continue; + } + return result; + } + return result; + } + } |