parser: fix multiline and nested parsing
This commit is contained in:
parent
3bfebfe8a8
commit
b6cdf9a088
@ -99,11 +99,12 @@ std::string Parser::processLink(const PageDao &pageDao, UrlProvider &urlProvider
|
|||||||
std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, std::string content) const
|
std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, std::string content) const
|
||||||
{
|
{
|
||||||
std::string result;
|
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) {
|
result = utils::regex_callback_replacer(tagfinder, content, [&](std::smatch &match) {
|
||||||
std::string tag = match.str(1);
|
std::string tag = match.str(1);
|
||||||
std::string content = match.str(2);
|
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))
|
if(std::find(std::begin(justreplace), std::end(justreplace), tag) != std::end(justreplace))
|
||||||
{
|
{
|
||||||
return "<" + tag + ">" + content + "</" + tag + ">";
|
return "<" + tag + ">" + content + "</" + tag + ">";
|
||||||
|
Loading…
Reference in New Issue
Block a user