From d0c30d4ea7936ff9a2f7669bdb4d014954c6c3bf Mon Sep 17 00:00:00 2001 From: luca0N! Date: Fri, 25 Feb 2022 18:53:11 -0300 Subject: [PATCH] Use MarkdownParser on WebsiteBuilder --- src/WebsiteBuilder.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/WebsiteBuilder.cxx b/src/WebsiteBuilder.cxx index 38be321..48c9edc 100644 --- a/src/WebsiteBuilder.cxx +++ b/src/WebsiteBuilder.cxx @@ -32,6 +32,7 @@ #include "ConfigUtils.hxx" // #include "Blog.h" #include "Common.hxx" +#include "MarkdownParser.hxx" std::string blog_relative_path(std::string const &pathPrefix, std::string const &path) { return path.substr(pathPrefix.length() - 1); @@ -143,7 +144,7 @@ void build_blog_structure(std::string const &path, std::string const &prefix, st // Now create the article file. oad /= getFilename(a); FILE *articleOutput = fopen(oad.string().c_str(), "w"); - FILE *articleFile = fopen(a.c_str(), "r"); + /*FILE *articleFile = fopen(a.c_str(), "r"); std::string articleContents; @@ -154,14 +155,15 @@ void build_blog_structure(std::string const &path, std::string const &prefix, st articleContents += buf; } - fclose(articleFile); + fclose(articleFile);*/ std::string htmlTemplate = get_template(path); // NOTE: std::regex requires the C++11 standard. std::regex contentPlaceholder(""); - articleContents = std::regex_replace(htmlTemplate, contentPlaceholder, articleContents); + //articleContents = std::regex_replace(htmlTemplate, contentPlaceholder, articleContents); + std::string articleHtml = MarkdownParser::make_html(a); - fputs(articleContents.c_str(), articleOutput); + fputs(articleHtml.c_str(), articleOutput); fclose(articleOutput); } catch (std::filesystem::filesystem_error const &e) {