From 7db9ce9d14ace08a2cbd92ddd79b3b359f8784e4 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 10 Apr 2015 14:16:48 +0200 Subject: handled special tokens in ontology serialization. --- src/plugins/xml/XmlOutput.cpp | 8 ++++---- .../ontology_serialization/special_tokens.in.osml | 10 ++++++++++ .../ontology_serialization/special_tokens.out.osxml | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 testdata/integration/ontology_serialization/special_tokens.in.osml create mode 100644 testdata/integration/ontology_serialization/special_tokens.out.osxml 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 transformTokenDescriptor(Handle parent, return nullptr; } Rooted tag{new Element(P.mgr, parent, tagName)}; - std::string str; + Rooted token; if (descr.special) { - // TODO: Handle this case + token = Rooted{ + new Element(P.mgr, tag, Token::specialName(descr.id))}; } else { - str = descr.token; + token = Rooted{new Text(P.mgr, tag, descr.token)}; } - Rooted 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 @@ + + + + + + + + + + + + + + + + -- cgit v1.2.3