From 4ec16559eba87553241e2e20a9e31a62b7aed08a Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Thu, 8 Jan 2015 23:33:24 +0100 Subject: first attempts on implementing annotation support for DemoHTML output. --- src/plugins/html/DemoOutput.hpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/plugins/html/DemoOutput.hpp') diff --git a/src/plugins/html/DemoOutput.hpp b/src/plugins/html/DemoOutput.hpp index 6c046e7..e08ec2b 100644 --- a/src/plugins/html/DemoOutput.hpp +++ b/src/plugins/html/DemoOutput.hpp @@ -30,6 +30,7 @@ #ifndef _OUSIA_HTML_DEMO_OUTPUT_HPP_ #define _OUSIA_HTML_DEMO_OUTPUT_HPP_ +#include #include #include @@ -38,16 +39,31 @@ namespace ousia { namespace html { +typedef std::map> AnnoMap; + class DemoHTMLTransformer { private: /** - * These methods are called recursively to transform a document to an XML - * tree. + * This transforms a section-like entity, namely book, section + * and subsection, to an XHTML element, including its header. For the + * children of the default field the respective transform function is + * called recursively. + */ + Rooted transformSection(Handle sec, + AnnoMap& startMap, AnnoMap& endMap); + /** + * This transforms a list entity, namely ul and ol to an XHTML element. + * For each item, the transformParagraph function is called. + */ + Rooted transformList(Handle list, + AnnoMap& startMap, AnnoMap& endMap); + /** + * This transforms a paragraph-like entity, namely heading, item and + * paragraph, to an XHTML element including the text and the anchors + * contained. For anchor handling we require the AnnoMaps. */ - Rooted transformSection(Handle sec); - Rooted transformParagraph(Handle par); - Rooted transformList(Handle list); -// TODO: Implement emphasis. + Rooted transformParagraph(Handle par, + AnnoMap& startMap, AnnoMap& endMap); public: /** @@ -68,7 +84,7 @@ public: * and lists domains but no other. * @param out is the output stream the data shall be written to. */ - void writeHTML(Handle doc, std::ostream& out); + void writeHTML(Handle doc, std::ostream &out); }; } } -- cgit v1.2.3