aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-07-26 11:34:06 +0200
committerpacien2018-07-26 11:34:06 +0200
commit69bc6c2ae35883286d9c2b8cc77d5fa0a8c37351 (patch)
tree26d8635694b9d7f61b77772b29a9c980b632cc2c
parent4d80dd03b75421f2fb40cb89f9634be47b09a779 (diff)
downloadpandoc-filter-plantuml-69bc6c2ae35883286d9c2b8cc77d5fa0a8c37351.tar.gz
Kotlin rewrite, adding diagram options
-rw-r--r--build.gradle27
-rw-r--r--readme.md35
-rw-r--r--src/main/java/org/pacien/pandoc/filter/plantuml/Filter.java84
-rw-r--r--src/main/kotlin/org/pacien/pandoc/filter/plantuml/Filter.kt57
-rw-r--r--src/main/kotlin/org/pacien/pandoc/filter/plantuml/Latex.kt16
-rw-r--r--src/main/kotlin/org/pacien/pandoc/filter/plantuml/Main.kt5
-rw-r--r--src/main/kotlin/org/pacien/pandoc/filter/plantuml/PandocNode.kt30
-rw-r--r--src/main/kotlin/org/pacien/pandoc/filter/plantuml/PlantUml.kt21
-rw-r--r--src/test/java/org/pacien/pandoc/filter/plantuml/FilterTest.java27
-rw-r--r--src/test/kotlin/org/pacien/pandoc/filter/plantuml/FilterTest.kt39
-rw-r--r--src/test/resources/attributes.expected.json1
-rw-r--r--src/test/resources/attributes.input.json1
-rw-r--r--src/test/resources/identifyblock.expected.json (renamed from src/test/resources/expected.json)2
-rw-r--r--src/test/resources/identifyblock.input.json (renamed from src/test/resources/input.json)0
-rw-r--r--src/test/resources/resize.expected.json1
-rw-r--r--src/test/resources/resize.input.json1
16 files changed, 224 insertions, 123 deletions
diff --git a/build.gradle b/build.gradle
index f6a0a4f..c7a64f4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,13 @@
1group 'org.pacien.pandoc.filter.plantuml' 1group 'org.pacien.pandoc.filter.plantuml'
2version '1.0-SNAPSHOT' 2version '1.0-SNAPSHOT'
3 3
4apply plugin: 'java' 4apply plugin: 'kotlin'
5 5
6sourceCompatibility = 1.8 6sourceCompatibility = 1.8
7 7
8jar { 8jar {
9 manifest { 9 manifest {
10 attributes 'Main-Class': 'org.pacien.pandoc.filter.plantuml.Filter' 10 attributes 'Main-Class': 'org.pacien.pandoc.filter.plantuml.MainKt'
11 } 11 }
12 12
13 from { 13 from {
@@ -23,4 +23,27 @@ dependencies {
23 testCompile group: 'junit', name: 'junit', version: '4.12' 23 testCompile group: 'junit', name: 'junit', version: '4.12'
24 compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.6' 24 compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.6'
25 compile group: 'net.sourceforge.plantuml', name: 'plantuml', version: '8059' 25 compile group: 'net.sourceforge.plantuml', name: 'plantuml', version: '8059'
26 compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
27}
28
29buildscript {
30 ext.kotlin_version = '1.2.51'
31 repositories {
32 mavenCentral()
33 }
34 dependencies {
35 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
36 }
37}
38
39compileKotlin {
40 kotlinOptions {
41 jvmTarget = "1.8"
42 }
43}
44
45compileTestKotlin {
46 kotlinOptions {
47 jvmTarget = "1.8"
48 }
26} 49}
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
3 3
4A Pandoc AST filter rendering PlantUML code blocks into vector diagrams. 4A Pandoc AST filter rendering PlantUML code blocks into vector diagrams.
5 5
6This filter produces TikZ code that must then be rendered using another filter such as 6This filter produces TikZ code that can be rendered as vector diagrams in PDF documents,
7[tikz.py][tikz]. 7or as raster graphics by using another filter such as [tikz.py][tikz].
8 8
9 9
10Usage 10Example
11----- 11-------
12 12
13A PlantUML diagram in an example Pandoc Markdown file `example.md`: 13A PlantUML diagram in an example Pandoc Markdown file `example.md`:
14 14
15 ```puml 15 ---
16 header-includes: \usepackage{tikz}
17 ---
18
19 ```{.puml .centered caption="Courtesy protocol" width=\columnwidth}
16 @startuml 20 @startuml
17 Bob->Alice : hello 21 Bob->Alice : hello
22 Alice->Bob : hi
18 @enduml 23 @enduml
19 ``` 24 ```
20 25
21Using the helper scripts [tikz.py][tikz] and `pandoc-filter-plantuml.sh`: 26Using the helper scripts `pandoc-filter-plantuml.sh`:
22 27
23 #/bin/sh 28 #/bin/sh
24 java -jar pandoc-filter-plantuml.jar <&0 29 java -jar pandoc-filter-plantuml.jar <&0
25 30
26Can be rendered and included as a vector resource in a PDF by running: 31Can be rendered as a vector resource in a PDF by running:
27 32
28 % pandoc --filter=pandoc-filter-plantuml.sh \ 33 % pandoc --filter=pandoc-filter-plantuml.sh \
29 --filter=tikz.py \
30 --output=example.pdf \ 34 --output=example.pdf \
31 example.md 35 example.md
32 36
33Or as an image in an HTML document with the following command: 37Or as a raster image using [tikz.py][tikz] in an HTML document with the following command:
34 38
35 % pandoc --filter=pandoc-filter-plantuml.sh \ 39 % pandoc --filter=pandoc-filter-plantuml.sh \
36 --filter=tikz.py \ 40 --filter=tikz.py \
@@ -38,6 +42,18 @@ Or as an image in an HTML document with the following command:
38 example.md 42 example.md
39 43
40 44
45Options
46-------
47
48The following rendering options can be supplied as [fenced code attributes][fenced_code_attribute]:
49
50* `.centered`: centers the diagram horizontally on the page
51* `caption="Some caption"`: adds a figure caption below the diagram
52* `label="somelabel`: adds a label to the figure
53* `width=\columnwidth` and `height=100pt`: resize the diagram using the `\resizebox` command,
54 keeping the aspect ration of only one of the two is given
55
56
41Build 57Build
42----- 58-----
43 59
@@ -54,3 +70,4 @@ See /license.txt
54 70
55 71
56[tikz]: https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py 72[tikz]: https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py
73[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 @@
1package org.pacien.pandoc.filter.plantuml;
2
3import com.fasterxml.jackson.databind.JsonNode;
4import com.fasterxml.jackson.databind.ObjectMapper;
5import com.fasterxml.jackson.databind.node.ArrayNode;
6import com.fasterxml.jackson.databind.node.ObjectNode;
7import com.fasterxml.jackson.databind.node.TextNode;
8import net.sourceforge.plantuml.FileFormat;
9import net.sourceforge.plantuml.FileFormatOption;
10import net.sourceforge.plantuml.SourceStringReader;
11
12import java.io.*;
13import java.util.Iterator;
14import java.util.stream.Collectors;
15
16final public class Filter {
17
18 private static final String BEGIN_TAG = "\\begin{tikzpicture}[yscale=-1]";
19 private static final String LINE_SEP = "\n";
20 private static final String TYPE_KEY = "t";
21 private static final String CONTENT_KEY = "c";
22 private static final String CODE_BLOCK_TYPE = "CodeBlock";
23 private static final String RAW_BLOCK_TYPE = "RawBlock";
24 private static final String PLANTUML_TYPE = "puml";
25 private static final String LATEX_TYPE = "latex";
26 private static final int META_INDEX = 0;
27 private static final int META_PROP_INDEX = 1;
28 private static final int META_PROP_TYPE_INDEX = 0;
29 private static final int CONTENT_INDEX = 1;
30
31 private static String plantumlToLatex(String puml) throws IOException {
32 try (ByteArrayOutputStream s = new ByteArrayOutputStream()) {
33 new SourceStringReader(puml).generateImage(s, new FileFormatOption(FileFormat.LATEX_NO_PREAMBLE));
34 try (BufferedReader r = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(s.toByteArray())))) {
35 return BEGIN_TAG + LINE_SEP + r.lines().filter(l -> !l.equals(BEGIN_TAG)).collect(Collectors.joining(LINE_SEP));
36 }
37 }
38 }
39
40 private static void renderPlantumlNode(ObjectNode n) throws IOException {
41 String puml = n.get(CONTENT_KEY).get(CONTENT_INDEX).asText();
42 String tikz = plantumlToLatex(puml);
43
44 n.set(TYPE_KEY, TextNode.valueOf(RAW_BLOCK_TYPE));
45 ((ArrayNode) n.get(CONTENT_KEY)).removeAll()
46 .add(TextNode.valueOf(LATEX_TYPE))
47 .add(TextNode.valueOf(tikz));
48 }
49
50 private static boolean isPlantumlNode(JsonNode n) {
51 return n.path(TYPE_KEY).asText().equals(CODE_BLOCK_TYPE) &&
52 n.path(CONTENT_KEY).path(META_INDEX).path(META_PROP_INDEX).path(META_PROP_TYPE_INDEX).asText().equals(PLANTUML_TYPE);
53 }
54
55 private static void walk(JsonNode n) throws IOException {
56 if (isPlantumlNode(n))
57 renderPlantumlNode((ObjectNode) n);
58 else if (n.isContainerNode())
59 for (Iterator<JsonNode> i = n.elements(); i.hasNext(); ) walk(i.next());
60 }
61
62 public static void filter(InputStream i, OutputStream o) throws IOException {
63 ObjectMapper m = new ObjectMapper();
64 JsonNode t = m.readTree(i);
65 if (t != null) {
66 walk(t);
67 m.writeValue(o, t);
68 }
69 }
70
71 public static void main(String args[]) {
72 try {
73 filter(System.in, System.out);
74 } catch (IOException e) {
75 e.printStackTrace();
76 System.exit(1);
77 }
78 }
79
80 private Filter() {
81 // static class
82 }
83
84}
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 @@
1package org.pacien.pandoc.filter.plantuml
2
3import com.fasterxml.jackson.databind.JsonNode
4import com.fasterxml.jackson.databind.ObjectMapper
5import com.fasterxml.jackson.databind.node.ArrayNode
6import com.fasterxml.jackson.databind.node.ObjectNode
7import com.fasterxml.jackson.databind.node.TextNode
8import java.io.InputStream
9import java.io.OutputStream
10
11object Filter {
12 private val mapper = ObjectMapper()
13
14 private inline fun <T> T.conditionally(condition: Boolean, block: (T) -> T): T =
15 if (condition) block(this) else this
16
17 private inline fun <T, A> T.withNonNull(value: A?, block: (T, A) -> T): T =
18 if (value != null) block(this, value) else this
19
20 private fun JsonNode.isCodeBlock() = type() == "CodeBlock"
21 private fun JsonNode.isPlantUmlBlock() = isCodeBlock() && "puml" in classNames()
22
23 private fun Latex.resizeBox(attrs: Map<String, String>) =
24 resizeBox(attrs["width"] ?: "!", attrs["height"] ?: "!")
25
26 private fun Latex.setOptions(classes: List<String>, attrs: Map<String, String>) =
27 this
28 .conditionally("width" in attrs || "height" in attrs) { it -> it.resizeBox(attrs) }
29 .conditionally("centered" in classes, Latex::centering)
30 .withNonNull(attrs["caption"], Latex::caption)
31 .withNonNull(attrs["label"], Latex::label)
32 .conditionally("caption" in attrs || "label" in attrs, Latex::figure)
33
34 private fun arrayNodeOf(type: String, content: String): ArrayNode =
35 mapper.createArrayNode()
36 .add(TextNode.valueOf(type))
37 .add(TextNode.valueOf(content))
38
39 private fun renderPlantumlNode(node: ObjectNode) {
40 val puml = node.content()
41 val tikz = PlantUml.renderTikz(puml)
42 val block = tikz.setOptions(node.classNames(), node.attributeMap())
43 node.setBlock("RawBlock", arrayNodeOf("latex", block.raw()))
44 }
45
46 private fun walk(node: JsonNode): Unit = when {
47 node.isPlantUmlBlock() -> renderPlantumlNode(node as ObjectNode)
48 else -> node.forEach(Filter::walk)
49 }
50
51 fun filter(input: InputStream, output: OutputStream) {
52 mapper.readTree(input)?.let { tree ->
53 walk(tree)
54 mapper.writeValue(output, tree)
55 }
56 }
57}
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 @@
1package org.pacien.pandoc.filter.plantuml
2
3fun Sequence<String>.toLatex() = Latex(this)
4
5class Latex(private val body: Sequence<String>) {
6 fun raw() = body.filterNot(String::isEmpty).joinToString("\n")
7
8 private fun surround(prefix: String, suffix: String) =
9 Latex(sequenceOf(prefix) + body + sequenceOf(suffix))
10
11 fun resizeBox(width: String, height: String) = surround("\\resizebox{$width}{$height}{", "}")
12 fun centering() = surround("\\centering", "")
13 fun label(label: String) = surround("", "\\label{$label}")
14 fun caption(caption: String) = surround("", "\\caption{$caption}")
15 fun figure() = surround("\\begin{figure}[h]", "\\end{figure}")
16}
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 @@
1package org.pacien.pandoc.filter.plantuml
2
3fun main(args: Array<String>) {
4 Filter.filter(System.`in`, System.out)
5}
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 @@
1package org.pacien.pandoc.filter.plantuml
2
3import com.fasterxml.jackson.databind.JsonNode
4import com.fasterxml.jackson.databind.node.ObjectNode
5import com.fasterxml.jackson.databind.node.TextNode
6
7// Structure of a content node:
8// {
9// "t": "CodeBlock",
10// "c": [
11// [
12// "",
13// [ "puml", "otherClass" ],
14// [ ["scale", "0.5"], ["key", "value"] ]
15// ],
16// "@startuml\n@enduml"
17// ]
18// }
19
20fun JsonNode.type(): String = path("t").asText()
21fun JsonNode.classes(): JsonNode = path("c").path(0).path(1)
22fun JsonNode.classNames(): List<String> = classes().map(JsonNode::asText)
23fun JsonNode.attributes(): JsonNode = path("c").path(0).path(2)
24fun JsonNode.attributePair(): Pair<String, String> = Pair(path(0).asText(), path(1).asText())
25fun JsonNode.attributeMap(): Map<String, String> = attributes().associate(JsonNode::attributePair)
26fun JsonNode.content(): String = path("c").path(1).asText()
27
28fun ObjectNode.setBlockType(type: String) = apply { set("t", TextNode.valueOf(type)) }
29fun ObjectNode.setBlockContent(content: JsonNode) = apply { set("c", content) }
30fun 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 @@
1package org.pacien.pandoc.filter.plantuml
2
3import net.sourceforge.plantuml.FileFormat
4import net.sourceforge.plantuml.FileFormatOption
5import net.sourceforge.plantuml.SourceStringReader
6import java.io.ByteArrayOutputStream
7
8object PlantUml {
9 private val OUTPUT_FORMAT = FileFormatOption(FileFormat.LATEX_NO_PREAMBLE)
10
11 private fun SourceStringReader.generateImage(outputFormat: FileFormatOption) =
12 ByteArrayOutputStream().use { buffer ->
13 generateImage(buffer, outputFormat)
14 buffer.toString().lineSequence()
15 }
16
17 fun renderTikz(plantuml: String) =
18 SourceStringReader(plantuml)
19 .generateImage(OUTPUT_FORMAT)
20 .toLatex()
21}
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 @@
1package org.pacien.pandoc.filter.plantuml;
2
3import org.junit.Assert;
4import org.junit.Test;
5
6import java.io.*;
7import java.net.URISyntaxException;
8import java.nio.file.Files;
9import java.nio.file.Paths;
10
11final public class FilterTest {
12
13 private static final String INPUT_FILE = "/input.json";
14 private static final String EXPECTED_FILE = "/expected.json";
15
16 @Test
17 public void filterTest() {
18 try (ByteArrayOutputStream o = new ByteArrayOutputStream()) {
19 byte[] e = Files.readAllBytes(Paths.get(getClass().getResource(EXPECTED_FILE).toURI()));
20 Filter.filter(getClass().getResourceAsStream(INPUT_FILE), o);
21 Assert.assertArrayEquals(o.toByteArray(), e);
22 } catch (IOException | URISyntaxException e) {
23 Assert.fail();
24 }
25 }
26
27}
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 @@
1package org.pacien.pandoc.filter.plantuml
2
3import org.junit.Assert
4import org.junit.Test
5
6import java.io.*
7import java.nio.file.Files
8import java.nio.file.Paths
9
10class FilterTest {
11 private fun testCompare(inputResource: String, expectedOutputResource: String) {
12 val inputStream = javaClass.getResourceAsStream(inputResource)
13 val expectedOutputFilePath = Paths.get(javaClass.getResource(expectedOutputResource).toURI())
14 val expectedOutput = Files.readAllBytes(expectedOutputFilePath)
15
16 ByteArrayOutputStream().use { outputStream ->
17 Filter.filter(inputStream, outputStream)
18 Assert.assertArrayEquals(outputStream.toByteArray(), expectedOutput)
19 }
20 }
21
22 /**
23 * Should only replace the PlantUML code block and leave other ones untouched.
24 */
25 @Test fun testIdentifyBlock() =
26 testCompare("/identifyblock.input.json", "/identifyblock.expected.json")
27
28 /**
29 * Figure should be centered with a caption and a label.
30 */
31 @Test fun testAttributes() =
32 testCompare("/attributes.input.json", "/attributes.expected.json")
33
34 /**
35 * Large figure should be scaled down to column width, keeping its aspect ratio.
36 */
37 @Test fun testResize() =
38 testCompare("/resize.input.json", "/resize.expected.json")
39}
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/identifyblock.expected.json
index 7131399..cff87e2 100644
--- a/src/test/resources/expected.json
+++ b/src/test/resources/identifyblock.expected.json
@@ -1 +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","\\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 [{"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/input.json b/src/test/resources/identifyblock.input.json
index 0b07e87..0b07e87 100644
--- a/src/test/resources/input.json
+++ b/src/test/resources/identifyblock.input.json
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 <<Node>> {\n class Class1\n}\n\npackage foo2 <<Rectangle>> {\n class Class2\n}\n\npackage foo3 <<Folder>> {\n class Class3\n}\n\npackage foo4 <<Frame>> {\n class Class4\n}\n\npackage foo5 <<Cloud>> {\n class Class5\n}\n\npackage foo6 <<Database>> {\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}"]}]}}}