page view: fix messed up ul close tags
Αυτή η υποβολή περιλαμβάνεται σε:
γονέας
2d0bd713e5
υποβολή
15c5b66800
@ -38,25 +38,32 @@ std::string HandlerPageView::createIndexContent(IParser &parser, std::string con
|
||||
{
|
||||
std::vector<Headline> headlines = parser.extractHeadlines(content);
|
||||
std::string indexcontent = "";
|
||||
unsigned int l = 0;
|
||||
unsigned int previous = 0;
|
||||
for(const Headline &h : headlines)
|
||||
{
|
||||
if(h.level > l)
|
||||
if(h.level > previous)
|
||||
{
|
||||
indexcontent += "<ul>";
|
||||
}
|
||||
else if(h.level < l)
|
||||
else if(h.level < previous)
|
||||
{
|
||||
indexcontent += "</ul>";
|
||||
unsigned int diff = previous - h.level;
|
||||
for(unsigned int i = 0; i < diff; i++)
|
||||
{
|
||||
indexcontent += "</ul>";
|
||||
}
|
||||
}
|
||||
l = h.level;
|
||||
previous = h.level;
|
||||
HtmlLink link;
|
||||
link.href = "#" + h.title;
|
||||
link.innervalue = h.title;
|
||||
link.cssclass = "indexlink";
|
||||
indexcontent += "<li>" + link.render() + "</li>";
|
||||
}
|
||||
indexcontent += "</ul>";
|
||||
for(unsigned int i = 0; i < previous; i++)
|
||||
{
|
||||
indexcontent += "</ul>";
|
||||
}
|
||||
return indexcontent;
|
||||
}
|
||||
|
||||
|
Φόρτωση…
Αναφορά σε νέο ζήτημα
Block a user