gdritter repos lib-static / 05e7823
start to add opengraph preview Getty Ritter 4 years ago
5 changed file(s) with 24 addition(s) and 2 deletion(s). Collapse all Expand all
1111 with open(arg[1:]) as f: return coerce(f.read())
1212 except: pass
1313 if arg == '-': return coerce(sys.stdin.read())
14 try: return yaml.loads(arg)
14 try: return yaml.safe_load(arg)
1515 except: pass
1616 try: return json.loads(arg)
1717 except: pass
1212 return coerce(f.read())
1313 except: pass
1414 if arg == '-': return coerce(sys.stdin.read())
15 try: return yaml.load(arg)
15 try: return yaml.safe_load(arg)
1616 except: pass
1717 try: return json.loads(arg)
1818 except: pass
1 #!/bin/python2
2
3 import json
4 import markdown
5 import sys
6
7 o = json.loads(sys.stdin.read())
8 l = o[0]
9 print(l['content'].encode('utf-8'))
10 if 'author' in l:
11 print('')
12 print((u'---' + l['author']).encode('utf-8'))
Binary diff not shown
99 <script language="javascript" src="/static/jquery.js"></script>
1010 <script language="javascript" src="/static/quotes.js"></script>
1111 {{/usejs}}
12 {{#opengraph}}
13 <meta property="og:title" content="{{title}}"/>
14 <meta property="og:type" content="website"/>
15 <meta property="og:url" content="{{url}}"/>
16 <meta property="og:description" content="{{description}}"/>
17 <meta property="og:image" content="/static/icon.png"/>
18 <meta property="og:image:width" content="120"/>
19 <meta property="og:image:height" content="120"/>
20 <meta property="og:site_name" content="Librarian of Alexandria"/>
21 {{/opengraph}}
1222 <link rel="stylesheet" type="text/css" href="/static/main.css" />
1323 <title>Librarian of Alexandria: {{title}}</title>
1424 </head>