308 lines
16 KiB
Python
308 lines
16 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 = 1433908600.4133606
|
|
_enable_loop = True
|
|
_template_filename = 'themes/cyborg/templates/base_helper.tmpl'
|
|
_template_uri = 'base_helper.tmpl'
|
|
_source_encoding = 'utf-8'
|
|
_exports = ['late_load_js', 'html_navigation_links', 'html_stylesheets', 'html_translations', 'html_headstart', 'html_feedlinks']
|
|
|
|
|
|
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\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_late_load_js(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
lang = context.get('lang', UNDEFINED)
|
|
social_buttons_code = context.get('social_buttons_code', UNDEFINED)
|
|
colorbox_locales = context.get('colorbox_locales', UNDEFINED)
|
|
use_cdn = context.get('use_cdn', UNDEFINED)
|
|
use_bundles = context.get('use_bundles', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if use_bundles:
|
|
if use_cdn:
|
|
__M_writer(' <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>\n <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>\n <script src="/assets/js/all.js"></script>\n')
|
|
else:
|
|
__M_writer(' <script src="/assets/js/all-nocdn.js"></script>\n')
|
|
else:
|
|
if use_cdn:
|
|
__M_writer(' <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>\n <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>\n')
|
|
else:
|
|
__M_writer(' <script src="/assets/js/jquery.min.js"></script>\n <script src="/assets/js/bootstrap.min.js"></script>\n <script src="/assets/js/moment-with-locales.min.js"></script>\n <script src="/assets/js/fancydates.js"></script>\n')
|
|
__M_writer(' <script src="/assets/js/jquery.colorbox-min.js"></script>\n')
|
|
if colorbox_locales[lang]:
|
|
__M_writer(' <script src="/assets/js/colorbox-i18n/jquery.colorbox-')
|
|
__M_writer(str(colorbox_locales[lang]))
|
|
__M_writer('.js"></script>\n')
|
|
__M_writer(' ')
|
|
__M_writer(str(social_buttons_code))
|
|
__M_writer('\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_html_navigation_links(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
navigation_links = context.get('navigation_links', UNDEFINED)
|
|
permalink = context.get('permalink', UNDEFINED)
|
|
isinstance = context.get('isinstance', UNDEFINED)
|
|
rel_link = context.get('rel_link', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
tuple = context.get('tuple', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
for url, text in navigation_links[lang]:
|
|
if isinstance(url, tuple):
|
|
__M_writer(' <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">')
|
|
__M_writer(str(text))
|
|
__M_writer('<b class="caret"></b></a>\n <ul class="dropdown-menu">\n')
|
|
for suburl, text in url:
|
|
if rel_link(permalink, suburl) == "#":
|
|
__M_writer(' <li class="active"><a href="')
|
|
__M_writer(str(permalink))
|
|
__M_writer('">')
|
|
__M_writer(str(text))
|
|
__M_writer('</a>\n')
|
|
else:
|
|
__M_writer(' <li><a href="')
|
|
__M_writer(str(suburl))
|
|
__M_writer('">')
|
|
__M_writer(str(text))
|
|
__M_writer('</a>\n')
|
|
__M_writer(' </ul>\n')
|
|
else:
|
|
if rel_link(permalink, url) == "#":
|
|
__M_writer(' <li class="active"><a href="')
|
|
__M_writer(str(permalink))
|
|
__M_writer('">')
|
|
__M_writer(str(text))
|
|
__M_writer('</a>\n')
|
|
else:
|
|
__M_writer(' <li><a href="')
|
|
__M_writer(str(url))
|
|
__M_writer('">')
|
|
__M_writer(str(text))
|
|
__M_writer('</a>\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_html_stylesheets(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
use_cdn = context.get('use_cdn', UNDEFINED)
|
|
annotations = context.get('annotations', UNDEFINED)
|
|
post = context.get('post', UNDEFINED)
|
|
use_bundles = context.get('use_bundles', UNDEFINED)
|
|
has_custom_css = context.get('has_custom_css', UNDEFINED)
|
|
notes = context.get('notes', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if use_bundles:
|
|
if use_cdn:
|
|
__M_writer(' <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">\n <link href="/assets/css/all.css" rel="stylesheet" type="text/css">\n')
|
|
else:
|
|
__M_writer(' <link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css">\n')
|
|
else:
|
|
if use_cdn:
|
|
__M_writer(' <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">\n')
|
|
else:
|
|
__M_writer(' <link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">\n')
|
|
__M_writer(' <link href="/assets/css/rst.css" rel="stylesheet" type="text/css">\n <link href="/assets/css/code.css" rel="stylesheet" type="text/css">\n <link href="/assets/css/colorbox.css" rel="stylesheet" type="text/css">\n <link href="/assets/css/theme.css" rel="stylesheet" type="text/css">\n')
|
|
if has_custom_css:
|
|
__M_writer(' <link href="/assets/css/custom.css" rel="stylesheet" type="text/css">\n')
|
|
if annotations and post and not post.meta('noannotations'):
|
|
__M_writer(' ')
|
|
__M_writer(str(notes.css()))
|
|
__M_writer('\n')
|
|
elif not annotations and post and post.meta('annotations'):
|
|
__M_writer(' ')
|
|
__M_writer(str(notes.css()))
|
|
__M_writer('\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_html_translations(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
_link = context.get('_link', UNDEFINED)
|
|
messages = context.get('messages', UNDEFINED)
|
|
translations = context.get('translations', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
for langname in translations.keys():
|
|
if langname != lang:
|
|
__M_writer(' <li><a href="')
|
|
__M_writer(str(_link("index", None, langname)))
|
|
__M_writer('" rel="alternate" hreflang="')
|
|
__M_writer(str(langname))
|
|
__M_writer('">')
|
|
__M_writer(str(messages("LANGUAGE", langname)))
|
|
__M_writer('</a></li>\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_html_headstart(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
prevlink = context.get('prevlink', UNDEFINED)
|
|
description = context.get('description', UNDEFINED)
|
|
permalink = context.get('permalink', UNDEFINED)
|
|
extra_head_data = context.get('extra_head_data', UNDEFINED)
|
|
blog_title = context.get('blog_title', UNDEFINED)
|
|
use_cdn = context.get('use_cdn', UNDEFINED)
|
|
url_replacer = context.get('url_replacer', UNDEFINED)
|
|
is_rtl = context.get('is_rtl', UNDEFINED)
|
|
mathjax_config = context.get('mathjax_config', UNDEFINED)
|
|
def html_stylesheets():
|
|
return render_html_stylesheets(context)
|
|
use_open_graph = context.get('use_open_graph', UNDEFINED)
|
|
title = context.get('title', UNDEFINED)
|
|
nextlink = context.get('nextlink', UNDEFINED)
|
|
twitter_card = context.get('twitter_card', UNDEFINED)
|
|
def html_feedlinks():
|
|
return render_html_feedlinks(context)
|
|
striphtml = context.get('striphtml', UNDEFINED)
|
|
abs_link = context.get('abs_link', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
comment_system = context.get('comment_system', UNDEFINED)
|
|
comment_system_id = context.get('comment_system_id', UNDEFINED)
|
|
favicons = context.get('favicons', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n<!DOCTYPE html>\n<html\n')
|
|
if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook'):
|
|
__M_writer("prefix='")
|
|
if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']):
|
|
__M_writer('og: http://ogp.me/ns# ')
|
|
if use_open_graph:
|
|
__M_writer('article: http://ogp.me/ns/article# ')
|
|
if comment_system == 'facebook':
|
|
__M_writer('fb: http://ogp.me/ns/fb# ')
|
|
__M_writer("'")
|
|
if is_rtl:
|
|
__M_writer('dir="rtl" ')
|
|
__M_writer('lang="')
|
|
__M_writer(str(lang))
|
|
__M_writer('">\n <head>\n <meta charset="utf-8">\n')
|
|
if description:
|
|
__M_writer(' <meta name="description" content="')
|
|
__M_writer(str(description))
|
|
__M_writer('">\n')
|
|
__M_writer(' <meta name="viewport" content="width=device-width, initial-scale=1">\n <title>')
|
|
__M_writer(striphtml(str(title)))
|
|
__M_writer(' | ')
|
|
__M_writer(striphtml(str(blog_title)))
|
|
__M_writer('</title>\n\n ')
|
|
__M_writer(str(html_stylesheets()))
|
|
__M_writer('\n ')
|
|
__M_writer(str(html_feedlinks()))
|
|
__M_writer('\n')
|
|
if permalink:
|
|
__M_writer(' <link rel="canonical" href="')
|
|
__M_writer(str(abs_link(permalink)))
|
|
__M_writer('">\n')
|
|
__M_writer('\n')
|
|
if favicons:
|
|
for name, file, size in favicons:
|
|
__M_writer(' <link rel="')
|
|
__M_writer(str(name))
|
|
__M_writer('" href="')
|
|
__M_writer(str(file))
|
|
__M_writer('" sizes="')
|
|
__M_writer(str(size))
|
|
__M_writer('"/>\n')
|
|
__M_writer('\n')
|
|
if comment_system == 'facebook':
|
|
__M_writer(' <meta property="fb:app_id" content="')
|
|
__M_writer(str(comment_system_id))
|
|
__M_writer('">\n')
|
|
__M_writer('\n')
|
|
if prevlink:
|
|
__M_writer(' <link rel="prev" href="')
|
|
__M_writer(str(prevlink))
|
|
__M_writer('" type="text/html">\n')
|
|
if nextlink:
|
|
__M_writer(' <link rel="next" href="')
|
|
__M_writer(str(nextlink))
|
|
__M_writer('" type="text/html">\n')
|
|
__M_writer('\n ')
|
|
__M_writer(str(mathjax_config))
|
|
__M_writer('\n')
|
|
if use_cdn:
|
|
__M_writer(' <!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->\n')
|
|
else:
|
|
__M_writer(' <!--[if lt IE 9]><script src="')
|
|
__M_writer(str(url_replacer(permalink, '/assets/js/html5.js', lang)))
|
|
__M_writer('"></script><![endif]-->\n')
|
|
__M_writer('\n ')
|
|
__M_writer(str(extra_head_data))
|
|
__M_writer('\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
def render_html_feedlinks(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
rss_link = context.get('rss_link', UNDEFINED)
|
|
len = context.get('len', UNDEFINED)
|
|
generate_rss = context.get('generate_rss', UNDEFINED)
|
|
translations = context.get('translations', UNDEFINED)
|
|
_link = context.get('_link', UNDEFINED)
|
|
__M_writer = context.writer()
|
|
__M_writer('\n')
|
|
if rss_link:
|
|
__M_writer(' ')
|
|
__M_writer(str(rss_link))
|
|
__M_writer('\n')
|
|
elif generate_rss:
|
|
if len(translations) > 1:
|
|
for language in translations:
|
|
__M_writer(' <link rel="alternate" type="application/rss+xml" title="RSS (')
|
|
__M_writer(str(language))
|
|
__M_writer(')" href="')
|
|
__M_writer(str(_link('rss', None, language)))
|
|
__M_writer('">\n')
|
|
else:
|
|
__M_writer(' <link rel="alternate" type="application/rss+xml" title="RSS" href="')
|
|
__M_writer(str(_link('rss', None)))
|
|
__M_writer('">\n')
|
|
return ''
|
|
finally:
|
|
context.caller_stack._pop_frame()
|
|
|
|
|
|
"""
|
|
__M_BEGIN_METADATA
|
|
{"source_encoding": "utf-8", "filename": "themes/cyborg/templates/base_helper.tmpl", "line_map": {"15": 0, "20": 2, "21": 65, "22": 92, "23": 122, "24": 145, "25": 159, "26": 167, "32": 67, "41": 67, "42": 68, "43": 69, "44": 70, "45": 73, "46": 74, "47": 76, "48": 77, "49": 78, "50": 80, "51": 81, "52": 86, "53": 88, "54": 89, "55": 89, "56": 89, "57": 91, "58": 91, "59": 91, "65": 124, "75": 124, "76": 125, "77": 126, "78": 127, "79": 127, "80": 127, "81": 129, "82": 130, "83": 131, "84": 131, "85": 131, "86": 131, "87": 131, "88": 132, "89": 133, "90": 133, "91": 133, "92": 133, "93": 133, "94": 136, "95": 137, "96": 138, "97": 139, "98": 139, "99": 139, "100": 139, "101": 139, "102": 140, "103": 141, "104": 141, "105": 141, "106": 141, "107": 141, "113": 95, "123": 95, "124": 96, "125": 97, "126": 98, "127": 100, "128": 101, "129": 103, "130": 104, "131": 105, "132": 106, "133": 107, "134": 109, "135": 113, "136": 114, "137": 117, "138": 118, "139": 118, "140": 118, "141": 119, "142": 120, "143": 120, "144": 120, "150": 161, "158": 161, "159": 162, "160": 163, "161": 164, "162": 164, "163": 164, "164": 164, "165": 164, "166": 164, "167": 164, "173": 3, "200": 3, "201": 7, "202": 8, "203": 9, "204": 10, "205": 12, "206": 13, "207": 15, "208": 16, "209": 18, "210": 21, "211": 22, "212": 25, "213": 25, "214": 25, "215": 28, "216": 29, "217": 29, "218": 29, "219": 31, "220": 32, "221": 32, "222": 32, "223": 32, "224": 34, "225": 34, "226": 35, "227": 35, "228": 36, "229": 37, "230": 37, "231": 37, "232": 39, "233": 40, "234": 41, "235": 42, "236": 42, "237": 42, "238": 42, "239": 42, "240": 42, "241": 42, "242": 45, "243": 46, "244": 47, "245": 47, "246": 47, "247": 49, "248": 50, "249": 51, "250": 51, "251": 51, "252": 53, "253": 54, "254": 54, "255": 54, "256": 56, "257": 57, "258": 57, "259": 58, "260": 59, "261": 60, "262": 61, "263": 61, "264": 61, "265": 63, "266": 64, "267": 64, "273": 147, "282": 147, "283": 148, "284": 149, "285": 149, "286": 149, "287": 150, "288": 151, "289": 152, "290": 153, "291": 153, "292": 153, "293": 153, "294": 153, "295": 155, "296": 156, "297": 156, "298": 156, "304": 298}, "uri": "base_helper.tmpl"}
|
|
__M_END_METADATA
|
|
"""
|