199 lines
9.3 KiB
Python
199 lines
9.3 KiB
Python
# -*- coding:utf-8 -*-
|
|
from mako import runtime, filters, cache
|
|
UNDEFINED = runtime.UNDEFINED
|
|
__M_dict_builtin = dict
|
|
__M_locals_builtin = locals
|
|
_magic_number = 10
|
|
_modified_time = 1433984407.4403968
|
|
_enable_loop = True
|
|
_template_filename = '/usr/lib/python3.4/site-packages/nikola/data/themes/base/templates/post_helper.tmpl'
|
|
_template_uri = 'post_helper.tmpl'
|
|
_source_encoding = 'utf-8'
|
|
_exports = ['meta_translations', 'html_pager', 'open_graph_metadata', 'twitter_card_information', 'mathjax_script', 'html_tags']
|
|
|
|
|
|
def render_body(context,**pageargs):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
__M_locals = __M_dict_builtin(pageargs=pageargs)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
__M_writer('\n\n')
|
|
__M_writer('\n\n')
|
|
__M_writer('\n\n')
|
|
__M_writer('\n\n')
|
|
__M_writer('\n\n')
|
|
__M_writer('\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_meta_translations(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
len = context.get('len', UNDEFINED)
|
|
translations = context.get('translations', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if len(translations) > 1:
|
|
for langname in translations.keys():
|
|
if langname != lang and post.is_translation_available(langname):
|
|
__M_writer(' <link rel="alternate" hreflang="')
|
|
__M_writer(str(langname))
|
|
__M_writer('" href="')
|
|
__M_writer(str(post.permalink(langname)))
|
|
__M_writer('">\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_html_pager(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
messages = context.get('messages', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if post.prev_post or post.next_post:
|
|
__M_writer(' <ul class="pager">\n')
|
|
if post.prev_post:
|
|
__M_writer(' <li class="previous">\n <a href="')
|
|
__M_writer(str(post.prev_post.permalink()))
|
|
__M_writer('" rel="prev" title="')
|
|
__M_writer(filters.html_escape(str(post.prev_post.title())))
|
|
__M_writer('">')
|
|
__M_writer(str(messages("Previous post")))
|
|
__M_writer('</a>\n </li>\n')
|
|
if post.next_post:
|
|
__M_writer(' <li class="next">\n <a href="')
|
|
__M_writer(str(post.next_post.permalink()))
|
|
__M_writer('" rel="next" title="')
|
|
__M_writer(filters.html_escape(str(post.next_post.title())))
|
|
__M_writer('">')
|
|
__M_writer(str(messages("Next post")))
|
|
__M_writer('</a>\n </li>\n')
|
|
__M_writer(' </ul>\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_open_graph_metadata(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
striphtml = context.get('striphtml', UNDEFINED)
|
|
use_open_graph = context.get('use_open_graph', UNDEFINED)
|
|
blog_title = context.get('blog_title', UNDEFINED)
|
|
url_replacer = context.get('url_replacer', UNDEFINED)
|
|
abs_link = context.get('abs_link', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
permalink = context.get('permalink', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if use_open_graph:
|
|
__M_writer(' <meta property="og:site_name" content="')
|
|
__M_writer(striphtml(str(blog_title)))
|
|
__M_writer('">\n <meta property="og:title" content="')
|
|
__M_writer(filters.html_escape(str(post.title()[:70])))
|
|
__M_writer('">\n <meta property="og:url" content="')
|
|
__M_writer(str(abs_link(permalink)))
|
|
__M_writer('">\n')
|
|
if post.description():
|
|
__M_writer(' <meta property="og:description" content="')
|
|
__M_writer(filters.html_escape(str(post.description()[:200])))
|
|
__M_writer('">\n')
|
|
else:
|
|
__M_writer(' <meta property="og:description" content="')
|
|
__M_writer(filters.html_escape(str(post.text(strip_html=True)[:200])))
|
|
__M_writer('">\n')
|
|
if post.previewimage:
|
|
__M_writer(' <meta property="og:image" content="')
|
|
__M_writer(str(url_replacer(permalink, post.previewimage, lang, 'absolute')))
|
|
__M_writer('">\n')
|
|
__M_writer(' <meta property="og:type" content="article">\n')
|
|
if post.date.isoformat():
|
|
__M_writer(' <meta property="article:published_time" content="')
|
|
__M_writer(str(post.date.isoformat()))
|
|
__M_writer('">\n')
|
|
if post.tags:
|
|
for tag in post.tags:
|
|
__M_writer(' <meta property="article:tag" content="')
|
|
__M_writer(str(tag))
|
|
__M_writer('">\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_twitter_card_information(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
twitter_card = context.get('twitter_card', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if twitter_card and twitter_card['use_twitter_cards']:
|
|
__M_writer(' <meta name="twitter:card" content="')
|
|
__M_writer(filters.html_escape(str(twitter_card.get('card', 'summary'))))
|
|
__M_writer('">\n')
|
|
if 'site:id' in twitter_card:
|
|
__M_writer(' <meta name="twitter:site:id" content="')
|
|
__M_writer(str(twitter_card['site:id']))
|
|
__M_writer('">\n')
|
|
elif 'site' in twitter_card:
|
|
__M_writer(' <meta name="twitter:site" content="')
|
|
__M_writer(str(twitter_card['site']))
|
|
__M_writer('">\n')
|
|
if 'creator:id' in twitter_card:
|
|
__M_writer(' <meta name="twitter:creator:id" content="')
|
|
__M_writer(str(twitter_card['creator:id']))
|
|
__M_writer('">\n')
|
|
elif 'creator' in twitter_card:
|
|
__M_writer(' <meta name="twitter:creator" content="')
|
|
__M_writer(str(twitter_card['creator']))
|
|
__M_writer('">\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_mathjax_script(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if post.is_mathjax:
|
|
__M_writer(' <script type="text/x-mathjax-config">\n MathJax.Hub.Config({tex2jax: {inlineMath: [[\'$latex \',\'$\'], [\'\\\\(\',\'\\\\)\']]}});</script>\n <script src="/assets/js/mathjax.js"></script>\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_html_tags(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
hidden_tags = context.get('hidden_tags', UNDEFINED)
|
|
_link = context.get('_link', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if post.tags:
|
|
__M_writer(' <ul itemprop="keywords" class="tags">\n')
|
|
for tag in post.tags:
|
|
if tag not in hidden_tags:
|
|
__M_writer(' <li><a class="tag p-category" href="')
|
|
__M_writer(str(_link('tag', tag)))
|
|
__M_writer('" rel="tag">')
|
|
__M_writer(str(tag))
|
|
__M_writer('</a></li>\n')
|
|
__M_writer(' </ul>\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
"""
|
|
__M_BEGIN_METADATA
|
|
{"uri": "post_helper.tmpl", "line_map": {"15": 0, "20": 2, "21": 11, "22": 23, "23": 40, "24": 69, "25": 85, "26": 93, "32": 3, "39": 3, "40": 4, "41": 5, "42": 6, "43": 7, "44": 7, "45": 7, "46": 7, "47": 7, "53": 25, "58": 25, "59": 26, "60": 27, "61": 28, "62": 29, "63": 30, "64": 30, "65": 30, "66": 30, "67": 30, "68": 30, "69": 33, "70": 34, "71": 35, "72": 35, "73": 35, "74": 35, "75": 35, "76": 35, "77": 38, "83": 42, "94": 42, "95": 43, "96": 44, "97": 44, "98": 44, "99": 45, "100": 45, "101": 46, "102": 46, "103": 47, "104": 48, "105": 48, "106": 48, "107": 49, "108": 50, "109": 50, "110": 50, "111": 52, "112": 53, "113": 53, "114": 53, "115": 55, "116": 60, "117": 61, "118": 61, "119": 61, "120": 63, "121": 64, "122": 65, "123": 65, "124": 65, "130": 71, "135": 71, "136": 72, "137": 73, "138": 73, "139": 73, "140": 74, "141": 75, "142": 75, "143": 75, "144": 76, "145": 77, "146": 77, "147": 77, "148": 79, "149": 80, "150": 80, "151": 80, "152": 81, "153": 82, "154": 82, "155": 82, "161": 87, "165": 87, "166": 88, "167": 89, "173": 13, "179": 13, "180": 14, "181": 15, "182": 16, "183": 17, "184": 18, "185": 18, "186": 18, "187": 18, "188": 18, "189": 21, "195": 189}, "source_encoding": "utf-8", "filename": "/usr/lib/python3.4/site-packages/nikola/data/themes/base/templates/post_helper.tmpl"}
|
|
__M_END_METADATA
|
|
"""
|