about summary refs log tree commit diff stats
path: root/sfeed_weed.awk
diff options
context:
space:
mode:
Diffstat (limited to 'sfeed_weed.awk')
-rwxr-xr-xsfeed_weed.awk44
1 files changed, 44 insertions, 0 deletions
diff --git a/sfeed_weed.awk b/sfeed_weed.awk new file mode 100755 index 0000000..182aadf --- /dev/null +++ b/sfeed_weed.awk
@@ -0,0 +1,44 @@
1#!/bin/awk -f
2# convert weeds files to an html page
3BEGIN {
4 FS = "\t"
5 print "<!DOCTYPE html>"
6 print "<html>"
7 print "<head><title>Weed Garden</title>"
8 print "<meta charset=\"utf-8\">"
9 print "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">"
10 print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
11 print "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"
12 print "<link rel=\"stylesheet\" type=\"text/css\" href=\"weed.css\">"
13 print "</head>"
14 print "<body>"
15}
16
17{
18 timestamp = $1
19 title = $2
20 link = $3
21 content = $4
22 content_type = $5
23 id = $6
24 author = $7
25 enclosure = $8
26 category = $9
27 datecmd = "date -u -d \"@" timestamp "\" '+%F (%a) %R'"
28 datecmd | getline published
29 close(datecmd)
30 gsub(/\\t/, "\t", content)
31 gsub(/\\n/, "\n", content)
32 gsub(/\\/, "\\", content)
33 print "<article>"
34 print "<header><h2>" title "</h2><h3>by " author "</h3>"
35 print "<time>" published "</time></header>"
36 print content
37 print "</article>"
38}
39
40END {
41 print "</body>"
42 print "</html>"
43}
44