Added summary to the document tree index
[biaweb2.git] / biawebdocumenttree.hpp
index cf75c86..a65e334 100644 (file)
@@ -17,6 +17,9 @@ namespace biaweb {
         std::list<DocumentTree> children;
         // title of this tree
         std::string title;
+        // summary for this tree - this is displayed in the index.html file of
+        // this tree before the list of articles in the tree
+        std::string summary;
         // file stub of this tree
         std::string stub;
         // list of documents in this tree
@@ -40,6 +43,20 @@ namespace biaweb {
             this->parent = nullptr;
         }
 
+        // set the summary for this tree
+        void set_summary (std::string summary) {
+            this->summary = summary;
+        }
+
+        // set the summary for this tree as markdown text 
+        void set_markdown_summary (std::string summary) {
+            this->summary = convert_to_markdown (summary);
+        }
+
+        std::string get_summary () {
+            return this->summary;
+        }
+
         // create the document index for this tree
         void create_tree_html (std::string destdir);
 
@@ -196,7 +213,7 @@ namespace biaweb {
             doc.add_side_bar (*bar2.get());
             doc.output_to_html (filepath);
         }
-        index.get()->set_content (article_list.to_html());
+        index.get()->set_content (this->summary + article_list.to_html());
 
         index.get()->output_to_html (filepath);