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 = 1434031207.9149005
|
|
_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 = ['open_graph_metadata', 'html_tags', 'meta_translations', 'twitter_card_information', 'html_pager', 'mathjax_script']
|
|
|
|
|
|
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_open_graph_metadata(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
permalink = context.get('permalink', UNDEFINED)
|
|
striphtml = context.get('striphtml', UNDEFINED)
|
|
blog_title = context.get('blog_title', UNDEFINED)
|
|
use_open_graph = context.get('use_open_graph', UNDEFINED)
|
|
abs_link = context.get('abs_link', UNDEFINED)
|
|
url_replacer = context.get('url_replacer', UNDEFINED)
|
|
lang = context.get('lang', 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_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()
|
|
|
|
|
|
def render_meta_translations(context,post):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
translations = context.get('translations', UNDEFINED)
|
|
len = context.get('len', 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_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_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_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()
|
|
|
|
|
|
"""
|
|
__M_BEGIN_METADATA
|
|
{"filename": "/usr/lib/python3.4/site-packages/nikola/data/themes/base/templates/post_helper.tmpl", "uri": "post_helper.tmpl", "source_encoding": "utf-8", "line_map": {"15": 0, "20": 2, "21": 11, "22": 23, "23": 40, "24": 69, "25": 85, "26": 93, "32": 42, "43": 42, "44": 43, "45": 44, "46": 44, "47": 44, "48": 45, "49": 45, "50": 46, "51": 46, "52": 47, "53": 48, "54": 48, "55": 48, "56": 49, "57": 50, "58": 50, "59": 50, "60": 52, "61": 53, "62": 53, "63": 53, "64": 55, "65": 60, "66": 61, "67": 61, "68": 61, "69": 63, "70": 64, "71": 65, "72": 65, "73": 65, "79": 13, "85": 13, "86": 14, "87": 15, "88": 16, "89": 17, "90": 18, "91": 18, "92": 18, "93": 18, "94": 18, "95": 21, "101": 3, "108": 3, "109": 4, "110": 5, "111": 6, "112": 7, "113": 7, "114": 7, "115": 7, "116": 7, "122": 71, "127": 71, "128": 72, "129": 73, "130": 73, "131": 73, "132": 74, "133": 75, "134": 75, "135": 75, "136": 76, "137": 77, "138": 77, "139": 77, "140": 79, "141": 80, "142": 80, "143": 80, "144": 81, "145": 82, "146": 82, "147": 82, "153": 25, "158": 25, "159": 26, "160": 27, "161": 28, "162": 29, "163": 30, "164": 30, "165": 30, "166": 30, "167": 30, "168": 30, "169": 33, "170": 34, "171": 35, "172": 35, "173": 35, "174": 35, "175": 35, "176": 35, "177": 38, "183": 87, "187": 87, "188": 88, "189": 89, "195": 189}}
|
|
__M_END_METADATA
|
|
"""
|