blob: 436faac8b300fb862b0aec42fa97674069ce278e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/awk -f
# convert weeds files to an html page
BEGIN {
FS = "\t"
print "<!DOCTYPE html>"
print "<html>"
print "<head><title>Weed Garden</title>"
print "<meta charset=\"utf-8\">"
print "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">"
print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
print "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"weed.css\">"
print "</head>"
print "<body>"
}
{
if (++line > 50) {
# Only show the newest 50 things.
exit
}
timestamp = $1
title = $2
link = $3
content = $4
content_type = $5
id = $6
author = $7
enclosure = $8
category = $9
datecmd = "date -u -d \"@" timestamp "\" '+%F (%a) %R'"
datecmd | getline published
close(datecmd)
gsub(/\\t/, "\t", content)
if (title ~ /\[acdw\]/) {
sub(/^/, "<p>", content)
gsub(/\\n\\n/, "\\n<p>", content)
gsub(/\\n/, "\n", content)
} else {
gsub(/\\n/, "\n", content)
}
gsub(/\\/, "\\", content)
print "<article>"
print "<header><h2>" title "</h2>"
print "<time>" published "</time></header>"
print content
print "</article>"
}
END {
print "</body>"
print "</html>"
}
|