diff options
1 files changed, 24 insertions, 24 deletions
| -rw-r--r-- | single.awk | 48 |
@@ -104,30 +104,6 @@ BEGIN { next } -# Automatic links -/<[^ \t<>]+>/ { - ## URL: <uri_scheme:...> - while (match($0, /<[A-Za-z][-A-Za-z0-9+.]*:[^ \t<>]+>/)) { - href = substr($0, RSTART + 1, RLENGTH - 2) - sub_match("<a href=\"" href "\">" href "</a>") - } - - ## Email addresses, with support for quoted local part "..."@... - ## and ip address literal ...@[...] - while (match($0, /<([^ \t<>]+|".+")@([-A-Za-z0-9]+\.[^ \t<>]+|\[[0-9A-Fa-f.:]+\])>/)) { - href = substr($0, RSTART + 1, RLENGTH - 2) - href_masked = "" - ## The original markdown blogpost calls for convertions of all - ## email characters into their hex values. Allegedly, this fools - ## many autoharvesting spam bots. - for (i = length(href); i > 0; --i) { - href_masked = sprintf("&#x%X;", char_to_dec[char(href, i)]) href_masked - } - ## href="mailto:..." - sub_match("<a href=\"mailto:" href_masked "\">" href_masked "</a>") - } -} - # Blockquotes blockquote_level > 0 && empty0 { for (P1 = P1 ORS; blockquote_level > 0; --blockquote_level) { @@ -172,6 +148,30 @@ inside_codeblock && ! /^[ \t]*$/ { emptyP1 = 1 } +# Automatic links +/<[^ \t<>]+>/ { + ## URL: <uri_scheme:...> + while (match($0, /<[A-Za-z][-A-Za-z0-9+.]*:[^ \t<>]+>/)) { + href = substr($0, RSTART + 1, RLENGTH - 2) + sub_match("<a href=\"" href "\">" href "</a>") + } + + ## Email addresses, with support for quoted local part "..."@... + ## and ip address literal ...@[...] + while (match($0, /<([^ \t<>]+|".+")@([-A-Za-z0-9]+\.[^ \t<>]+|\[[0-9A-Fa-f.:]+\])>/)) { + href = substr($0, RSTART + 1, RLENGTH - 2) + href_masked = "" + ## The original markdown blogpost calls for convertions of all + ## email characters into their hex values. Allegedly, this fools + ## many autoharvesting spam bots. + for (i = length(href); i > 0; --i) { + href_masked = sprintf("&#x%X;", char_to_dec[char(href, i)]) href_masked + } + ## href="mailto:..." + sub_match("<a href=\"mailto:" href_masked "\">" href_masked "</a>") + } +} + # Line break / $/ { sub(/[ \t]* $/, "</br>") |
