From f37d3cd42eb18433445c2e259cd71a1b2bd67be0 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 9 Jan 2015 17:00:53 +0100 Subject: added non-pretty output of XML serialization, changed DemoOutput accordingly and changed DemoOutputTest to have some kind of automatic inspection instead of visual inspection. --- src/plugins/html/DemoOutput.cpp | 6 +++--- src/plugins/html/DemoOutput.hpp | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/plugins/html') diff --git a/src/plugins/html/DemoOutput.cpp b/src/plugins/html/DemoOutput.cpp index 69f2756..4cadf12 100644 --- a/src/plugins/html/DemoOutput.cpp +++ b/src/plugins/html/DemoOutput.cpp @@ -29,12 +29,12 @@ namespace ousia { namespace html { void DemoHTMLTransformer::writeHTML(Handle doc, - std::ostream &out) + std::ostream &out, bool pretty) { Manager &mgr = doc->getManager(); // Create an XML object tree for the document first. Rooted html{new xml::Element{ - mgr, {nullptr}, "html", {{"xlmns", "http://www.w3.org/1999/xhtml"}}}}; + mgr, {nullptr}, "html"}}; // add the head Element Rooted head{new xml::Element{mgr, html, "head"}}; html->addChild(head); @@ -78,7 +78,7 @@ void DemoHTMLTransformer::writeHTML(Handle doc, body->addChild(book); // After the content has been transformed, we serialize it. - html->serialize(out, ""); + html->serialize(out, "", pretty); } /** diff --git a/src/plugins/html/DemoOutput.hpp b/src/plugins/html/DemoOutput.hpp index 07d758b..b755aac 100644 --- a/src/plugins/html/DemoOutput.hpp +++ b/src/plugins/html/DemoOutput.hpp @@ -83,11 +83,14 @@ public: * Therefore this is not an adequate model of our algorithms but only a * Demo. * - * @param doc is a Document using concepts of the book, headings, emphasis - * and lists domains but no other. - * @param out is the output stream the data shall be written to. + * @param doc is a Document using concepts of the book, headings, + * emphasis and lists domains but no other. + * @param out is the output stream the data shall be written to. + * @param pretty is a flag that manipulates whether newlines and tabs are + * used. */ - void writeHTML(Handle doc, std::ostream &out); + void writeHTML(Handle doc, std::ostream &out, + bool pretty = true); }; } } -- cgit v1.2.3