bugfix:
markdown rendering glitched when several @startuml…@enduml sections were present in one document Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -35,7 +35,7 @@ import org.json.JSONObject;
|
|||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
public static final System.Logger LOG = System.getLogger("Util");
|
public static final System.Logger LOG = System.getLogger("Util");
|
||||||
private static final Pattern UML_PATTERN = Pattern.compile("@start(\\w+)(.*)@end(\\1)",Pattern.DOTALL);
|
private static final Pattern UML_PATTERN = Pattern.compile("@start(\\w+)(.*?)@end(\\1)",Pattern.DOTALL);
|
||||||
private static File plantumlJar = null;
|
private static File plantumlJar = null;
|
||||||
private static final JParsedown MARKDOWN = new JParsedown();
|
private static final JParsedown MARKDOWN = new JParsedown();
|
||||||
public static final String SHA1 = "SHA-1";
|
public static final String SHA1 = "SHA-1";
|
||||||
@@ -79,7 +79,7 @@ public class Util {
|
|||||||
try {
|
try {
|
||||||
if (plantumlJar != null && plantumlJar.exists()) {
|
if (plantumlJar != null && plantumlJar.exists()) {
|
||||||
var matcher = UML_PATTERN.matcher(source);
|
var matcher = UML_PATTERN.matcher(source);
|
||||||
if (matcher.find()) {
|
while (matcher.find()) {
|
||||||
var uml = matcher.group(0).trim();
|
var uml = matcher.group(0).trim();
|
||||||
var start = matcher.start(0);
|
var start = matcher.start(0);
|
||||||
var end = matcher.end(0);
|
var end = matcher.end(0);
|
||||||
@@ -96,6 +96,7 @@ public class Util {
|
|||||||
byte[] out = is.readAllBytes();
|
byte[] out = is.readAllBytes();
|
||||||
var svg = new String(out, UTF_8);
|
var svg = new String(out, UTF_8);
|
||||||
source = source.substring(0, start) + svg + source.substring(end);
|
source = source.substring(0, start) + svg + source.substring(end);
|
||||||
|
matcher = UML_PATTERN.matcher(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user