diff --git a/dumpAst/src/main/resources/dumpAst.mustache b/dumpAst/src/main/resources/dumpAst.mustache index 9dd0d02e100d308c175e494648008aebb663e5b0..78356e35c4b0fc9aa6246fe7be3d24de2b44eb85 100644 --- a/dumpAst/src/main/resources/dumpAst.mustache +++ b/dumpAst/src/main/resources/dumpAst.mustache @@ -1,18 +1,18 @@ @startuml {{#PrintConfig}} -scale {{Scale}} +scale {{{Scale}}} {{#Headers}} -{{Value}} +{{{Value}}} {{/Headers}} {{/PrintConfig}} {{#DumpNodes}} {{#isAstNode}} {{^Invisible}} -object "{{{labelAndTextColor}}}" as {{name}} {{#backgroundColor}}#{{{backgroundColor}}}{{/backgroundColor}} { +object "{{{labelAndTextColor}}}" as {{{name}}} {{#backgroundColor}}#{{{backgroundColor}}}{{/backgroundColor}} { {{#DumpTokens}} {{#isDumpValueToken}} - {{label}} = {{{Value}}} + {{{label}}} = {{{Value}}} {{/isDumpValueToken}} {{/DumpTokens}} } @@ -24,7 +24,7 @@ object "{{{labelAndTextColor}}}" as {{name}} {{#backgroundColor}}#{{{backgroundC {{#DumpTokens}} {{^Invisible}} {{^isDumpValueToken}} -{{outerNodeName}} ..> {{innerNodeName}} : {{label}} +{{{outerNodeName}}} ..> {{{innerNodeName}}} : {{{label}}} {{/isDumpValueToken}} {{/Invisible}} {{/DumpTokens}} @@ -32,13 +32,13 @@ object "{{{labelAndTextColor}}}" as {{name}} {{#backgroundColor}}#{{{backgroundC {{#isList}} {{#InnerDumpNodes}} {{#bothVisible}} -{{outerNodeName}} *-- {{innerNodeName}} : {{label}} +{{{outerNodeName}}} *-- {{{innerNodeName}}} : {{{label}}} {{/bothVisible}} {{/InnerDumpNodes}} {{/isList}} {{^isList}} {{#bothVisible}} -{{outerNodeName}} *-- {{innerNodeName}} : {{label}} +{{{outerNodeName}}} *-- {{{innerNodeName}}} : {{{label}}} {{/bothVisible}} {{/isList}} {{/DumpChildNodes}} @@ -46,27 +46,27 @@ object "{{{labelAndTextColor}}}" as {{name}} {{#backgroundColor}}#{{{backgroundC {{#isList}} {{#InnerDumpNodes}} {{#bothVisible}} -{{outerNodeName}} {{#Bidirectional}}<{{/Bidirectional}}--> {{innerNodeName}} : {{label}} +{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}--> {{{innerNodeName}}} : {{{label}}} {{/bothVisible}} {{/InnerDumpNodes}} {{/isList}} {{^isList}} {{#bothVisible}} -{{outerNodeName}} {{#Bidirectional}}<{{/Bidirectional}}--> {{innerNodeName}} : {{label}} +{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}--> {{{innerNodeName}}} : {{{label}}} {{/bothVisible}} {{/isList}} {{/DumpRelations}} {{^Invisible}} {{#InvisiblePath}} {{#InnerDumpNodes}} -{{outerNodeName}} o.. {{innerNodeName}} +{{{outerNodeName}}} o.. {{{innerNodeName}}} {{/InnerDumpNodes}} {{/InvisiblePath}} {{/Invisible}} {{#PrintConfig}}{{#orderChildren}} {{#myChildren}} {{#hasSuccessor}} -{{name}} -[hidden]right-> {{#successor}}{{name}}{{/successor}} +{{{name}}} -[hidden]right-> {{#successor}}{{{name}}}{{/successor}} {{/hasSuccessor}} {{/myChildren}} {{/orderChildren}}{{/PrintConfig}} @@ -75,7 +75,7 @@ object "{{{labelAndTextColor}}}" as {{name}} {{#backgroundColor}}#{{{backgroundC {{#Debug}} legend right %date() - dumpAst: {{version}} + dumpAst: {{{version}}} plantuml: %version() endlegend {{/Debug}} diff --git a/testDumper/src/test/java/de/tudresden/inf/st/jastadd/testDumper/TestSimple.java b/testDumper/src/test/java/de/tudresden/inf/st/jastadd/testDumper/TestSimple.java index 1ccba6cc518d0ec487b937f0efd81068013ba2af..1f79691646ce8075303cab1fd321f920a48ed67f 100644 --- a/testDumper/src/test/java/de/tudresden/inf/st/jastadd/testDumper/TestSimple.java +++ b/testDumper/src/test/java/de/tudresden/inf/st/jastadd/testDumper/TestSimple.java @@ -28,6 +28,17 @@ public class TestSimple { assertEquals(0, actualRoot.getNumDumpRelation()); } + @Test + public void testCustomPreamble() { + Root root = createRoot(null, null); + String preamble = "{<\n>\n}"; + ExposingDumpBuilder builder = new ExposingDumpBuilder(root); + builder.excludeNullNodes().customPreamble(preamble); + DumpAst dumpAst = builder.build(); + String puml = dumpAst.toPlantUml(); + assertThat(puml).contains(preamble); + } + @Test void testChildlessNonterminal() { Root root = createRoot(createA(A_NAME, a -> a.setD(new D())), null); List<DumpNode> nodes = TestUtils.dumpModel(root);