#!/usr/bin/awk -f BEGIN{ # Printing header! if(ENVIRON["baseURL"] == ""){ baseURL="/" } else { baseURL = ENVIRON["baseURL"] } if(ENVIRON["webLang"] == ""){ webLang="en" } else { webLang = ENVIRON["webLang"] } printf("\n\ \n\
\n\ \n\"
next
}
/^```/&&(pre == 1){
pre = 0
print ""
next
}
(pre == 1){
print $0
next
}
# We insert empty lines only if there is more than one. We don't need to add
# extra spacing between paragraphs.
/^[ \t]*$/&&(emptyLine == 0){
emptyLine = 1
next
}
/^[ \t]*$/&&(emptyLine == 1){
print "" next } /^=>/{ sub(/^=>[ \t]*/, "") url=$0 sub(/[ \t].*$/, "", url) text=$0 sub(/^[^ \t]*/, "", text) sub(/[ \t]*$/, "", text) sub(/^[ \t]*/, "", text) # If it's a local gemini file, link to the html: if((url !~ /^[a-zA-Z]*:\/\//) && ((url ~ /\.gmi$/) || (url ~ /\.gemini$/))){ sub(/\.gmi$/, ".html", url) sub(/\.gemini$/, ".html", url) } if(text == ""){ text = url } if(text ~ lImg){ sub(lImg,"",text) sub(/^[ \t]*/,"",text) print "" } else { print "" } next } { print "> "$0"
"$0"
" } END{ # Closes open list if(list == 1){ print "" } print "\n" }