From c93893a56edf3eefd101accbcfbd49dd1c6f9354 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 4 Nov 2018 10:19:01 +0100 Subject: [PATCH] parser: fix multiline and nested parsing --- parser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parser.cpp b/parser.cpp index 4027591..190b8cd 100644 --- a/parser.cpp +++ b/parser.cpp @@ -101,12 +101,13 @@ std::string Parser::processLink(const PageDao &pageDao, UrlProvider &urlProvider std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, std::string content) const { std::string result; - std::regex tagfinder(R"(\[(.*?)\](.*?)\[/\1\])"); + std::regex tagfinder(R"(\[(.*?)\]((\s|\S)*?)\[/\1\])"); result = utils::regex_callback_replacer(tagfinder, content, [&](std::smatch &match) { std::string tag = match.str(1); std::string content = match.str(2); - std::string justreplace[] = { "b", "i", "u"}; + std::string justreplace[] = { "b", "i", "u", "ul", "li", "ol"}; + content = parse(pagedao, provider, content); if(std::find(std::begin(justreplace), std::end(justreplace), tag) != std::end(justreplace)) { return "<" + tag + ">" + content + "";