Finished unordered list implementation
Finished the unordered list implementation in MarkdownParser.
This commit is contained in:
parent
58710d07c5
commit
5ecf95a4bf
|
@ -42,6 +42,7 @@ std::string make_html(std::filesystem::path const &path) {
|
|||
tag_i = false,
|
||||
tag_p = false,
|
||||
tag_li = false,
|
||||
tag_ul = false,
|
||||
// If there is an escape character at the end of the buffer, use
|
||||
// this flag to prevent ignoring it.
|
||||
escaping = false,
|
||||
|
@ -62,6 +63,13 @@ std::string make_html(std::filesystem::path const &path) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// End ul tag if it's active and a new line doesn't contain an
|
||||
// item.
|
||||
if (tag_ul && buf[0] != '-') {
|
||||
tag_ul = false;
|
||||
html += "</ul>";
|
||||
}
|
||||
|
||||
// Read character by character
|
||||
for (int x = 0; x < buflen; x++) {
|
||||
char c = buf[x];
|
||||
|
@ -83,6 +91,7 @@ std::string make_html(std::filesystem::path const &path) {
|
|||
html += '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
// Start paragraph if newline and no
|
||||
// special characters were matched.
|
||||
|
||||
|
@ -177,6 +186,8 @@ std::string make_html(std::filesystem::path const &path) {
|
|||
break;
|
||||
}
|
||||
|
||||
// Start unordered list tag if it's not active.
|
||||
if (!tag_ul) html += "<ul>", tag_ul = true;
|
||||
html += "<li>";
|
||||
ignoreSpace = true;
|
||||
tag_li = true;
|
||||
|
|
Loading…
Reference in New Issue