regexp escape sequence `\"' is not a known regexp operator for gawk

This commit is contained in:
Nero 2023-05-09 10:56:05 +00:00
parent 6c831dc78f
commit a59d19fa3d

12
md2html
View File

@ -63,7 +63,7 @@ function escape(text) {
gsub(/&/, "\\&", text)
gsub(/</, "\\&lt;", text)
gsub(/>/, "\\&gt;", text)
gsub(/\"/, "\\&quot;", text)
gsub(/"/, "\\&quot;", text)
return text
}
@ -237,7 +237,7 @@ function escape(text) {
gsub(/&/, "\\&amp;", text)
gsub(/</, "\\&lt;", text)
gsub(/>/, "\\&gt;", text)
gsub(/\"/, "\\&quot;", text)
gsub(/"/, "\\&quot;", text)
return text
}
@ -246,13 +246,13 @@ function inline(text) {
text = gensub(/\*\*([^\*]*)\*\*/, "<strong>\\1</strong>", "g", text)
text = gensub(/\*([^\*]*)\*/, "<em>\\1</em>", "g", text)
text = gensub(/`([^`]*)`/, "<code>\\1</code>", "g", text)
text = gensub(/\[(.*)\]\((.*)\)/, "<a href=\"\\2\">\\1</a>", "g", text)
text = gensub(/\[(.*)\]\((.*)\)/, "<a href=\"\\2\">\\1</a>", "g", text)
return text
}
/<body lang=/ {
lang=$0
gsub(/^.*lang=\"*/,"",lang)
gsub(/^.*lang="*/,"",lang)
gsub(/[^a-z].*$/,"",lang)
level("summary")
oneliner("h2", tocname[lang])
@ -260,8 +260,8 @@ function inline(text) {
/<h[2-6] / {
id=$0
gsub(/^.*id=\"/,"",id)
gsub(/\">.*$/,"",id)
gsub(/^.*id="/,"",id)
gsub(/">.*$/,"",id)
d=$1
gsub(/^<h/, "", d)
gsub(/ *<[^>]*>/, "", $0)