aboutsummaryrefslogtreecommitdiff
path: root/templates.go
blob: f26a0b1e5192203f16115a571165d996415bbb90 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package main

const rssRoot = `
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>{{title}}</title>
    <link>{{link}}</link>
    <description>{{description}}</description>
    <generator>fbfeed</generator>
    {{items}}
  </channel>
</rss>
`

const rssItem = `
<item>
  <title>{{time}}</title>
  <pubDate>{{time}}</pubDate>
  <link>{{link}}</link>
  <description>{{content}}</description>
</item>
`

const htmlRoot = `
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>{{title}} &middot; fbfeed</title>
  	<style type="text/css">
	body {
		font-size: 14pt;
		line-height: 1.2;
		max-width: 1200px;
		margin: 0 auto;
		padding: 0.5em;
		word-wrap: break-word;
	}
	article {
		margin-bottom: 1em;
	}
	article datetime {
		font-weight: bold;
	}
	article pre {
		margin: 0;
		padding-left: 1em;
		font-family: inherit;
		word-wrap: break-word;
		white-space: pre-line;
	}
	div#images {
		padding-left: 1em;
	}
	img {
		max-height: 200px;
		max-width: 200px;
		height: auto;
		width: auto;
		border-radius: 12px;
		padding: 0.2em;
	}
  	</style>
</head>
<body>
	<header>
		<h1>{{title}}</h1>
		<a href="{{link}}">{{link}}</a>
		<p>{{description}}</p>
	</header>
	<hr>
	<main>
		{{items}}
	</main>
	<hr>
	<footer>
		<small>Generated by <a href="https://git.vty.se/fbfeed.git/about/">fbfeed</a> &middot; <a href="/{{name}}.rss">rss feed</a></small>
	</footer>
</body>

</html>
`

const htmlItem = `
<article>
<datetime>{{time}}</datetime>
<pre>{{content}}</pre>
<div id="images">{{images}}</div>
</article>
`