From d1358f7e770900d4b22af89be633daca7f07e793 Mon Sep 17 00:00:00 2001 From: "Albert S." Date: Mon, 23 Dec 2024 10:43:58 +0100 Subject: [PATCH] Remove whitespace from id links, fix
closing --- handlers/handlerpageview.cpp | 2 +- parser.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/handlers/handlerpageview.cpp b/handlers/handlerpageview.cpp index 441269b..8cf9c7a 100644 --- a/handlers/handlerpageview.cpp +++ b/handlers/handlerpageview.cpp @@ -60,7 +60,7 @@ std::string HandlerPageView::createIndexContent(IParser &parser, std::string con } previous = h.level; HtmlLink link; - link.href = "#" + h.title; + link.href = "#" + utils::strreplace(h.title, " ", ""); link.innervalue = h.title; link.cssclass = "indexlink"; indexcontent += "
  • " + link.render() + "
  • "; diff --git a/parser.cpp b/parser.cpp index e260dae..7963267 100644 --- a/parser.cpp +++ b/parser.cpp @@ -191,6 +191,10 @@ std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, const s { newlines = "
    "; } + if(tag == "br") + { + return std::string("
    "); + } if(tag != "code" && tag != "blockquote") { content = parse(pagedao, provider, content, callback); @@ -220,7 +224,7 @@ std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, const s } if(tag[0] == 'h') { - return "<" + tag + " id='" + content + "'>" + content + ""; + return "<" + tag + " id='" + utils::strreplace(content, " ", "") + "'>" + content + ""; } if(tag == "code" || tag == "blockquote") {