- char ctm_str[100], mtm_str[100];
- std::time_t creat = this->cdate;
- std::time_t modif = this->cdate;
- std::strftime (ctm_str, sizeof (ctm_str),
- DATE_FORMAT, std::localtime (&creat));
- std::strftime (mtm_str, sizeof (mtm_str),
- DATE_FORMAT, std::localtime (&modif));
-
- // Allocate enough space for the output buffer
- std::unique_ptr<char[]> final_templ(
- new char[main_tpl.size()+
- this->title.size()+
- this->content.size() +
- this->meta_desc.size() +
- this->meta_keywords.size () +
- 200 +
- sidebartext.size()]);
- std::sprintf (final_templ.get (), main_tpl.c_str(), this->title.c_str(),
- this->meta_keywords.c_str(), this->meta_desc.c_str (),
- ctm_str, mtm_str,
- this->content.c_str(), sidebartext.c_str());
+ std::string outputhtml = fmt::format (templstr,
+ fmt::arg ("title", this->title),
+ fmt::arg ("keywords", this->meta_keywords),
+ fmt::arg ("stylesheet", stylesheet),
+ fmt::arg ("description", this->meta_desc),
+ fmt::arg ("cdate", *std::localtime (&this->cdate)),
+ fmt::arg ("mdate", *std::localtime (&this->mdate)),
+ fmt::arg ("contents", this->content),
+ fmt::arg ("sidebar", sidebartext)
+ );