summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-08 20:31:30 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-08 20:31:30 +0100
commitb05499223916879e051d102e1b7e2fd080f46e7d (patch)
treef4cade370ee065ed4303ecb71cd47a20ce93c22e /src/plugins
parent2c3b327739b79d5ba7fe931e205bec1ad320b360 (diff)
further extended advanced document (now list domain is supported as well) and extended DemoOutput accordingly.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/html/DemoOutput.cpp38
-rw-r--r--src/plugins/html/DemoOutput.hpp4
2 files changed, 29 insertions, 13 deletions
diff --git a/src/plugins/html/DemoOutput.cpp b/src/plugins/html/DemoOutput.cpp
index eac240b..307d37a 100644
--- a/src/plugins/html/DemoOutput.cpp
+++ b/src/plugins/html/DemoOutput.cpp
@@ -147,9 +147,8 @@ Rooted<xml::Element> DemoHTMLTransformer::transformSection(
Rooted<xml::Element> child;
if (childDescriptorName == "paragraph") {
child = transformParagraph(n);
- // TODO: Implement
- // } else if(childDescriptorName == "ul"){
- // writeList(n, out);
+ } else if (childDescriptorName == "ul" || childDescriptorName == "ol") {
+ child = transformList(n);
} else {
child = transformSection(n);
}
@@ -199,13 +198,30 @@ Rooted<xml::Element> DemoHTMLTransformer::transformParagraph(
return p;
}
-// Rooted<xml::Element>
-// DemoHTMLTransformer::transformList(Handle<model::StructuredEntity> list){
-// Manager &mgr = list->getManager();
-// // create the list Element, which is either ul or ol (depends on descriptor)
-// std::string listclass = list->getDescriptor()->getName();
-// Rooted<xml::Element> l{new xml::Element{mgr, listclass}};
-// // iterate through
-//}
+Rooted<xml::Element> DemoHTMLTransformer::transformList(
+ Handle<model::StructuredEntity> list)
+{
+ Manager &mgr = list->getManager();
+ // create the list Element, which is either ul or ol (depends on descriptor)
+ std::string listclass = list->getDescriptor()->getName();
+ Rooted<xml::Element> l{new xml::Element{mgr, listclass}};
+ // iterate through list items.
+ for (auto &item : list->getField()) {
+ std::string itDescrName = item->getDescriptor()->getName();
+ if (itDescrName == "item") {
+ // create the list item.
+ Rooted<xml::Element> li{new xml::Element{mgr, "li"}};
+ l->children.push_back(li);
+ // extract the item text, enveloped in a paragraph Element.
+ Rooted<xml::Element> li_content = transformParagraph(item);
+ // We omit the paragraph Element and add the children directly to
+ // the list item
+ for (auto &n : li_content->children) {
+ li->children.push_back(n);
+ }
+ }
+ }
+ return l;
+}
}
}
diff --git a/src/plugins/html/DemoOutput.hpp b/src/plugins/html/DemoOutput.hpp
index 0819d7f..6c046e7 100644
--- a/src/plugins/html/DemoOutput.hpp
+++ b/src/plugins/html/DemoOutput.hpp
@@ -46,8 +46,8 @@ private:
*/
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> transformList(Handle<model::StructuredEntity> list);
+// TODO: Implement emphasis.
public:
/**