diff --git a/awk/definition_lists.awk b/awk/definition_lists.awk index 13ed75d..a6bb767 100644 --- a/awk/definition_lists.awk +++ b/awk/definition_lists.awk @@ -8,7 +8,7 @@ BEGIN { if ($0 ~ /^
/) {
if (!in_pre) in_pre = 1
}
-
+
if (!in_pre && $0 ~ /^:[ \t]+[^ \t]/) {
if (!in_dl) {
in_dl = 1
@@ -24,7 +24,7 @@ BEGIN {
def_text = $0
sub(/^:[ \t]+/, "", def_text)
print "/) in_html_pre = 1
if ($0 ~ /<\/pre>/) { in_html_pre = 0; if (in_code) { print ""; in_code = 0 }; print; next }
-
+
if (!in_html_pre && $0 ~ /^(\t| )/) {
if (!in_code) { printf "%s", ""; in_code = 1 }
sub(/^(\t| )/, "", $0)
@@ -10,7 +10,7 @@ BEGIN { in_code = 0; in_html_pre = 0 }
print
next
}
-
+
if (in_code) {
print ""
in_code = 0
diff --git a/awk/lists.awk b/awk/lists.awk
index e3d4b83..27cea1f 100644
--- a/awk/lists.awk
+++ b/awk/lists.awk
@@ -30,7 +30,7 @@ BEGIN {
# get indentation level
match(line, /^[ \t]*/)
indent = RLENGTH
-
+
if (depth == 0 || indent > cur_indent[depth]) {
depth++
cur_indent[depth] = indent
diff --git a/awk/markdown_embed.awk b/awk/markdown_embed.awk
index 67189f9..6d73937 100644
--- a/awk/markdown_embed.awk
+++ b/awk/markdown_embed.awk
@@ -140,18 +140,18 @@ function css_highlight_line(line, m, prop, val) {
match(line, /:[[:space:]]*/)
sep_pos = RSTART
sep_len = RLENGTH
-
+
pre_sep = substr(line, 1, sep_pos - 1)
sep = substr(line, sep_pos, sep_len)
post_sep = substr(line, sep_pos + sep_len)
-
+
match(pre_sep, /--?[A-Za-z0-9_-]+/)
prop_pos = RSTART
prop_len = RLENGTH
-
+
indent = substr(pre_sep, 1, prop_pos - 1)
prop_name = substr(pre_sep, prop_pos, prop_len)
-
+
if (match(post_sep, /;[[:space:]]*$/)) {
val_part = substr(post_sep, 1, RSTART - 1)
suffix = substr(post_sep, RSTART)
@@ -159,11 +159,11 @@ function css_highlight_line(line, m, prop, val) {
val_part = post_sep
suffix = ""
}
-
+
prop = "" prop_name ""
gsub(/var\(--[A-Za-z0-9_-]+\)/, "&", val_part)
val = "" val_part ""
-
+
return indent prop sep val suffix
}
diff --git a/awk/mask_inline_code.awk b/awk/mask_inline_code.awk
index 022381d..eb47e3a 100644
--- a/awk/mask_inline_code.awk
+++ b/awk/mask_inline_code.awk
@@ -46,14 +46,9 @@ function mask(s, t) {
while (match(substr(line, p), /`+/)) {
pstart = p + RSTART - 1
plen = RLENGTH
- if (plen >= 3) {
- out = out substr(line, p, pstart - p + plen)
- p = pstart + plen
- continue
- }
- # Found 1 or 2 backticks at pstart
- # Search for closing marker
+ # Found backtick sequence at pstart
+ # Search for closing marker of same length
marker = substr(line, pstart, plen)
tail = substr(line, pstart + plen)
mpos = index(tail, marker)
@@ -65,11 +60,11 @@ function mask(s, t) {
p = pstart + plen
continue
}
-
+
# Found match!
content = substr(tail, 1, mpos - 1)
out = out substr(line, p, pstart - p)
- if (plen == 2 && substr(content, 1, 1) == " " && substr(content, length(content), 1) == " ") {
+ if (plen >= 2 && substr(content, 1, 1) == " " && substr(content, length(content), 1) == " ") {
content = substr(content, 2, length(content) - 2)
}
out = out "" mask(content) ""
diff --git a/awk/mask_plain.awk b/awk/mask_plain.awk
index 196a763..40ee3c3 100644
--- a/awk/mask_plain.awk
+++ b/awk/mask_plain.awk
@@ -56,7 +56,7 @@ BEGIN { in_plain = 0; in_script_style = 0 }
script_start = RSTART; script_len = RLENGTH
pos_style = match(tolower(tmp_line), /