Add initial <ul> list support
Added initial support for unordered lists. This update adds <li> tags, but doesn't add <ul> tags.
This commit is contained in:
parent
81b523d312
commit
58710d07c5
|
@ -41,6 +41,7 @@ std::string make_html(std::filesystem::path const &path) {
|
||||||
bool tag_b = false,
|
bool tag_b = false,
|
||||||
tag_i = false,
|
tag_i = false,
|
||||||
tag_p = false,
|
tag_p = false,
|
||||||
|
tag_li = false,
|
||||||
// If there is an escape character at the end of the buffer, use
|
// If there is an escape character at the end of the buffer, use
|
||||||
// this flag to prevent ignoring it.
|
// this flag to prevent ignoring it.
|
||||||
escaping = false,
|
escaping = false,
|
||||||
|
@ -78,13 +79,15 @@ std::string make_html(std::filesystem::path const &path) {
|
||||||
html += ">";
|
html += ">";
|
||||||
tag_h = 0;
|
tag_h = 0;
|
||||||
}
|
}
|
||||||
|
if (tag_li) html += "</li>", tag_li = false;
|
||||||
html += '\n';
|
html += '\n';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Start paragraph if newline and no
|
// Start paragraph if newline and no
|
||||||
// special characters were matched.
|
// special characters were matched.
|
||||||
|
|
||||||
if (!tag_p && newline && x == 0 && c != '#')
|
if (!tag_p && newline && x == 0 &&
|
||||||
|
c != '#' && c != '-')
|
||||||
html += "<p>",
|
html += "<p>",
|
||||||
tag_p = true;
|
tag_p = true;
|
||||||
|
|
||||||
|
@ -167,6 +170,16 @@ std::string make_html(std::filesystem::path const &path) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
if (x != 0) {
|
||||||
|
html += c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "<li>";
|
||||||
|
ignoreSpace = true;
|
||||||
|
tag_li = true;
|
||||||
break;
|
break;
|
||||||
case ' ':
|
case ' ':
|
||||||
if (ignoreSpace) {
|
if (ignoreSpace) {
|
||||||
|
|
Loading…
Reference in New Issue