diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-08 23:33:24 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-08 23:33:24 +0100 |
commit | 4ec16559eba87553241e2e20a9e31a62b7aed08a (patch) | |
tree | 5ec83bf244ce0ab001cb75825b9a89bc9c5d94a5 /src/plugins/html/DemoOutput.hpp | |
parent | 235cf24518ca40bec59b497a416d9831db12eaa3 (diff) |
first attempts on implementing annotation support for DemoHTML output.
Diffstat (limited to 'src/plugins/html/DemoOutput.hpp')
-rw-r--r-- | src/plugins/html/DemoOutput.hpp | 30 |
1 files changed, 23 insertions, 7 deletions
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 <map> #include <ostream> #include <core/model/Document.hpp> @@ -38,16 +39,31 @@ namespace ousia { namespace html { +typedef std::map<std::string, Rooted<model::AnnotationEntity>> 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<xml::Element> transformSection(Handle<model::StructuredEntity> 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<xml::Element> transformList(Handle<model::StructuredEntity> 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<xml::Element> transformSection(Handle<model::StructuredEntity> sec); - Rooted<xml::Element> transformParagraph(Handle<model::StructuredEntity> par); - Rooted<xml::Element> transformList(Handle<model::StructuredEntity> list); -// TODO: Implement emphasis. + Rooted<xml::Element> transformParagraph(Handle<model::StructuredEntity> 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<model::Document> doc, std::ostream& out); + void writeHTML(Handle<model::Document> doc, std::ostream &out); }; } } |