~chambln/gmi

e00d16fca1191494cd39fe4fc9b3b2fd255f54a8 — Gregory Chamberlain 23 days ago d12895e
Fix Awk regex and remove some whitespace

* Escaped the backslash that escapes the asterisk
* Removed some whitespace to fit this in 80 characters
2 files changed, 4 insertions(+), 4 deletions(-)

M contrib/gemtext.awk
M gmi
M contrib/gemtext.awk => contrib/gemtext.awk +2 -2
@@ 2,6 2,6 @@

/^```/ { pre = (pre + 1) % 2; next }
pre { $0 = "\033[3m\033[32m" $0 }
! pre { sub("^##?#?", "&\033[1m") || sub("^>", "&\033[33m") || sub("^\*", "•") }
! pre && sub("^=>", "") { $1 = "[" ++i "] \033[4m\033[34m" $1 "\033[m" }
!pre {sub("^##?#?", "&\033[1m") || sub("^>", "&\033[33m") || sub("^\\*", "•")}
!pre && sub("^=>", "") { $1 = "[" ++i "] \033[4m\033[34m" $1 "\033[m" }
{ print $0 "\033[m" }

M gmi => gmi +2 -2
@@ 3,8 3,8 @@
AWK_GEMTEXT=$(cat) <<'EOF'
/^```/ { pre = (pre + 1) % 2; next }
pre { $0 = "\033[3m\033[32m" $0 }
! pre { sub("^##?#?", "&\033[1m") || sub("^>", "&\033[33m") || sub("^\*", "•") }
! pre && sub("^=>", "") { $1 = "[" ++i "] \033[4m\033[34m" $1 "\033[m" }
!pre {sub("^##?#?", "&\033[1m") || sub("^>", "&\033[33m") || sub("^\\*", "•")}
!pre && sub("^=>", "") { $1 = "[" ++i "] \033[4m\033[34m" $1 "\033[m" }
{ print $0 "\033[m" }
EOF