Readme.md - added Section for customization and notes
[biaweb2.git] / biawebdoclist.hpp
index 8a92cdd..8995c3c 100644 (file)
@@ -20,44 +20,37 @@ namespace biaweb {
       // Just the required fields to build the item
         std::string title; 
         std::string url;
+        std::string desc;
         std::time_t ctime;
         std::time_t mtime;
       public:
-        DocListItem (std::string title, std::string url, 
-                    std::time_t ctime, std::time_t mtime ) {
-            this->title = escape_html (title);
-            this->url = url;
-            this->ctime = ctime; 
-            this->mtime = mtime;
+        DocListItem (Document *doc, std::string urlpath) {
+            this->title = doc->get_title ();
+            this->url = urlpath + doc->get_filename() + ".html";
+            this->ctime = doc->get_creation_date (); 
+            this->mtime = doc->get_modified_date ();
+            this->desc = doc->get_meta_desc ();
+        }
+
+        std::string get_desc () {
+            return this->desc;
         }
 
         std::time_t get_mtime() {
             return this->mtime;
         }
-        void set_mtime(std::time_t mtime) {
-            this->mtime = mtime;
-        }
+
         std::time_t get_ctime() {
             return this->ctime;
         }
-        void set_ctime(std::time_t ctime) {
-            this->ctime = ctime;
-        }
 
         std::string get_url() {
                  return this->url;
         }
 
-        void set_url(std::string url) {
-          this->url = url;
-        }
-
         std::string get_title() {
             return this->title;
         }
-        void set_title(std::string title) {
-            this->title = escape_html (title);
-        }
         
         // output to HTML vide the template
         std::string to_html (Template *t);
@@ -71,7 +64,8 @@ namespace biaweb {
         m = *std::localtime (&this->mtime);
         
         std::string outputhtml = fmt::format (templstr, fmt::arg("url", this->url),
-                               fmt::arg("doctitle", this->title), 
+                               fmt::arg("doctitle", this->title),
+                               fmt::arg("desc", this->desc), 
                                fmt::arg("cdate", c),
                                fmt::arg("mdate", m));
         
@@ -85,7 +79,7 @@ namespace biaweb {
         std::list<DocListItem> items;
       public:
         void set_title (std::string title) {
-            this->title = escape_html (title);
+            this->title = title;
         }
         // add a document item
         void add_document_item (DocListItem docitem) {