summary refs log tree commit diff stats
path: root/fwendplanet_html.awk
diff options
context:
space:
mode:
Diffstat (limited to 'fwendplanet_html.awk')
-rwxr-xr-xfwendplanet_html.awk70
1 files changed, 70 insertions, 0 deletions
diff --git a/fwendplanet_html.awk b/fwendplanet_html.awk new file mode 100755 index 0000000..c4ebe0e --- /dev/null +++ b/fwendplanet_html.awk
@@ -0,0 +1,70 @@
1#!/bin/awk -f
2# Convert sfeed(1) formatted files into an HTML webpage for fwends
3# Usage: sfeed_html.awk -- FILES...
4BEGIN {
5 TITLE = "fwend planet"
6 FS = "\t"
7}
8
9BEGIN {
10 print "<!DOCTYPE html>"
11 print "<html>"
12 print "<head>"
13 print "<meta charset=\"utf-8\">"
14 print "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">"
15 print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
16 print "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"
17 print "<title>" TITLE "</title>"
18 print "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">"
19 print "</head>"
20 print "<body>"
21 print "<h1>fwend planet</h1>"
22}
23
24{
25 # Collect fields
26 timestamp = $1
27 title = $2
28 link = $3
29 content = unescape($4)
30 content_type = $5
31 id = $6
32 author = $7
33 enclosure = $8
34 category = $9
35 print "<details>"
36 print "<summary>" title "</summary>"
37 print "<div class=\"links\">"
38 print "<a href=\"" link "\">read original</a>"
39 if (enclosure) {
40 print "<a href=\"" enclosure "\">enclosure</a>"
41 }
42 print "</div>"
43 print "<div class=\"content\">" content "</div>"
44 print "<details class=\"info\"><summary>item information</summary>"
45 print "timestamp: " timestamp
46 print "title: " title
47 print "link: " link
48 print "content_type: " content_type
49 print "id: " id
50 print "author: " author
51 print "enclosure: " enclosure
52 print "category: " category
53 print "</details>"
54 print "</details>"
55}
56
57END {
58 print "<a href=\"mailto:fwends@me.acdw.net\">email acdw</a> if you have issues."
59 print "</body>"
60 print "</html>"
61}
62
63
64function unescape(t)
65{
66 gsub(/\\t/, "\t", t)
67 gsub(/\\n/, "\n", t)
68 gsub(/\\\\/, "\\", t)
69 return t
70}