BEGIN{
# Printing header!
if(ENVIRON["baseURL"] == ""){
baseURL="/"
} else {
baseURL = ENVIRON["baseURL"]
}
if(ENVIRON["webLang"] == ""){
webLang="en"
} else {
webLang = ENVIRON["webLang"]
}
printf("<!DOCTYPE html>\n\
<meta charset=\"utf-8\" />\n\
<title>^_^</title>\n\
<link rel=\"stylesheet\" type=\"text/css\" href=\"%s/style.css\">\n\
# Link types
lImg = "^pic:"
# Control variables
pre = 0
list = 0
}
{
gsub(/&/, "\\&")
gsub(/</, "\\<")
gsub(/>/, "\\>")
}
/^```/&&(pre == 0){
# We must close the list!
if(list == 1){
list = 0
print "</ul>"
}
emptyLine = 0
pre = 1
printf "<pre><code>"
next
}
/^```/&&(pre == 1){
pre = 0
print "</code></pre>"
next
}
(pre == 1){
print $0
next
}
/^[ \t]*$/&&(emptyLine == 0){
emptyLine = 1
next
}
/^[ \t]*$/&&(emptyLine == 1){
print "<br/>"
next
}
(emptyLine == 1){
emptyLine = 0
}
/* /{
if(list == 0){
list = 1
print "<ul>"
}
sub(/\* [ \t]*/, "")
print "<li>"$0"</li>"
next
}
(list == 1){
list = 0
print "</ul>"
}
/^---/{
print "<hr/>"
next
}
/^###/{
sub(/^#[#]*[ \t]*/, "")
print "<h3>"$0"</h3>"
next
}
/^##/{
sub(/^#[#]*[ \t]*/, "")
print "<h2>"$0"</h2>"
next
}
/^#/{
sub(/^#[#]*[ \t]*/, "")
print "<h1>"$0"</h1>"
next
}
/^>/{
sub(/^>[ \t]*/, "")
print "<blockquote><p>> "$0"</p></blockquote>"
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 "<p class=\"img\"><a href=\""url"\"><img src=\""url"\"/>"text"</a></p>"
} else {
print "<p><a href=\""url"\">⇒ "text"</a></p>"
}
next
}
{
print "<p>"$0"</p>"
}
END{
# Closes open list
if(list == 1){
print "</ul>"
}
print "</body>\n</html>"
}
application/octet-stream
This content has been proxied by September (3851b).