Compare commits

..

2 Commits
dev ... master

Author SHA1 Message Date
adf285d723 forgot all lines of unordered lists
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-01-28 16:15:05 +01:00
61a0348e38 adding replaceInline to unordered lists
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-01-28 16:09:58 +01:00
2 changed files with 2 additions and 13 deletions

View File

@ -45,14 +45,6 @@ function replaceInline(line, result, start, end) {
# Build the result: before match, <em>, content, </em>, after match
line = substr(line, 1, start-1) "<em>" substr(line, start+1, RLENGTH-2) "</em>" substr(line, end+1)
}
# Replace occurrences of `...` with <code>...</code>
while (match(line, /`([^`]+)`/)) {
start = RSTART
end = RSTART + RLENGTH - 1
# Build the result: before match, <em>, content, </em>, after match
line = substr(line, 1, start-1) "<code>" substr(line, start+1, RLENGTH-2) "</code>" substr(line, end+1)
}
# Replace occurances of [link](url) with <a href="url">link</<a>
while (match(line, /\[([^\]]+)\]\([^\)]+\)/)) {
@ -104,11 +96,11 @@ function closeOne() {
env = last()
if (env == "ul" ) {
# In a unordered list block, print a new item
print "<li>" substr($0, 3) "</li>"
print "<li>" replaceInline(substr($0, 3)) "</li>"
} else {
# Otherwise, init the unordered list block
push("ul")
print "<ul>\n<li>" substr($0, 3) "</li>"
print "<ul>\n<li>" replaceInline(substr($0, 3)) "</li>"
}
}

View File

@ -116,9 +116,6 @@ declare -a tests=(
"A link to [wikipedia](https://www.wikipedia.org)"
"<p>A link to <a href=\"https://www.wikipedia.org\">wikipedia</a></p>"
"Inline code"
"A simple function \`printf()\`"
"<p>A simple function <code>printf()</code></p>"
# You can add more test cases following the same format...
)