#include "biawebutil.hpp"
#include "biawebsidebar.hpp"
-// "discount" markdown library is a C library and hence requires to be wrapped in
-// extern "C"
-extern "C" {
- #include <mkdio.h>
-}
// class to represent a biaweb document which can have a file name, title, description,
// keywords, content and sidebar items
namespace biaweb {
return this->cdate;
}
- // output the document to HTML using the template
- void output_to_html (std::string path);
+ // output the document to HTML using the templates in templatedir
+ void output_to_html (std::string templatedir, std::string path);
// set the content portion of document as raw HTML content
void set_content (std::string content) {
this->content = convert_to_markdown (str);
}
- void Document::output_to_html (std::string path)
+ void Document::output_to_html (std::string templatedir, std::string path)
{
std::ifstream tpl;
- tpl.open ("templates/main.tpl.html", std::ios_base::openmode::_S_in);
+ tpl.open (templatedir + "/main.tpl.html", std::ios_base::openmode::_S_in);
std::string main_tpl ( (std::istreambuf_iterator<char> (tpl)),
(std::istreambuf_iterator<char> ()) );
tpl.close ();
// first render the sidebars
std::string sidebartext;
for (SideBar bar : sidebars) {
- sidebartext += bar.to_html ();
+ sidebartext += bar.to_html (templatedir);
}
char ctm_str[100], mtm_str[100];