parser: Render <code> and <blockquote> preformated
This commit is contained in:
parent
78b9e5e043
commit
fbfe5510a1
@ -155,8 +155,11 @@ std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, const s
|
|||||||
{
|
{
|
||||||
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", "ul", "li", "ol", "code", "blockquote"};
|
std::string justreplace[] = {"b", "i", "u", "ul", "li", "ol"};
|
||||||
|
if(tag != "code" && tag != "blockquote")
|
||||||
|
{
|
||||||
content = parse(pagedao, provider, content, callback);
|
content = parse(pagedao, provider, content, callback);
|
||||||
|
}
|
||||||
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 + ">";
|
||||||
@ -175,6 +178,10 @@ std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, const s
|
|||||||
{
|
{
|
||||||
return "<" + tag + " id='" + content + "'>" + content + "</" + tag + ">";
|
return "<" + tag + " id='" + content + "'>" + content + "</" + tag + ">";
|
||||||
}
|
}
|
||||||
|
if(tag == "code" || tag == "blockquote")
|
||||||
|
{
|
||||||
|
return "<pre><" + tag + ">"+ utils::strreplace(content, "\r\n", "\n") + "</"+tag+"></pre>";
|
||||||
|
}
|
||||||
return callback(tag, content);
|
return callback(tag, content);
|
||||||
});
|
});
|
||||||
result = utils::strreplace(result, "\r\n", "<br>");
|
result = utils::strreplace(result, "\r\n", "<br>");
|
||||||
|
Loading…
Reference in New Issue
Block a user