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 = 1433984407.2754643
|
|
_enable_loop = True
|
|
_template_filename = 'themes/bootstrap3/templates/base_helper.tmpl'
|
|
_template_uri = 'base_helper.tmpl'
|
|
_source_encoding = 'utf-8'
|
|
_exports = ['html_navigation_links', 'late_load_js', 'html_feedlinks', 'html_stylesheets', 'html_headstart', 'html_translations']
|
|
|
|
|
|
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_html_navigation_links(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
tuple = context.get('tuple', UNDEFINED)
|
|
isinstance = context.get('isinstance', UNDEFINED)
|
|
navigation_links = context.get('navigation_links', UNDEFINED)
|
|
rel_link = context.get('rel_link', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
permalink = context.get('permalink', 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_late_load_js(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
use_cdn = context.get('use_cdn', UNDEFINED)
|
|
colorbox_locales = context.get('colorbox_locales', UNDEFINED)
|
|
use_bundles = context.get('use_bundles', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
social_buttons_code = context.get('social_buttons_code', 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_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()
|
|
|
|
|
|
def render_html_stylesheets(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
use_cdn = context.get('use_cdn', UNDEFINED)
|
|
has_custom_css = context.get('has_custom_css', UNDEFINED)
|
|
post = context.get('post', UNDEFINED)
|
|
use_bundles = context.get('use_bundles', UNDEFINED)
|
|
notes = context.get('notes', UNDEFINED)
|
|
annotations = context.get('annotations', 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_headstart(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
permalink = context.get('permalink', UNDEFINED)
|
|
twitter_card = context.get('twitter_card', UNDEFINED)
|
|
comment_system_id = context.get('comment_system_id', UNDEFINED)
|
|
extra_head_data = context.get('extra_head_data', UNDEFINED)
|
|
description = context.get('description', UNDEFINED)
|
|
favicons = context.get('favicons', UNDEFINED)
|
|
prevlink = context.get('prevlink', UNDEFINED)
|
|
def html_feedlinks():
|
|
return render_html_feedlinks(context)
|
|
is_rtl = context.get('is_rtl', UNDEFINED)
|
|
use_open_graph = context.get('use_open_graph', UNDEFINED)
|
|
blog_title = context.get('blog_title', UNDEFINED)
|
|
use_cdn = context.get('use_cdn', UNDEFINED)
|
|
url_replacer = context.get('url_replacer', UNDEFINED)
|
|
def html_stylesheets():
|
|
return render_html_stylesheets(context)
|
|
nextlink = context.get('nextlink', UNDEFINED)
|
|
comment_system = context.get('comment_system', UNDEFINED)
|
|
abs_link = context.get('abs_link', UNDEFINED)
|
|
mathjax_config = context.get('mathjax_config', UNDEFINED)
|
|
title = context.get('title', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
striphtml = context.get('striphtml', 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_translations(context):
|
|
__M_caller = context.caller_stack._push_frame()
|
|
try:
|
|
messages = context.get('messages', UNDEFINED)
|
|
translations = context.get('translations', UNDEFINED)
|
|
lang = context.get('lang', UNDEFINED)
|
|
_link = context.get('_link', 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()
|
|
|
|
|
|
"""
|
|
__M_BEGIN_METADATA
|
|
{"uri": "base_helper.tmpl", "line_map": {"15": 0, "20": 2, "21": 65, "22": 92, "23": 122, "24": 145, "25": 159, "26": 167, "32": 124, "42": 124, "43": 125, "44": 126, "45": 127, "46": 127, "47": 127, "48": 129, "49": 130, "50": 131, "51": 131, "52": 131, "53": 131, "54": 131, "55": 132, "56": 133, "57": 133, "58": 133, "59": 133, "60": 133, "61": 136, "62": 137, "63": 138, "64": 139, "65": 139, "66": 139, "67": 139, "68": 139, "69": 140, "70": 141, "71": 141, "72": 141, "73": 141, "74": 141, "80": 67, "89": 67, "90": 68, "91": 69, "92": 70, "93": 73, "94": 74, "95": 76, "96": 77, "97": 78, "98": 80, "99": 81, "100": 86, "101": 88, "102": 89, "103": 89, "104": 89, "105": 91, "106": 91, "107": 91, "113": 147, "122": 147, "123": 148, "124": 149, "125": 149, "126": 149, "127": 150, "128": 151, "129": 152, "130": 153, "131": 153, "132": 153, "133": 153, "134": 153, "135": 155, "136": 156, "137": 156, "138": 156, "144": 95, "154": 95, "155": 96, "156": 97, "157": 98, "158": 100, "159": 101, "160": 103, "161": 104, "162": 105, "163": 106, "164": 107, "165": 109, "166": 113, "167": 114, "168": 117, "169": 118, "170": 118, "171": 118, "172": 119, "173": 120, "174": 120, "175": 120, "181": 3, "208": 3, "209": 7, "210": 8, "211": 9, "212": 10, "213": 12, "214": 13, "215": 15, "216": 16, "217": 18, "218": 21, "219": 22, "220": 25, "221": 25, "222": 25, "223": 28, "224": 29, "225": 29, "226": 29, "227": 31, "228": 32, "229": 32, "230": 32, "231": 32, "232": 34, "233": 34, "234": 35, "235": 35, "236": 36, "237": 37, "238": 37, "239": 37, "240": 39, "241": 40, "242": 41, "243": 42, "244": 42, "245": 42, "246": 42, "247": 42, "248": 42, "249": 42, "250": 45, "251": 46, "252": 47, "253": 47, "254": 47, "255": 49, "256": 50, "257": 51, "258": 51, "259": 51, "260": 53, "261": 54, "262": 54, "263": 54, "264": 56, "265": 57, "266": 57, "267": 58, "268": 59, "269": 60, "270": 61, "271": 61, "272": 61, "273": 63, "274": 64, "275": 64, "281": 161, "289": 161, "290": 162, "291": 163, "292": 164, "293": 164, "294": 164, "295": 164, "296": 164, "297": 164, "298": 164, "304": 298}, "source_encoding": "utf-8", "filename": "themes/bootstrap3/templates/base_helper.tmpl"}
|
|
__M_END_METADATA
|
|
"""
|