start to add opengraph preview
Getty Ritter
4 years ago
11 | 11 |
with open(arg[1:]) as f: return coerce(f.read())
|
12 | 12 |
except: pass
|
13 | 13 |
if arg == '-': return coerce(sys.stdin.read())
|
14 | |
try: return yaml.loads(arg)
|
| 14 |
try: return yaml.safe_load(arg)
|
15 | 15 |
except: pass
|
16 | 16 |
try: return json.loads(arg)
|
17 | 17 |
except: pass
|
12 | 12 |
return coerce(f.read())
|
13 | 13 |
except: pass
|
14 | 14 |
if arg == '-': return coerce(sys.stdin.read())
|
15 | |
try: return yaml.load(arg)
|
| 15 |
try: return yaml.safe_load(arg)
|
16 | 16 |
except: pass
|
17 | 17 |
try: return json.loads(arg)
|
18 | 18 |
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'))
|
9 | 9 |
<script language="javascript" src="/static/jquery.js"></script>
|
10 | 10 |
<script language="javascript" src="/static/quotes.js"></script>
|
11 | 11 |
{{/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}}
|
12 | 22 |
<link rel="stylesheet" type="text/css" href="/static/main.css" />
|
13 | 23 |
<title>Librarian of Alexandria: {{title}}</title>
|
14 | 24 |
</head>
|