From 69bc6c2ae35883286d9c2b8cc77d5fa0a8c37351 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 26 Jul 2018 11:34:06 +0200 Subject: Kotlin rewrite, adding diagram options --- build.gradle | 27 ++++++- readme.md | 35 ++++++--- .../org/pacien/pandoc/filter/plantuml/Filter.java | 84 ---------------------- .../org/pacien/pandoc/filter/plantuml/Filter.kt | 57 +++++++++++++++ .../org/pacien/pandoc/filter/plantuml/Latex.kt | 16 +++++ .../org/pacien/pandoc/filter/plantuml/Main.kt | 5 ++ .../pacien/pandoc/filter/plantuml/PandocNode.kt | 30 ++++++++ .../org/pacien/pandoc/filter/plantuml/PlantUml.kt | 21 ++++++ .../pacien/pandoc/filter/plantuml/FilterTest.java | 27 ------- .../pacien/pandoc/filter/plantuml/FilterTest.kt | 39 ++++++++++ src/test/resources/attributes.expected.json | 1 + src/test/resources/attributes.input.json | 1 + src/test/resources/expected.json | 1 - src/test/resources/identifyblock.expected.json | 1 + src/test/resources/identifyblock.input.json | 1 + src/test/resources/input.json | 1 - src/test/resources/resize.expected.json | 1 + src/test/resources/resize.input.json | 1 + 18 files changed, 225 insertions(+), 124 deletions(-) delete mode 100644 src/main/java/org/pacien/pandoc/filter/plantuml/Filter.java create mode 100644 src/main/kotlin/org/pacien/pandoc/filter/plantuml/Filter.kt create mode 100644 src/main/kotlin/org/pacien/pandoc/filter/plantuml/Latex.kt create mode 100644 src/main/kotlin/org/pacien/pandoc/filter/plantuml/Main.kt create mode 100644 src/main/kotlin/org/pacien/pandoc/filter/plantuml/PandocNode.kt create mode 100644 src/main/kotlin/org/pacien/pandoc/filter/plantuml/PlantUml.kt delete mode 100644 src/test/java/org/pacien/pandoc/filter/plantuml/FilterTest.java create mode 100644 src/test/kotlin/org/pacien/pandoc/filter/plantuml/FilterTest.kt create mode 100644 src/test/resources/attributes.expected.json create mode 100644 src/test/resources/attributes.input.json delete mode 100644 src/test/resources/expected.json create mode 100644 src/test/resources/identifyblock.expected.json create mode 100644 src/test/resources/identifyblock.input.json delete mode 100644 src/test/resources/input.json create mode 100644 src/test/resources/resize.expected.json create mode 100644 src/test/resources/resize.input.json diff --git a/build.gradle b/build.gradle index f6a0a4f..c7a64f4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ group 'org.pacien.pandoc.filter.plantuml' version '1.0-SNAPSHOT' -apply plugin: 'java' +apply plugin: 'kotlin' sourceCompatibility = 1.8 jar { manifest { - attributes 'Main-Class': 'org.pacien.pandoc.filter.plantuml.Filter' + attributes 'Main-Class': 'org.pacien.pandoc.filter.plantuml.MainKt' } from { @@ -23,4 +23,27 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.6' compile group: 'net.sourceforge.plantuml', name: 'plantuml', version: '8059' + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" +} + +buildscript { + ext.kotlin_version = '1.2.51' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +compileKotlin { + kotlinOptions { + jvmTarget = "1.8" + } +} + +compileTestKotlin { + kotlinOptions { + jvmTarget = "1.8" + } } diff --git a/readme.md b/readme.md index 015e375..c139337 100644 --- a/readme.md +++ b/readme.md @@ -3,34 +3,38 @@ pandoc-filter-plantuml A Pandoc AST filter rendering PlantUML code blocks into vector diagrams. -This filter produces TikZ code that must then be rendered using another filter such as -[tikz.py][tikz]. +This filter produces TikZ code that can be rendered as vector diagrams in PDF documents, +or as raster graphics by using another filter such as [tikz.py][tikz]. -Usage ------ +Example +------- A PlantUML diagram in an example Pandoc Markdown file `example.md`: - ```puml + --- + header-includes: \usepackage{tikz} + --- + + ```{.puml .centered caption="Courtesy protocol" width=\columnwidth} @startuml Bob->Alice : hello + Alice->Bob : hi @enduml ``` -Using the helper scripts [tikz.py][tikz] and `pandoc-filter-plantuml.sh`: +Using the helper scripts `pandoc-filter-plantuml.sh`: #/bin/sh java -jar pandoc-filter-plantuml.jar <&0 -Can be rendered and included as a vector resource in a PDF by running: +Can be rendered as a vector resource in a PDF by running: % pandoc --filter=pandoc-filter-plantuml.sh \ - --filter=tikz.py \ --output=example.pdf \ example.md -Or as an image in an HTML document with the following command: +Or as a raster image using [tikz.py][tikz] in an HTML document with the following command: % pandoc --filter=pandoc-filter-plantuml.sh \ --filter=tikz.py \ @@ -38,6 +42,18 @@ Or as an image in an HTML document with the following command: example.md +Options +------- + +The following rendering options can be supplied as [fenced code attributes][fenced_code_attribute]: + +* `.centered`: centers the diagram horizontally on the page +* `caption="Some caption"`: adds a figure caption below the diagram +* `label="somelabel`: adds a label to the figure +* `width=\columnwidth` and `height=100pt`: resize the diagram using the `\resizebox` command, + keeping the aspect ration of only one of the two is given + + Build ----- @@ -54,3 +70,4 @@ See /license.txt [tikz]: https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py +[fenced_code_attribute]: http://pandoc.org/MANUAL.html#fenced-code-blocks diff --git a/src/main/java/org/pacien/pandoc/filter/plantuml/Filter.java b/src/main/java/org/pacien/pandoc/filter/plantuml/Filter.java deleted file mode 100644 index 66abc2d..0000000 --- a/src/main/java/org/pacien/pandoc/filter/plantuml/Filter.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.pacien.pandoc.filter.plantuml; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.node.TextNode; -import net.sourceforge.plantuml.FileFormat; -import net.sourceforge.plantuml.FileFormatOption; -import net.sourceforge.plantuml.SourceStringReader; - -import java.io.*; -import java.util.Iterator; -import java.util.stream.Collectors; - -final public class Filter { - - private static final String BEGIN_TAG = "\\begin{tikzpicture}[yscale=-1]"; - private static final String LINE_SEP = "\n"; - private static final String TYPE_KEY = "t"; - private static final String CONTENT_KEY = "c"; - private static final String CODE_BLOCK_TYPE = "CodeBlock"; - private static final String RAW_BLOCK_TYPE = "RawBlock"; - private static final String PLANTUML_TYPE = "puml"; - private static final String LATEX_TYPE = "latex"; - private static final int META_INDEX = 0; - private static final int META_PROP_INDEX = 1; - private static final int META_PROP_TYPE_INDEX = 0; - private static final int CONTENT_INDEX = 1; - - private static String plantumlToLatex(String puml) throws IOException { - try (ByteArrayOutputStream s = new ByteArrayOutputStream()) { - new SourceStringReader(puml).generateImage(s, new FileFormatOption(FileFormat.LATEX_NO_PREAMBLE)); - try (BufferedReader r = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(s.toByteArray())))) { - return BEGIN_TAG + LINE_SEP + r.lines().filter(l -> !l.equals(BEGIN_TAG)).collect(Collectors.joining(LINE_SEP)); - } - } - } - - private static void renderPlantumlNode(ObjectNode n) throws IOException { - String puml = n.get(CONTENT_KEY).get(CONTENT_INDEX).asText(); - String tikz = plantumlToLatex(puml); - - n.set(TYPE_KEY, TextNode.valueOf(RAW_BLOCK_TYPE)); - ((ArrayNode) n.get(CONTENT_KEY)).removeAll() - .add(TextNode.valueOf(LATEX_TYPE)) - .add(TextNode.valueOf(tikz)); - } - - private static boolean isPlantumlNode(JsonNode n) { - return n.path(TYPE_KEY).asText().equals(CODE_BLOCK_TYPE) && - n.path(CONTENT_KEY).path(META_INDEX).path(META_PROP_INDEX).path(META_PROP_TYPE_INDEX).asText().equals(PLANTUML_TYPE); - } - - private static void walk(JsonNode n) throws IOException { - if (isPlantumlNode(n)) - renderPlantumlNode((ObjectNode) n); - else if (n.isContainerNode()) - for (Iterator i = n.elements(); i.hasNext(); ) walk(i.next()); - } - - public static void filter(InputStream i, OutputStream o) throws IOException { - ObjectMapper m = new ObjectMapper(); - JsonNode t = m.readTree(i); - if (t != null) { - walk(t); - m.writeValue(o, t); - } - } - - public static void main(String args[]) { - try { - filter(System.in, System.out); - } catch (IOException e) { - e.printStackTrace(); - System.exit(1); - } - } - - private Filter() { - // static class - } - -} diff --git a/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Filter.kt b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Filter.kt new file mode 100644 index 0000000..82a78b5 --- /dev/null +++ b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Filter.kt @@ -0,0 +1,57 @@ +package org.pacien.pandoc.filter.plantuml + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.node.ArrayNode +import com.fasterxml.jackson.databind.node.ObjectNode +import com.fasterxml.jackson.databind.node.TextNode +import java.io.InputStream +import java.io.OutputStream + +object Filter { + private val mapper = ObjectMapper() + + private inline fun T.conditionally(condition: Boolean, block: (T) -> T): T = + if (condition) block(this) else this + + private inline fun T.withNonNull(value: A?, block: (T, A) -> T): T = + if (value != null) block(this, value) else this + + private fun JsonNode.isCodeBlock() = type() == "CodeBlock" + private fun JsonNode.isPlantUmlBlock() = isCodeBlock() && "puml" in classNames() + + private fun Latex.resizeBox(attrs: Map) = + resizeBox(attrs["width"] ?: "!", attrs["height"] ?: "!") + + private fun Latex.setOptions(classes: List, attrs: Map) = + this + .conditionally("width" in attrs || "height" in attrs) { it -> it.resizeBox(attrs) } + .conditionally("centered" in classes, Latex::centering) + .withNonNull(attrs["caption"], Latex::caption) + .withNonNull(attrs["label"], Latex::label) + .conditionally("caption" in attrs || "label" in attrs, Latex::figure) + + private fun arrayNodeOf(type: String, content: String): ArrayNode = + mapper.createArrayNode() + .add(TextNode.valueOf(type)) + .add(TextNode.valueOf(content)) + + private fun renderPlantumlNode(node: ObjectNode) { + val puml = node.content() + val tikz = PlantUml.renderTikz(puml) + val block = tikz.setOptions(node.classNames(), node.attributeMap()) + node.setBlock("RawBlock", arrayNodeOf("latex", block.raw())) + } + + private fun walk(node: JsonNode): Unit = when { + node.isPlantUmlBlock() -> renderPlantumlNode(node as ObjectNode) + else -> node.forEach(Filter::walk) + } + + fun filter(input: InputStream, output: OutputStream) { + mapper.readTree(input)?.let { tree -> + walk(tree) + mapper.writeValue(output, tree) + } + } +} diff --git a/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Latex.kt b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Latex.kt new file mode 100644 index 0000000..48ce087 --- /dev/null +++ b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Latex.kt @@ -0,0 +1,16 @@ +package org.pacien.pandoc.filter.plantuml + +fun Sequence.toLatex() = Latex(this) + +class Latex(private val body: Sequence) { + fun raw() = body.filterNot(String::isEmpty).joinToString("\n") + + private fun surround(prefix: String, suffix: String) = + Latex(sequenceOf(prefix) + body + sequenceOf(suffix)) + + fun resizeBox(width: String, height: String) = surround("\\resizebox{$width}{$height}{", "}") + fun centering() = surround("\\centering", "") + fun label(label: String) = surround("", "\\label{$label}") + fun caption(caption: String) = surround("", "\\caption{$caption}") + fun figure() = surround("\\begin{figure}[h]", "\\end{figure}") +} diff --git a/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Main.kt b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Main.kt new file mode 100644 index 0000000..1ebe8f9 --- /dev/null +++ b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/Main.kt @@ -0,0 +1,5 @@ +package org.pacien.pandoc.filter.plantuml + +fun main(args: Array) { + Filter.filter(System.`in`, System.out) +} diff --git a/src/main/kotlin/org/pacien/pandoc/filter/plantuml/PandocNode.kt b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/PandocNode.kt new file mode 100644 index 0000000..8b3ddde --- /dev/null +++ b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/PandocNode.kt @@ -0,0 +1,30 @@ +package org.pacien.pandoc.filter.plantuml + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.ObjectNode +import com.fasterxml.jackson.databind.node.TextNode + +// Structure of a content node: +// { +// "t": "CodeBlock", +// "c": [ +// [ +// "", +// [ "puml", "otherClass" ], +// [ ["scale", "0.5"], ["key", "value"] ] +// ], +// "@startuml\n@enduml" +// ] +// } + +fun JsonNode.type(): String = path("t").asText() +fun JsonNode.classes(): JsonNode = path("c").path(0).path(1) +fun JsonNode.classNames(): List = classes().map(JsonNode::asText) +fun JsonNode.attributes(): JsonNode = path("c").path(0).path(2) +fun JsonNode.attributePair(): Pair = Pair(path(0).asText(), path(1).asText()) +fun JsonNode.attributeMap(): Map = attributes().associate(JsonNode::attributePair) +fun JsonNode.content(): String = path("c").path(1).asText() + +fun ObjectNode.setBlockType(type: String) = apply { set("t", TextNode.valueOf(type)) } +fun ObjectNode.setBlockContent(content: JsonNode) = apply { set("c", content) } +fun ObjectNode.setBlock(type: String, content: JsonNode) = setBlockType(type).setBlockContent(content) diff --git a/src/main/kotlin/org/pacien/pandoc/filter/plantuml/PlantUml.kt b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/PlantUml.kt new file mode 100644 index 0000000..2a8da1b --- /dev/null +++ b/src/main/kotlin/org/pacien/pandoc/filter/plantuml/PlantUml.kt @@ -0,0 +1,21 @@ +package org.pacien.pandoc.filter.plantuml + +import net.sourceforge.plantuml.FileFormat +import net.sourceforge.plantuml.FileFormatOption +import net.sourceforge.plantuml.SourceStringReader +import java.io.ByteArrayOutputStream + +object PlantUml { + private val OUTPUT_FORMAT = FileFormatOption(FileFormat.LATEX_NO_PREAMBLE) + + private fun SourceStringReader.generateImage(outputFormat: FileFormatOption) = + ByteArrayOutputStream().use { buffer -> + generateImage(buffer, outputFormat) + buffer.toString().lineSequence() + } + + fun renderTikz(plantuml: String) = + SourceStringReader(plantuml) + .generateImage(OUTPUT_FORMAT) + .toLatex() +} diff --git a/src/test/java/org/pacien/pandoc/filter/plantuml/FilterTest.java b/src/test/java/org/pacien/pandoc/filter/plantuml/FilterTest.java deleted file mode 100644 index f720b22..0000000 --- a/src/test/java/org/pacien/pandoc/filter/plantuml/FilterTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.pacien.pandoc.filter.plantuml; - -import org.junit.Assert; -import org.junit.Test; - -import java.io.*; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; - -final public class FilterTest { - - private static final String INPUT_FILE = "/input.json"; - private static final String EXPECTED_FILE = "/expected.json"; - - @Test - public void filterTest() { - try (ByteArrayOutputStream o = new ByteArrayOutputStream()) { - byte[] e = Files.readAllBytes(Paths.get(getClass().getResource(EXPECTED_FILE).toURI())); - Filter.filter(getClass().getResourceAsStream(INPUT_FILE), o); - Assert.assertArrayEquals(o.toByteArray(), e); - } catch (IOException | URISyntaxException e) { - Assert.fail(); - } - } - -} diff --git a/src/test/kotlin/org/pacien/pandoc/filter/plantuml/FilterTest.kt b/src/test/kotlin/org/pacien/pandoc/filter/plantuml/FilterTest.kt new file mode 100644 index 0000000..4ec183b --- /dev/null +++ b/src/test/kotlin/org/pacien/pandoc/filter/plantuml/FilterTest.kt @@ -0,0 +1,39 @@ +package org.pacien.pandoc.filter.plantuml + +import org.junit.Assert +import org.junit.Test + +import java.io.* +import java.nio.file.Files +import java.nio.file.Paths + +class FilterTest { + private fun testCompare(inputResource: String, expectedOutputResource: String) { + val inputStream = javaClass.getResourceAsStream(inputResource) + val expectedOutputFilePath = Paths.get(javaClass.getResource(expectedOutputResource).toURI()) + val expectedOutput = Files.readAllBytes(expectedOutputFilePath) + + ByteArrayOutputStream().use { outputStream -> + Filter.filter(inputStream, outputStream) + Assert.assertArrayEquals(outputStream.toByteArray(), expectedOutput) + } + } + + /** + * Should only replace the PlantUML code block and leave other ones untouched. + */ + @Test fun testIdentifyBlock() = + testCompare("/identifyblock.input.json", "/identifyblock.expected.json") + + /** + * Figure should be centered with a caption and a label. + */ + @Test fun testAttributes() = + testCompare("/attributes.input.json", "/attributes.expected.json") + + /** + * Large figure should be scaled down to column width, keeping its aspect ratio. + */ + @Test fun testResize() = + testCompare("/resize.input.json", "/resize.expected.json") +} diff --git a/src/test/resources/attributes.expected.json b/src/test/resources/attributes.expected.json new file mode 100644 index 0000000..aba4f70 --- /dev/null +++ b/src/test/resources/attributes.expected.json @@ -0,0 +1 @@ +{"blocks":[{"t":"RawBlock","c":["latex","\\begin{figure}[h]\n\\centering\n% generated by Plantuml 8059 \n\\definecolor{plantucolor0000}{RGB}{168,0,54}\n\\definecolor{plantucolor0001}{RGB}{255,0,0}\n\\definecolor{plantucolor0002}{RGB}{254,254,206}\n\\definecolor{plantucolor0003}{RGB}{153,255,153}\n\\begin{tikzpicture}[yscale=-1]\n\\draw[color=plantucolor0000,line width=1.0pt,dash pattern=on 5.0pt off 5.0pt] (25pt,86.2969pt) -- (25pt,193.6953pt);\n\\draw[color=plantucolor0000,line width=1.0pt,dash pattern=on 5.0pt off 5.0pt] (208pt,86.2969pt) -- (208pt,193.6953pt);\n\\draw[color=plantucolor0000,line width=1.0pt,dash pattern=on 5.0pt off 5.0pt] (297pt,86.2969pt) -- (297pt,193.6953pt);\n\\node at (8pt,70pt)[below right]{Bob};\n\\draw[color=plantucolor0000,fill=plantucolor0001,line width=2.0pt] (25pt,13pt) ellipse (8pt and 8pt);\n\\draw[color=plantucolor0000,line width=2.0pt] (25pt,21pt) -- (25pt,48pt)(12pt,29pt) -- (38pt,29pt)(25pt,48pt) -- (12pt,63pt)(25pt,48pt) -- (38pt,63pt);\n\\node at (8pt,192.6953pt)[below right]{Bob};\n\\draw[color=plantucolor0000,fill=plantucolor0001,line width=2.0pt] (25pt,218.9922pt) ellipse (8pt and 8pt);\n\\draw[color=plantucolor0000,line width=2.0pt] (25pt,226.9922pt) -- (25pt,253.9922pt)(12pt,234.9922pt) -- (38pt,234.9922pt)(25pt,253.9922pt) -- (12pt,268.9922pt)(25pt,253.9922pt) -- (38pt,268.9922pt);\n\\draw[color=plantucolor0000,fill=plantucolor0002,line width=1.5pt] (183pt,51pt) rectangle (229pt,81.2969pt);\n\\node at (190pt,58pt)[below right]{Alice};\n\\draw[color=plantucolor0000,fill=plantucolor0002,line width=1.5pt] (183pt,192.6953pt) rectangle (229pt,222.9922pt);\n\\node at (190pt,199.6953pt)[below right]{Alice};\n\\draw[color=plantucolor0000,fill=plantucolor0003,line width=1.5pt] (243pt,34.7031pt) rectangle (348pt,81.2969pt);\n\\node at (250pt,41.7031pt)[below right]{I have a really};\n\\node at (259pt,58pt)[below right]{long name};\n\\draw[color=plantucolor0000,fill=plantucolor0003,line width=1.5pt] (243pt,192.6953pt) rectangle (348pt,239.2891pt);\n\\node at (250pt,199.6953pt)[below right]{I have a really};\n\\node at (259pt,215.9922pt)[below right]{long name};\n\\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (36pt,113.2969pt) -- (26pt,117.2969pt) -- (36pt,121.2969pt) -- (32pt,117.2969pt) -- cycle;\n\\draw[color=plantucolor0000,line width=1.0pt] (30pt,117.2969pt) -- (207pt,117.2969pt);\n\\node at (42pt,100.2969pt)[below right]{Authentication Request};\n\\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (196pt,142.4297pt) -- (206pt,146.4297pt) -- (196pt,150.4297pt) -- (200pt,146.4297pt) -- cycle;\n\\draw[color=plantucolor0000,line width=1.0pt] (25pt,146.4297pt) -- (202pt,146.4297pt);\n\\node at (32pt,129.4297pt)[below right]{Authentication Response};\n\\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (285.5pt,171.5625pt) -- (295.5pt,175.5625pt) -- (285.5pt,179.5625pt) -- (289.5pt,175.5625pt) -- cycle;\n\\draw[color=plantucolor0000,line width=1.0pt] (25pt,175.5625pt) -- (291.5pt,175.5625pt);\n\\node at (32pt,158.5625pt)[below right]{Log transaction};\n\\end{tikzpicture}\n\\caption{Some caption}\n\\end{figure}"]}],"pandoc-api-version":[1,17,5,1],"meta":{"header-includes":{"t":"MetaBlocks","c":[{"t":"RawBlock","c":["latex","\\usepackage{tikz}"]}]}}} \ No newline at end of file diff --git a/src/test/resources/attributes.input.json b/src/test/resources/attributes.input.json new file mode 100644 index 0000000..b367d72 --- /dev/null +++ b/src/test/resources/attributes.input.json @@ -0,0 +1 @@ +{"blocks":[{"t":"CodeBlock","c":[["",["puml","centered"],[["caption","Some caption"],["lable","somelabel"]]],"@startuml\nactor Bob #red\n' The only difference between actor\n'and participant is the drawing\nparticipant Alice\nparticipant \"I have a really\\nlong name\" as L #99FF99\n/' You can also declare:\n participant L as \"I have a really\\nlong name\" #99FF99\n '/\n\nAlice->Bob: Authentication Request\nBob->Alice: Authentication Response\nBob->L: Log transaction\n@enduml"]}],"pandoc-api-version":[1,17,5,1],"meta":{"header-includes":{"t":"MetaBlocks","c":[{"t":"RawBlock","c":["latex","\\usepackage{tikz}"]}]}}} diff --git a/src/test/resources/expected.json b/src/test/resources/expected.json deleted file mode 100644 index 7131399..0000000 --- a/src/test/resources/expected.json +++ /dev/null @@ -1 +0,0 @@ -[{"unMeta":{}},[{"t":"Header","c":[1,["test-document",[],[]],[{"t":"Str","c":"Test"},{"t":"Space","c":[]},{"t":"Str","c":"document"}]]},{"t":"Para","c":[{"t":"Str","c":"This"},{"t":"Space","c":[]},{"t":"Str","c":"paragraph"},{"t":"Space","c":[]},{"t":"Str","c":"should"},{"t":"Space","c":[]},{"t":"Str","c":"be"},{"t":"Space","c":[]},{"t":"Str","c":"left"},{"t":"Space","c":[]},{"t":"Str","c":"as"},{"t":"Space","c":[]},{"t":"Str","c":"is"},{"t":"Space","c":[]},{"t":"Str","c":"by"},{"t":"Space","c":[]},{"t":"Str","c":"the"},{"t":"Space","c":[]},{"t":"Str","c":"filter."}]},{"t":"CodeBlock","c":[["",[],[]],"This generic code block too.\nOnly PlantUML code blocks should be rendered."]},{"t":"RawBlock","c":["latex","\\begin{tikzpicture}[yscale=-1]\n% generated by Plantuml 8059 \n\\definecolor{plantucolor0000}{RGB}{254,254,206}\n\\definecolor{plantucolor0001}{RGB}{168,0,54}\n\\definecolor{plantucolor0002}{RGB}{173,209,178}\n\\definecolor{plantucolor0003}{RGB}{0,0,0}\n\\definecolor{plantucolor0004}{RGB}{0,0,255}\n\\draw[color=plantucolor0001,fill=plantucolor0000,line width=1.5pt] (87pt,8pt) rectangle (186pt,68.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0002,line width=1.0pt] (102pt,24pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (104.9688pt,29.6406pt) ..controls (104.3906pt,29.9375pt) .. (103.75pt,30.0859pt) ..controls (103.1094pt,30.2344pt) .. (102.4063pt,30.2344pt) ..controls (99.9063pt,30.2344pt) .. (98.5859pt,28.5859pt) ..controls (97.2656pt,26.9375pt) .. (97.2656pt,23.8125pt) ..controls (97.2656pt,20.6875pt) .. (98.5859pt,19.0313pt) ..controls (99.9063pt,17.375pt) .. (102.4063pt,17.375pt) ..controls (103.1094pt,17.375pt) .. (103.7578pt,17.5313pt) ..controls (104.4063pt,17.6875pt) .. (104.9688pt,17.9844pt) -- (104.9688pt,20.7031pt) ..controls (104.3438pt,20.125pt) .. (103.75pt,19.8516pt) ..controls (103.1563pt,19.5781pt) .. (102.5313pt,19.5781pt) ..controls (101.1875pt,19.5781pt) .. (100.5pt,20.6484pt) ..controls (99.8125pt,21.7188pt) .. (99.8125pt,23.8125pt) ..controls (99.8125pt,25.9063pt) .. (100.5pt,26.9766pt) ..controls (101.1875pt,28.0469pt) .. (102.5313pt,28.0469pt) ..controls (103.1563pt,28.0469pt) .. (103.75pt,27.7734pt) ..controls (104.3438pt,27.5pt) .. (104.9688pt,26.9219pt) -- (104.9688pt,29.6406pt);\n\\node at (116pt,17.0156pt)[below right]{Subscriber};\n\\draw[color=plantucolor0001,line width=1.5pt] (88pt,40pt) -- (185pt,40pt);\n\\node at (93pt,44pt)[below right]{subscriberId};\n\\draw[color=plantucolor0001,line width=1.5pt] (88pt,60.8047pt) -- (185pt,60.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0000,line width=1.5pt] (6pt,148pt) rectangle (119pt,208.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0002,line width=1.0pt] (21pt,164pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (23.9688pt,169.6406pt) ..controls (23.3906pt,169.9375pt) .. (22.75pt,170.0859pt) ..controls (22.1094pt,170.2344pt) .. (21.4063pt,170.2344pt) ..controls (18.9063pt,170.2344pt) .. (17.5859pt,168.5859pt) ..controls (16.2656pt,166.9375pt) .. (16.2656pt,163.8125pt) ..controls (16.2656pt,160.6875pt) .. (17.5859pt,159.0313pt) ..controls (18.9063pt,157.375pt) .. (21.4063pt,157.375pt) ..controls (22.1094pt,157.375pt) .. (22.7578pt,157.5313pt) ..controls (23.4063pt,157.6875pt) .. (23.9688pt,157.9844pt) -- (23.9688pt,160.7031pt) ..controls (23.3438pt,160.125pt) .. (22.75pt,159.8516pt) ..controls (22.1563pt,159.5781pt) .. (21.5313pt,159.5781pt) ..controls (20.1875pt,159.5781pt) .. (19.5pt,160.6484pt) ..controls (18.8125pt,161.7188pt) .. (18.8125pt,163.8125pt) ..controls (18.8125pt,165.9063pt) .. (19.5pt,166.9766pt) ..controls (20.1875pt,168.0469pt) .. (21.5313pt,168.0469pt) ..controls (22.1563pt,168.0469pt) .. (22.75pt,167.7734pt) ..controls (23.3438pt,167.5pt) .. (23.9688pt,166.9219pt) -- (23.9688pt,169.6406pt);\n\\node at (35pt,157.0156pt)[below right]{AccumUsage};\n\\draw[color=plantucolor0001,line width=1.5pt] (7pt,180pt) -- (118pt,180pt);\n\\node at (12pt,184pt)[below right]{subscriberId};\n\\draw[color=plantucolor0001,line width=1.5pt] (7pt,200.8047pt) -- (118pt,200.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0000,line width=1.5pt] (154pt,129pt) rectangle (267pt,228.2188pt);\n\\draw[color=plantucolor0001,fill=plantucolor0002,line width=1.0pt] (178.45pt,145pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (181.4188pt,150.6406pt) ..controls (180.8406pt,150.9375pt) .. (180.2pt,151.0859pt) ..controls (179.5594pt,151.2344pt) .. (178.8563pt,151.2344pt) ..controls (176.3563pt,151.2344pt) .. (175.0359pt,149.5859pt) ..controls (173.7156pt,147.9375pt) .. (173.7156pt,144.8125pt) ..controls (173.7156pt,141.6875pt) .. (175.0359pt,140.0313pt) ..controls (176.3563pt,138.375pt) .. (178.8563pt,138.375pt) ..controls (179.5594pt,138.375pt) .. (180.2078pt,138.5313pt) ..controls (180.8563pt,138.6875pt) .. (181.4188pt,138.9844pt) -- (181.4188pt,141.7031pt) ..controls (180.7938pt,141.125pt) .. (180.2pt,140.8516pt) ..controls (179.6063pt,140.5781pt) .. (178.9813pt,140.5781pt) ..controls (177.6375pt,140.5781pt) .. (176.95pt,141.6484pt) ..controls (176.2625pt,142.7188pt) .. (176.2625pt,144.8125pt) ..controls (176.2625pt,146.9063pt) .. (176.95pt,147.9766pt) ..controls (177.6375pt,149.0469pt) .. (178.9813pt,149.0469pt) ..controls (179.6063pt,149.0469pt) .. (180.2pt,148.7734pt) ..controls (180.7938pt,148.5pt) .. (181.4188pt,147.9219pt) -- (181.4188pt,150.6406pt);\n\\node at (194.55pt,138.0156pt)[below right]{IpSession};\n\\draw[color=plantucolor0001,line width=1.5pt] (155pt,161pt) -- (266pt,161pt);\n\\node at (160pt,165pt)[below right]{ipAddress};\n\\node at (160pt,177.8047pt)[below right]{specificData};\n\\node at (160pt,190.6094pt)[below right]{sapcOriginStateId};\n\\node at (160pt,203.4141pt)[below right]{apnId};\n\\draw[color=plantucolor0001,line width=1.5pt] (155pt,220.2188pt) -- (266pt,220.2188pt);\n\\draw[color=plantucolor0004,line width=1.0pt] (152.375pt,69.104pt) ..controls (160.988pt,85.167pt) and (171.898pt,105.512pt) .. (181.933pt,124.227pt);\n\\draw[color=plantucolor0004,fill=plantucolor0004,line width=1.0pt] (184.464pt,128.9464pt) -- (183.7353pt,119.1245pt) -- (182.1008pt,124.5401pt) -- (176.6853pt,122.9056pt) -- (184.464pt,128.9464pt) -- cycle;\n\\node at (146.8242pt,76.9968pt)[below right]{1};\n\\node at (156.1855pt,105.9167pt)[below right]{1..*};\n\\draw[color=plantucolor0001,line width=1.0pt] (120.625pt,69.104pt) ..controls (108.92pt,90.933pt) and (92.9726pt,120.673pt) .. (80.7427pt,143.4799pt);\n\\draw[color=plantucolor0001,fill=plantucolor0001,line width=1.0pt] (78.3486pt,147.9445pt) -- (86.1271pt,141.9034pt) -- (80.7116pt,143.5381pt) -- (79.0769pt,138.1226pt) -- (78.3486pt,147.9445pt) -- cycle;\n\\node at (108.5258pt,76.9968pt)[below right]{1};\n\\node at (55.1905pt,124.6557pt)[below right]{0..1};\n\\end{tikzpicture}"]}]] \ No newline at end of file diff --git a/src/test/resources/identifyblock.expected.json b/src/test/resources/identifyblock.expected.json new file mode 100644 index 0000000..cff87e2 --- /dev/null +++ b/src/test/resources/identifyblock.expected.json @@ -0,0 +1 @@ +[{"unMeta":{}},[{"t":"Header","c":[1,["test-document",[],[]],[{"t":"Str","c":"Test"},{"t":"Space","c":[]},{"t":"Str","c":"document"}]]},{"t":"Para","c":[{"t":"Str","c":"This"},{"t":"Space","c":[]},{"t":"Str","c":"paragraph"},{"t":"Space","c":[]},{"t":"Str","c":"should"},{"t":"Space","c":[]},{"t":"Str","c":"be"},{"t":"Space","c":[]},{"t":"Str","c":"left"},{"t":"Space","c":[]},{"t":"Str","c":"as"},{"t":"Space","c":[]},{"t":"Str","c":"is"},{"t":"Space","c":[]},{"t":"Str","c":"by"},{"t":"Space","c":[]},{"t":"Str","c":"the"},{"t":"Space","c":[]},{"t":"Str","c":"filter."}]},{"t":"CodeBlock","c":[["",[],[]],"This generic code block too.\nOnly PlantUML code blocks should be rendered."]},{"t":"RawBlock","c":["latex","% generated by Plantuml 8059 \n\\definecolor{plantucolor0000}{RGB}{254,254,206}\n\\definecolor{plantucolor0001}{RGB}{168,0,54}\n\\definecolor{plantucolor0002}{RGB}{173,209,178}\n\\definecolor{plantucolor0003}{RGB}{0,0,0}\n\\definecolor{plantucolor0004}{RGB}{0,0,255}\n\\begin{tikzpicture}[yscale=-1]\n\\draw[color=plantucolor0001,fill=plantucolor0000,line width=1.5pt] (87pt,8pt) rectangle (186pt,68.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0002,line width=1.0pt] (102pt,24pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (104.9688pt,29.6406pt) ..controls (104.3906pt,29.9375pt) .. (103.75pt,30.0859pt) ..controls (103.1094pt,30.2344pt) .. (102.4063pt,30.2344pt) ..controls (99.9063pt,30.2344pt) .. (98.5859pt,28.5859pt) ..controls (97.2656pt,26.9375pt) .. (97.2656pt,23.8125pt) ..controls (97.2656pt,20.6875pt) .. (98.5859pt,19.0313pt) ..controls (99.9063pt,17.375pt) .. (102.4063pt,17.375pt) ..controls (103.1094pt,17.375pt) .. (103.7578pt,17.5313pt) ..controls (104.4063pt,17.6875pt) .. (104.9688pt,17.9844pt) -- (104.9688pt,20.7031pt) ..controls (104.3438pt,20.125pt) .. (103.75pt,19.8516pt) ..controls (103.1563pt,19.5781pt) .. (102.5313pt,19.5781pt) ..controls (101.1875pt,19.5781pt) .. (100.5pt,20.6484pt) ..controls (99.8125pt,21.7188pt) .. (99.8125pt,23.8125pt) ..controls (99.8125pt,25.9063pt) .. (100.5pt,26.9766pt) ..controls (101.1875pt,28.0469pt) .. (102.5313pt,28.0469pt) ..controls (103.1563pt,28.0469pt) .. (103.75pt,27.7734pt) ..controls (104.3438pt,27.5pt) .. (104.9688pt,26.9219pt) -- (104.9688pt,29.6406pt);\n\\node at (116pt,17.0156pt)[below right]{Subscriber};\n\\draw[color=plantucolor0001,line width=1.5pt] (88pt,40pt) -- (185pt,40pt);\n\\node at (93pt,44pt)[below right]{subscriberId};\n\\draw[color=plantucolor0001,line width=1.5pt] (88pt,60.8047pt) -- (185pt,60.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0000,line width=1.5pt] (6pt,148pt) rectangle (119pt,208.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0002,line width=1.0pt] (21pt,164pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (23.9688pt,169.6406pt) ..controls (23.3906pt,169.9375pt) .. (22.75pt,170.0859pt) ..controls (22.1094pt,170.2344pt) .. (21.4063pt,170.2344pt) ..controls (18.9063pt,170.2344pt) .. (17.5859pt,168.5859pt) ..controls (16.2656pt,166.9375pt) .. (16.2656pt,163.8125pt) ..controls (16.2656pt,160.6875pt) .. (17.5859pt,159.0313pt) ..controls (18.9063pt,157.375pt) .. (21.4063pt,157.375pt) ..controls (22.1094pt,157.375pt) .. (22.7578pt,157.5313pt) ..controls (23.4063pt,157.6875pt) .. (23.9688pt,157.9844pt) -- (23.9688pt,160.7031pt) ..controls (23.3438pt,160.125pt) .. (22.75pt,159.8516pt) ..controls (22.1563pt,159.5781pt) .. (21.5313pt,159.5781pt) ..controls (20.1875pt,159.5781pt) .. (19.5pt,160.6484pt) ..controls (18.8125pt,161.7188pt) .. (18.8125pt,163.8125pt) ..controls (18.8125pt,165.9063pt) .. (19.5pt,166.9766pt) ..controls (20.1875pt,168.0469pt) .. (21.5313pt,168.0469pt) ..controls (22.1563pt,168.0469pt) .. (22.75pt,167.7734pt) ..controls (23.3438pt,167.5pt) .. (23.9688pt,166.9219pt) -- (23.9688pt,169.6406pt);\n\\node at (35pt,157.0156pt)[below right]{AccumUsage};\n\\draw[color=plantucolor0001,line width=1.5pt] (7pt,180pt) -- (118pt,180pt);\n\\node at (12pt,184pt)[below right]{subscriberId};\n\\draw[color=plantucolor0001,line width=1.5pt] (7pt,200.8047pt) -- (118pt,200.8047pt);\n\\draw[color=plantucolor0001,fill=plantucolor0000,line width=1.5pt] (154pt,129pt) rectangle (267pt,228.2188pt);\n\\draw[color=plantucolor0001,fill=plantucolor0002,line width=1.0pt] (178.45pt,145pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (181.4188pt,150.6406pt) ..controls (180.8406pt,150.9375pt) .. (180.2pt,151.0859pt) ..controls (179.5594pt,151.2344pt) .. (178.8563pt,151.2344pt) ..controls (176.3563pt,151.2344pt) .. (175.0359pt,149.5859pt) ..controls (173.7156pt,147.9375pt) .. (173.7156pt,144.8125pt) ..controls (173.7156pt,141.6875pt) .. (175.0359pt,140.0313pt) ..controls (176.3563pt,138.375pt) .. (178.8563pt,138.375pt) ..controls (179.5594pt,138.375pt) .. (180.2078pt,138.5313pt) ..controls (180.8563pt,138.6875pt) .. (181.4188pt,138.9844pt) -- (181.4188pt,141.7031pt) ..controls (180.7938pt,141.125pt) .. (180.2pt,140.8516pt) ..controls (179.6063pt,140.5781pt) .. (178.9813pt,140.5781pt) ..controls (177.6375pt,140.5781pt) .. (176.95pt,141.6484pt) ..controls (176.2625pt,142.7188pt) .. (176.2625pt,144.8125pt) ..controls (176.2625pt,146.9063pt) .. (176.95pt,147.9766pt) ..controls (177.6375pt,149.0469pt) .. (178.9813pt,149.0469pt) ..controls (179.6063pt,149.0469pt) .. (180.2pt,148.7734pt) ..controls (180.7938pt,148.5pt) .. (181.4188pt,147.9219pt) -- (181.4188pt,150.6406pt);\n\\node at (194.55pt,138.0156pt)[below right]{IpSession};\n\\draw[color=plantucolor0001,line width=1.5pt] (155pt,161pt) -- (266pt,161pt);\n\\node at (160pt,165pt)[below right]{ipAddress};\n\\node at (160pt,177.8047pt)[below right]{specificData};\n\\node at (160pt,190.6094pt)[below right]{sapcOriginStateId};\n\\node at (160pt,203.4141pt)[below right]{apnId};\n\\draw[color=plantucolor0001,line width=1.5pt] (155pt,220.2188pt) -- (266pt,220.2188pt);\n\\draw[color=plantucolor0004,line width=1.0pt] (152.375pt,69.104pt) ..controls (160.988pt,85.167pt) and (171.898pt,105.512pt) .. (181.933pt,124.227pt);\n\\draw[color=plantucolor0004,fill=plantucolor0004,line width=1.0pt] (184.464pt,128.9464pt) -- (183.7353pt,119.1245pt) -- (182.1008pt,124.5401pt) -- (176.6853pt,122.9056pt) -- (184.464pt,128.9464pt) -- cycle;\n\\node at (146.8242pt,76.9968pt)[below right]{1};\n\\node at (156.1855pt,105.9167pt)[below right]{1..*};\n\\draw[color=plantucolor0001,line width=1.0pt] (120.625pt,69.104pt) ..controls (108.92pt,90.933pt) and (92.9726pt,120.673pt) .. (80.7427pt,143.4799pt);\n\\draw[color=plantucolor0001,fill=plantucolor0001,line width=1.0pt] (78.3486pt,147.9445pt) -- (86.1271pt,141.9034pt) -- (80.7116pt,143.5381pt) -- (79.0769pt,138.1226pt) -- (78.3486pt,147.9445pt) -- cycle;\n\\node at (108.5258pt,76.9968pt)[below right]{1};\n\\node at (55.1905pt,124.6557pt)[below right]{0..1};\n\\end{tikzpicture}"]}]] \ No newline at end of file diff --git a/src/test/resources/identifyblock.input.json b/src/test/resources/identifyblock.input.json new file mode 100644 index 0000000..0b07e87 --- /dev/null +++ b/src/test/resources/identifyblock.input.json @@ -0,0 +1 @@ +[{"unMeta":{}},[{"t":"Header","c":[1,["test-document",[],[]],[{"t":"Str","c":"Test"},{"t":"Space","c":[]},{"t":"Str","c":"document"}]]},{"t":"Para","c":[{"t":"Str","c":"This"},{"t":"Space","c":[]},{"t":"Str","c":"paragraph"},{"t":"Space","c":[]},{"t":"Str","c":"should"},{"t":"Space","c":[]},{"t":"Str","c":"be"},{"t":"Space","c":[]},{"t":"Str","c":"left"},{"t":"Space","c":[]},{"t":"Str","c":"as"},{"t":"Space","c":[]},{"t":"Str","c":"is"},{"t":"Space","c":[]},{"t":"Str","c":"by"},{"t":"Space","c":[]},{"t":"Str","c":"the"},{"t":"Space","c":[]},{"t":"Str","c":"filter."}]},{"t":"CodeBlock","c":[["",[],[]],"This generic code block too.\nOnly PlantUML code blocks should be rendered."]},{"t":"CodeBlock","c":[["",["puml"],[]],"@startuml\nclass Subscriber {\n subscriberId\n}\n\nclass AccumUsage {\n subscriberId\n}\n\nclass IpSession {\n ipAddress\n specificData \n sapcOriginStateId \n apnId\n}\n\nSubscriber \"1\" -[#blue]-> \"1..*\" IpSession\nSubscriber \"1\" --> \"0..1\" AccumUsage\n@enduml"]}]] \ No newline at end of file diff --git a/src/test/resources/input.json b/src/test/resources/input.json deleted file mode 100644 index 0b07e87..0000000 --- a/src/test/resources/input.json +++ /dev/null @@ -1 +0,0 @@ -[{"unMeta":{}},[{"t":"Header","c":[1,["test-document",[],[]],[{"t":"Str","c":"Test"},{"t":"Space","c":[]},{"t":"Str","c":"document"}]]},{"t":"Para","c":[{"t":"Str","c":"This"},{"t":"Space","c":[]},{"t":"Str","c":"paragraph"},{"t":"Space","c":[]},{"t":"Str","c":"should"},{"t":"Space","c":[]},{"t":"Str","c":"be"},{"t":"Space","c":[]},{"t":"Str","c":"left"},{"t":"Space","c":[]},{"t":"Str","c":"as"},{"t":"Space","c":[]},{"t":"Str","c":"is"},{"t":"Space","c":[]},{"t":"Str","c":"by"},{"t":"Space","c":[]},{"t":"Str","c":"the"},{"t":"Space","c":[]},{"t":"Str","c":"filter."}]},{"t":"CodeBlock","c":[["",[],[]],"This generic code block too.\nOnly PlantUML code blocks should be rendered."]},{"t":"CodeBlock","c":[["",["puml"],[]],"@startuml\nclass Subscriber {\n subscriberId\n}\n\nclass AccumUsage {\n subscriberId\n}\n\nclass IpSession {\n ipAddress\n specificData \n sapcOriginStateId \n apnId\n}\n\nSubscriber \"1\" -[#blue]-> \"1..*\" IpSession\nSubscriber \"1\" --> \"0..1\" AccumUsage\n@enduml"]}]] \ No newline at end of file diff --git a/src/test/resources/resize.expected.json b/src/test/resources/resize.expected.json new file mode 100644 index 0000000..c78333c --- /dev/null +++ b/src/test/resources/resize.expected.json @@ -0,0 +1 @@ +{"blocks":[{"t":"RawBlock","c":["latex","\\resizebox{\\columnwidth}{!}{\n% generated by Plantuml 8059 \n\\definecolor{plantucolor0000}{RGB}{255,255,255}\n\\definecolor{plantucolor0001}{RGB}{0,0,0}\n\\definecolor{plantucolor0002}{RGB}{254,254,206}\n\\definecolor{plantucolor0003}{RGB}{168,0,54}\n\\definecolor{plantucolor0004}{RGB}{173,209,178}\n\\scalebox{0.9169}{\n\\begin{tikzpicture}[yscale=-1]\n\\draw[color=black,fill=white,line width=2.0pt] (22pt,44pt) -- (32pt,34pt) -- (134pt,34pt) -- (134pt,128pt) -- (124pt,138pt) -- (22pt,138pt) -- (22pt,44pt) -- cycle;\n\\draw[color=black,line width=2.0pt] (124pt,44pt) -- (133pt,35pt);\n\\draw[color=black,line width=2.0pt] (22pt,44pt) -- (124pt,44pt);\n\\draw[color=black,line width=2.0pt] (124pt,44pt) -- (124pt,138pt);\n\\node at (56pt,47pt)[below right]{foo1};\n\\draw[color=black,fill=white,line width=2.0pt] (158pt,39pt) rectangle (264pt,138pt);\n\\node at (193pt,41pt)[below right]{foo2};\n\\draw[color=black,fill=white,line width=2.0pt] (288pt,39pt) -- (330pt,39pt) -- (337pt,61.2969pt) -- (394pt,61.2969pt) -- (394pt,138pt) -- (288pt,138pt) -- (288pt,39pt) -- cycle;\n\\draw[color=black,line width=2.0pt] (288pt,61.2969pt) -- (337pt,61.2969pt);\n\\node at (292pt,41pt)[below right]{foo3};\n\\draw[color=black,fill=white,line width=2.0pt] (418pt,39pt) rectangle (524pt,138pt);\n\\draw[color=black,line width=2.0pt] (464pt,40pt) -- (464pt,48.2969pt) -- (454pt,58.2969pt) -- (418pt,58.2969pt);\n\\node at (421pt,40pt)[below right]{foo4};\n\\draw[color=black,line width=2.0pt] (551pt,46pt) ..controls (551pt,43pt) and (553pt,41pt) .. (556pt,41pt) ..controls (559pt,41pt) and (561pt,43pt) .. (561pt,46pt) ..controls (561pt,43pt) and (563pt,41pt) .. (566pt,41pt) ..controls (569pt,41pt) and (571pt,43pt) .. (571pt,46pt) ..controls (571pt,43pt) and (573pt,41pt) .. (576pt,41pt) ..controls (579pt,41pt) and (581pt,43pt) .. (581pt,46pt) ..controls (581pt,43pt) and (583pt,41pt) .. (586pt,41pt) ..controls (589pt,41pt) and (591pt,43pt) .. (591pt,46pt) ..controls (591pt,43pt) and (593pt,41pt) .. (596pt,41pt) ..controls (599pt,41pt) and (601pt,43pt) .. (601pt,46pt) ..controls (601pt,43pt) and (603pt,41pt) .. (606pt,41pt) ..controls (609pt,41pt) and (611pt,43pt) .. (611pt,46pt) ..controls (611pt,43pt) and (613pt,41pt) .. (616pt,41pt) ..controls (619pt,41pt) and (621pt,43pt) .. (621pt,46pt) ..controls (621pt,43pt) and (623pt,41pt) .. (626pt,41pt) ..controls (629pt,41pt) and (631pt,43pt) .. (631pt,46pt) ..controls (631pt,43pt) and (633pt,41pt) .. (636pt,41pt) ..controls (639pt,41pt) and (641pt,43pt) .. (641pt,46pt) ..controls (641pt,43pt) and (643pt,41pt) .. (646pt,41pt) ..controls (649pt,41pt) and (651pt,43pt) .. (651pt,46pt) ..controls (654pt,46pt) and (656pt,48pt) .. (656pt,51pt) ..controls (656pt,54pt) and (654pt,56pt) .. (651pt,56pt) ..controls (654pt,56pt) and (656pt,58pt) .. (656pt,61pt) ..controls (656pt,64pt) and (654pt,66pt) .. (651pt,66pt) ..controls (654pt,66pt) and (656pt,68pt) .. (656pt,71pt) ..controls (656pt,74pt) and (654pt,76pt) .. (651pt,76pt) ..controls (654pt,76pt) and (656pt,78pt) .. (656pt,81pt) ..controls (656pt,84pt) and (654pt,86pt) .. (651pt,86pt) ..controls (654pt,86pt) and (656pt,88pt) .. (656pt,91pt) ..controls (656pt,94pt) and (654pt,96pt) .. (651pt,96pt) ..controls (654pt,96pt) and (656pt,98pt) .. (656pt,101pt) ..controls (656pt,104pt) and (654pt,106pt) .. (651pt,106pt) ..controls (654pt,106pt) and (656pt,108pt) .. (656pt,111pt) ..controls (656pt,114pt) and (654pt,116pt) .. (651pt,116pt) ..controls (654pt,116pt) and (656pt,118pt) .. (656pt,121pt) ..controls (656pt,124pt) and (654pt,126pt) .. (651pt,126pt) ..controls (651pt,129pt) and (648pt,131pt) .. (646pt,131pt) ..controls (643pt,131pt) and (641pt,129pt) .. (641pt,126pt) ..controls (641pt,129pt) and (638pt,131pt) .. (636pt,131pt) ..controls (633pt,131pt) and (631pt,129pt) .. (631pt,126pt) ..controls (631pt,129pt) and (628pt,131pt) .. (626pt,131pt) ..controls (623pt,131pt) and (621pt,129pt) .. (621pt,126pt) ..controls (621pt,129pt) and (618pt,131pt) .. (616pt,131pt) ..controls (613pt,131pt) and (611pt,129pt) .. (611pt,126pt) ..controls (611pt,129pt) and (608pt,131pt) .. (606pt,131pt) ..controls (603pt,131pt) and (601pt,129pt) .. (601pt,126pt) ..controls (601pt,129pt) and (598pt,131pt) .. (596pt,131pt) ..controls (593pt,131pt) and (591pt,129pt) .. (591pt,126pt) ..controls (591pt,129pt) and (588pt,131pt) .. (586pt,131pt) ..controls (583pt,131pt) and (581pt,129pt) .. (581pt,126pt) ..controls (581pt,129pt) and (578pt,131pt) .. (576pt,131pt) ..controls (573pt,131pt) and (571pt,129pt) .. (571pt,126pt) ..controls (571pt,129pt) and (568pt,131pt) .. (566pt,131pt) ..controls (563pt,131pt) and (561pt,129pt) .. (561pt,126pt) ..controls (561pt,129pt) and (558pt,131pt) .. (556pt,131pt) ..controls (553pt,131pt) and (551pt,129pt) .. (551pt,126pt) ..controls (548pt,126pt) and (546pt,124pt) .. (546pt,121pt) ..controls (546pt,118pt) and (548pt,116pt) .. (551pt,116pt) ..controls (548pt,116pt) and (546pt,114pt) .. (546pt,111pt) ..controls (546pt,108pt) and (548pt,106pt) .. (551pt,106pt) ..controls (548pt,106pt) and (546pt,104pt) .. (546pt,101pt) ..controls (546pt,98pt) and (548pt,96pt) .. (551pt,96pt) ..controls (548pt,96pt) and (546pt,94pt) .. (546pt,91pt) ..controls (546pt,88pt) and (548pt,86pt) .. (551pt,86pt) ..controls (548pt,86pt) and (546pt,84pt) .. (546pt,81pt) ..controls (546pt,78pt) and (548pt,76pt) .. (551pt,76pt) ..controls (548pt,76pt) and (546pt,74pt) .. (546pt,71pt) ..controls (546pt,68pt) and (548pt,66pt) .. (551pt,66pt) ..controls (548pt,66pt) and (546pt,64pt) .. (546pt,61pt) ..controls (546pt,58pt) and (548pt,56pt) .. (551pt,56pt) ..controls (548pt,56pt) and (546pt,54pt) .. (546pt,51pt) ..controls (546pt,48pt) and (548pt,46pt) .. (551pt,46pt);\n\\node at (583pt,52pt)[below right]{foo5};\n\\draw[color=black,line width=2.0pt] (678pt,34pt) ..controls (678pt,24pt) and (731pt,24pt) .. (731pt,24pt) ..controls (731pt,24pt) and (784pt,24pt) .. (784pt,34pt) -- (784pt,128pt) ..controls (784pt,138pt) and (731pt,138pt) .. (731pt,138pt) ..controls (731pt,138pt) and (678pt,138pt) .. (678pt,128pt) -- (678pt,34pt);\n\\draw[color=black,line width=2.0pt] (678pt,34pt) ..controls (678pt,44pt) and (731pt,44pt) .. (731pt,44pt) ..controls (731pt,44pt) and (784pt,44pt) .. (784pt,34pt);\n\\node at (713pt,45pt)[below right]{foo6};\n\\draw[color=plantucolor0003,fill=plantucolor0002,line width=1.5pt] (41.5pt,74pt) rectangle (114.5pt,122pt);\n\\draw[color=plantucolor0003,fill=plantucolor0004,line width=1.0pt] (56.5pt,90pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (59.4688pt,95.6406pt) ..controls (58.8906pt,95.9375pt) .. (58.25pt,96.0859pt) ..controls (57.6094pt,96.2344pt) .. (56.9063pt,96.2344pt) ..controls (54.4063pt,96.2344pt) .. (53.0859pt,94.5859pt) ..controls (51.7656pt,92.9375pt) .. (51.7656pt,89.8125pt) ..controls (51.7656pt,86.6875pt) .. (53.0859pt,85.0313pt) ..controls (54.4063pt,83.375pt) .. (56.9063pt,83.375pt) ..controls (57.6094pt,83.375pt) .. (58.2578pt,83.5313pt) ..controls (58.9063pt,83.6875pt) .. (59.4688pt,83.9844pt) -- (59.4688pt,86.7031pt) ..controls (58.8438pt,86.125pt) .. (58.25pt,85.8516pt) ..controls (57.6563pt,85.5781pt) .. (57.0313pt,85.5781pt) ..controls (55.6875pt,85.5781pt) .. (55pt,86.6484pt) ..controls (54.3125pt,87.7188pt) .. (54.3125pt,89.8125pt) ..controls (54.3125pt,91.9063pt) .. (55pt,92.9766pt) ..controls (55.6875pt,94.0469pt) .. (57.0313pt,94.0469pt) ..controls (57.6563pt,94.0469pt) .. (58.25pt,93.7734pt) ..controls (58.8438pt,93.5pt) .. (59.4688pt,92.9219pt) -- (59.4688pt,95.6406pt);\n\\node at (70.5pt,83.0156pt)[below right]{Class1};\n\\draw[color=plantucolor0003,line width=1.5pt] (42.5pt,106pt) -- (113.5pt,106pt);\n\\draw[color=plantucolor0003,line width=1.5pt] (42.5pt,114pt) -- (113.5pt,114pt);\n\\draw[color=plantucolor0003,fill=plantucolor0002,line width=1.5pt] (174.5pt,74pt) rectangle (247.5pt,122pt);\n\\draw[color=plantucolor0003,fill=plantucolor0004,line width=1.0pt] (189.5pt,90pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (192.4688pt,95.6406pt) ..controls (191.8906pt,95.9375pt) .. (191.25pt,96.0859pt) ..controls (190.6094pt,96.2344pt) .. (189.9063pt,96.2344pt) ..controls (187.4063pt,96.2344pt) .. (186.0859pt,94.5859pt) ..controls (184.7656pt,92.9375pt) .. (184.7656pt,89.8125pt) ..controls (184.7656pt,86.6875pt) .. (186.0859pt,85.0313pt) ..controls (187.4063pt,83.375pt) .. (189.9063pt,83.375pt) ..controls (190.6094pt,83.375pt) .. (191.2578pt,83.5313pt) ..controls (191.9063pt,83.6875pt) .. (192.4688pt,83.9844pt) -- (192.4688pt,86.7031pt) ..controls (191.8438pt,86.125pt) .. (191.25pt,85.8516pt) ..controls (190.6563pt,85.5781pt) .. (190.0313pt,85.5781pt) ..controls (188.6875pt,85.5781pt) .. (188pt,86.6484pt) ..controls (187.3125pt,87.7188pt) .. (187.3125pt,89.8125pt) ..controls (187.3125pt,91.9063pt) .. (188pt,92.9766pt) ..controls (188.6875pt,94.0469pt) .. (190.0313pt,94.0469pt) ..controls (190.6563pt,94.0469pt) .. (191.25pt,93.7734pt) ..controls (191.8438pt,93.5pt) .. (192.4688pt,92.9219pt) -- (192.4688pt,95.6406pt);\n\\node at (203.5pt,83.0156pt)[below right]{Class2};\n\\draw[color=plantucolor0003,line width=1.5pt] (175.5pt,106pt) -- (246.5pt,106pt);\n\\draw[color=plantucolor0003,line width=1.5pt] (175.5pt,114pt) -- (246.5pt,114pt);\n\\draw[color=plantucolor0003,fill=plantucolor0002,line width=1.5pt] (304.5pt,74pt) rectangle (377.5pt,122pt);\n\\draw[color=plantucolor0003,fill=plantucolor0004,line width=1.0pt] (319.5pt,90pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (322.4688pt,95.6406pt) ..controls (321.8906pt,95.9375pt) .. (321.25pt,96.0859pt) ..controls (320.6094pt,96.2344pt) .. (319.9063pt,96.2344pt) ..controls (317.4063pt,96.2344pt) .. (316.0859pt,94.5859pt) ..controls (314.7656pt,92.9375pt) .. (314.7656pt,89.8125pt) ..controls (314.7656pt,86.6875pt) .. (316.0859pt,85.0313pt) ..controls (317.4063pt,83.375pt) .. (319.9063pt,83.375pt) ..controls (320.6094pt,83.375pt) .. (321.2578pt,83.5313pt) ..controls (321.9063pt,83.6875pt) .. (322.4688pt,83.9844pt) -- (322.4688pt,86.7031pt) ..controls (321.8438pt,86.125pt) .. (321.25pt,85.8516pt) ..controls (320.6563pt,85.5781pt) .. (320.0313pt,85.5781pt) ..controls (318.6875pt,85.5781pt) .. (318pt,86.6484pt) ..controls (317.3125pt,87.7188pt) .. (317.3125pt,89.8125pt) ..controls (317.3125pt,91.9063pt) .. (318pt,92.9766pt) ..controls (318.6875pt,94.0469pt) .. (320.0313pt,94.0469pt) ..controls (320.6563pt,94.0469pt) .. (321.25pt,93.7734pt) ..controls (321.8438pt,93.5pt) .. (322.4688pt,92.9219pt) -- (322.4688pt,95.6406pt);\n\\node at (333.5pt,83.0156pt)[below right]{Class3};\n\\draw[color=plantucolor0003,line width=1.5pt] (305.5pt,106pt) -- (376.5pt,106pt);\n\\draw[color=plantucolor0003,line width=1.5pt] (305.5pt,114pt) -- (376.5pt,114pt);\n\\draw[color=plantucolor0003,fill=plantucolor0002,line width=1.5pt] (434.5pt,74pt) rectangle (507.5pt,122pt);\n\\draw[color=plantucolor0003,fill=plantucolor0004,line width=1.0pt] (449.5pt,90pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (452.4688pt,95.6406pt) ..controls (451.8906pt,95.9375pt) .. (451.25pt,96.0859pt) ..controls (450.6094pt,96.2344pt) .. (449.9063pt,96.2344pt) ..controls (447.4063pt,96.2344pt) .. (446.0859pt,94.5859pt) ..controls (444.7656pt,92.9375pt) .. (444.7656pt,89.8125pt) ..controls (444.7656pt,86.6875pt) .. (446.0859pt,85.0313pt) ..controls (447.4063pt,83.375pt) .. (449.9063pt,83.375pt) ..controls (450.6094pt,83.375pt) .. (451.2578pt,83.5313pt) ..controls (451.9063pt,83.6875pt) .. (452.4688pt,83.9844pt) -- (452.4688pt,86.7031pt) ..controls (451.8438pt,86.125pt) .. (451.25pt,85.8516pt) ..controls (450.6563pt,85.5781pt) .. (450.0313pt,85.5781pt) ..controls (448.6875pt,85.5781pt) .. (448pt,86.6484pt) ..controls (447.3125pt,87.7188pt) .. (447.3125pt,89.8125pt) ..controls (447.3125pt,91.9063pt) .. (448pt,92.9766pt) ..controls (448.6875pt,94.0469pt) .. (450.0313pt,94.0469pt) ..controls (450.6563pt,94.0469pt) .. (451.25pt,93.7734pt) ..controls (451.8438pt,93.5pt) .. (452.4688pt,92.9219pt) -- (452.4688pt,95.6406pt);\n\\node at (463.5pt,83.0156pt)[below right]{Class4};\n\\draw[color=plantucolor0003,line width=1.5pt] (435.5pt,106pt) -- (506.5pt,106pt);\n\\draw[color=plantucolor0003,line width=1.5pt] (435.5pt,114pt) -- (506.5pt,114pt);\n\\draw[color=plantucolor0003,fill=plantucolor0002,line width=1.5pt] (564.5pt,74pt) rectangle (637.5pt,122pt);\n\\draw[color=plantucolor0003,fill=plantucolor0004,line width=1.0pt] (579.5pt,90pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (582.4688pt,95.6406pt) ..controls (581.8906pt,95.9375pt) .. (581.25pt,96.0859pt) ..controls (580.6094pt,96.2344pt) .. (579.9063pt,96.2344pt) ..controls (577.4063pt,96.2344pt) .. (576.0859pt,94.5859pt) ..controls (574.7656pt,92.9375pt) .. (574.7656pt,89.8125pt) ..controls (574.7656pt,86.6875pt) .. (576.0859pt,85.0313pt) ..controls (577.4063pt,83.375pt) .. (579.9063pt,83.375pt) ..controls (580.6094pt,83.375pt) .. (581.2578pt,83.5313pt) ..controls (581.9063pt,83.6875pt) .. (582.4688pt,83.9844pt) -- (582.4688pt,86.7031pt) ..controls (581.8438pt,86.125pt) .. (581.25pt,85.8516pt) ..controls (580.6563pt,85.5781pt) .. (580.0313pt,85.5781pt) ..controls (578.6875pt,85.5781pt) .. (578pt,86.6484pt) ..controls (577.3125pt,87.7188pt) .. (577.3125pt,89.8125pt) ..controls (577.3125pt,91.9063pt) .. (578pt,92.9766pt) ..controls (578.6875pt,94.0469pt) .. (580.0313pt,94.0469pt) ..controls (580.6563pt,94.0469pt) .. (581.25pt,93.7734pt) ..controls (581.8438pt,93.5pt) .. (582.4688pt,92.9219pt) -- (582.4688pt,95.6406pt);\n\\node at (593.5pt,83.0156pt)[below right]{Class5};\n\\draw[color=plantucolor0003,line width=1.5pt] (565.5pt,106pt) -- (636.5pt,106pt);\n\\draw[color=plantucolor0003,line width=1.5pt] (565.5pt,114pt) -- (636.5pt,114pt);\n\\draw[color=plantucolor0003,fill=plantucolor0002,line width=1.5pt] (694.5pt,74pt) rectangle (767.5pt,122pt);\n\\draw[color=plantucolor0003,fill=plantucolor0004,line width=1.0pt] (709.5pt,90pt) ellipse (11pt and 11pt);\n\\draw[color=black,fill=black] (712.4688pt,95.6406pt) ..controls (711.8906pt,95.9375pt) .. (711.25pt,96.0859pt) ..controls (710.6094pt,96.2344pt) .. (709.9063pt,96.2344pt) ..controls (707.4063pt,96.2344pt) .. (706.0859pt,94.5859pt) ..controls (704.7656pt,92.9375pt) .. (704.7656pt,89.8125pt) ..controls (704.7656pt,86.6875pt) .. (706.0859pt,85.0313pt) ..controls (707.4063pt,83.375pt) .. (709.9063pt,83.375pt) ..controls (710.6094pt,83.375pt) .. (711.2578pt,83.5313pt) ..controls (711.9063pt,83.6875pt) .. (712.4688pt,83.9844pt) -- (712.4688pt,86.7031pt) ..controls (711.8438pt,86.125pt) .. (711.25pt,85.8516pt) ..controls (710.6563pt,85.5781pt) .. (710.0313pt,85.5781pt) ..controls (708.6875pt,85.5781pt) .. (708pt,86.6484pt) ..controls (707.3125pt,87.7188pt) .. (707.3125pt,89.8125pt) ..controls (707.3125pt,91.9063pt) .. (708pt,92.9766pt) ..controls (708.6875pt,94.0469pt) .. (710.0313pt,94.0469pt) ..controls (710.6563pt,94.0469pt) .. (711.25pt,93.7734pt) ..controls (711.8438pt,93.5pt) .. (712.4688pt,92.9219pt) -- (712.4688pt,95.6406pt);\n\\node at (723.5pt,83.0156pt)[below right]{Class6};\n\\draw[color=plantucolor0003,line width=1.5pt] (695.5pt,106pt) -- (766.5pt,106pt);\n\\draw[color=plantucolor0003,line width=1.5pt] (695.5pt,114pt) -- (766.5pt,114pt);\n\\end{tikzpicture}\n}\n}"]}],"pandoc-api-version":[1,17,5,1],"meta":{"header-includes":{"t":"MetaBlocks","c":[{"t":"RawBlock","c":["latex","\\usepackage{tikz}"]}]}}} \ No newline at end of file diff --git a/src/test/resources/resize.input.json b/src/test/resources/resize.input.json new file mode 100644 index 0000000..373fd4d --- /dev/null +++ b/src/test/resources/resize.input.json @@ -0,0 +1 @@ +{"blocks":[{"t":"CodeBlock","c":[["",["puml"],[["width","\\columnwidth"]]],"@startuml\nscale 750 width\npackage foo1 <> {\n class Class1\n}\n\npackage foo2 <> {\n class Class2\n}\n\npackage foo3 <> {\n class Class3\n}\n\npackage foo4 <> {\n class Class4\n}\n\npackage foo5 <> {\n class Class5\n}\n\npackage foo6 <> {\n class Class6\n}\n\n@enduml"]}],"pandoc-api-version":[1,17,5,1],"meta":{"header-includes":{"t":"MetaBlocks","c":[{"t":"RawBlock","c":["latex","\\usepackage{tikz}"]}]}}} -- cgit v1.2.3