diff options
3 files changed, 30 insertions, 4 deletions
diff --git a/src/plugins/xml/XmlOutput.cpp b/src/plugins/xml/XmlOutput.cpp index 1a7ea2a..516fc22 100644 --- a/src/plugins/xml/XmlOutput.cpp +++ b/src/plugins/xml/XmlOutput.cpp @@ -250,13 +250,13 @@ static Rooted<Element> transformTokenDescriptor(Handle<Element> parent, return nullptr; } Rooted<Element> tag{new Element(P.mgr, parent, tagName)}; - std::string str; + Rooted<xml::Node> token; if (descr.special) { - // TODO: Handle this case + token = Rooted<Element>{ + new Element(P.mgr, tag, Token::specialName(descr.id))}; } else { - str = descr.token; + token = Rooted<Text>{new Text(P.mgr, tag, descr.token)}; } - Rooted<Text> token{new Text(P.mgr, parent, str)}; tag->addChild(token); return tag; } diff --git a/testdata/integration/ontology_serialization/special_tokens.in.osml b/testdata/integration/ontology_serialization/special_tokens.in.osml new file mode 100644 index 0000000..e89c5eb --- /dev/null +++ b/testdata/integration/ontology_serialization/special_tokens.in.osml @@ -0,0 +1,10 @@ +\begin{document} + \begin{ontology#test} + \struct#a[root=true] + \syntax + \close{\newline} + \field + \childRef[ref=a] + \end{ontology} +\a +\end{document} diff --git a/testdata/integration/ontology_serialization/special_tokens.out.osxml b/testdata/integration/ontology_serialization/special_tokens.out.osxml new file mode 100644 index 0000000..c5d7a6a --- /dev/null +++ b/testdata/integration/ontology_serialization/special_tokens.out.osxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<document> + <ontology name="test"> + <struct name="a" root="true"> + <field> + <childRef ref="a"/> + </field> + <syntax> + <close> + <newline/> + </close> + </syntax> + </struct> + </ontology> + <test:a/> +</document> |