summaryrefslogtreecommitdiff
path: root/src/plugins/html/DemoOutput.hpp
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-04 17:41:53 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-04 17:41:53 +0100
commit1f4b48537f52646f9e4d520c2b2c2425f3565fa2 (patch)
treeac31d3458d08d9b1f762200f5715ade3df15bc9a /src/plugins/html/DemoOutput.hpp
parentdd3e14ec4dd2386cc8af61157975118acb4d6ee2 (diff)
first draft for HTML Demo Output (still a lot of todos).
Diffstat (limited to 'src/plugins/html/DemoOutput.hpp')
-rw-r--r--src/plugins/html/DemoOutput.hpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/plugins/html/DemoOutput.hpp b/src/plugins/html/DemoOutput.hpp
new file mode 100644
index 0000000..ca9bcd2
--- /dev/null
+++ b/src/plugins/html/DemoOutput.hpp
@@ -0,0 +1,85 @@
+/*
+ Ousía
+ Copyright (C) 2014 Benjamin Paaßen, Andreas Stöckel
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file DemoOutput.hpp
+ *
+ * This implements a Demo HTML output for the following domains:
+ * * book
+ * * headings
+ * * emphasis
+ * * lists
+ *
+ * @author Benjamin Paassen - bpaassen@techfak.uni-bielefeld.de
+ */
+#ifndef _OUSIA_HTML_DEMO_OUTPUT_HPP_
+#define _OUSIA_HTML_DEMO_OUTPUT_HPP_
+
+#include <ostream>
+
+#include <core/model/Document.hpp>
+
+namespace ousia {
+namespace html {
+
+class DemoHTMLTransformer {
+private:
+ /**
+ * This method is to be called recursively to write a chapter, section or
+ * subsection to HTML.
+ */
+ void writeSection(Handle<model::StructuredEntity> sec, std::ostream& out);
+ /**
+ * This method is to be called recursively to write a paragraph to HTML.
+ */
+ void writeParagraph(Handle<model::StructuredEntity> par, std::ostream& out,
+ bool writePTags = true);
+ /**
+ * This method is to be called recursively to write a list to HTML.
+ * TODO: Implement
+ */
+// void writeList(Handle<StructuredEntity> sec, std::ostream& out,
+// int tabdepth);
+
+ //TODO: Implement emphasis.
+
+public:
+ /**
+ * This writes a HTML representation of the given document to the given
+ * output stream. Note that this method lacks the generality of our Ousia
+ * approach with respect to two important points:
+ * 1.) It hardcodes the dependency to a certain set of domains in the C++
+ * code.
+ * 2.) It does not use the proposed pipeline of first copying the document
+ * graph, then attaching style attributes and then transforming it to a
+ * specific output format but does all of these steps at once.
+ * 3.) It does not use different transformers for the different domains but
+ * does all transformations at once.
+ * 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.
+ */
+ void writeHTML(Handle<model::Document> doc, std::ostream& out);
+};
+}
+}
+
+#endif