Summary Files Commits Branches @commit @diff @stats
path: root / single.awk
diff options
context:
space:
mode:
Commite42c3000981b928aa1d1bab23855fe2f0bfc5db4 (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-07-23 18:19:16 +0300
Committer
 Syndamia <kamen@syndamia.com>
2024-07-23 18:19:16 +0300
Files1aa5a709366aab2b87f246141a532c457b50aab4 /single.awk
csg-e42c3000981b928aa1d1bab23855fe2f0bfc5db4.tar
csg-e42c3000981b928aa1d1bab23855fe2f0bfc5db4.tar.gz
csg-e42c3000981b928aa1d1bab23855fe2f0bfc5db4.zip
Parentc67dd619cc887371a989105d517ab5715049cf9c (diff)
(single) Fixed inline links/images incorrectly adding title when URL ends with a quoted expression
1 files changed, 3 insertions, 4 deletions
-rw-r--r--single.awk7
diff --git a/single.awk b/single.awk
index 708158f..ac2eb7a 100644
--- a/single.awk
+++ b/single.awk
@@ -259,15 +259,15 @@ blankline {
match(substr($0, astart), /\]\([^)]*\)/)
aend += RLENGTH - 2 ## aend = indexof(")")
href = substr($0, astart + RSTART + 1, RLENGTH - 3) ## ...[...](xxxxx)...
- sub(/[ \t]+/, "", href)
- if (match(href, /"[^"]*"[ \t]*$/)) {
- title = substr(href, RSTART, RLENGTH)
+ if (match(href, /[ \t]"[^"]*"[ \t]*$/)) {
+ title = substr(href, RSTART + 1, RLENGTH - 1)
href = substr(href, 1, RSTART - 1)
}
else {
title = "\"\""
}
+ sub(/[ \t]+/, "", href)
if (isimg) elem = "<img src=\"" href "\" alt=\"" inner_anchor "\" title=" title ">"
else elem = "<a href=\"" href "\" title=" title ">" inner_anchor "</a>"
@@ -296,7 +296,6 @@ function surround(brace, opening, closing) {
surround("`" , "<code>" , "</code>")
}
-
!prev_blankline && /^: / {
sub(/^<p>/, "", prev)
sub(/^: /, "")