|
1 |
| -## -*- coding: utf-8 -*- |
| 1 | +{# -*- coding: utf-8 -*- #} |
2 | 2 |
|
3 |
| -<%namespace name="notes" file="annotation_helper.tmpl" import="*" /> |
4 |
| -<%def name="html_headstart()"> |
| 3 | +{% import 'annotation_helper.tmpl' as notes with context %} |
| 4 | +{% macro html_headstart() %} |
5 | 5 | <!DOCTYPE html>
|
6 | 6 | <html
|
7 |
| -\ |
8 |
| -% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook'): |
9 |
| -prefix='\ |
10 |
| -%if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']): |
11 |
| -og: http://ogp.me/ns# \ |
12 |
| -%endif |
13 |
| -%if use_open_graph: |
14 |
| -article: http://ogp.me/ns/article# \ |
15 |
| -%endif |
16 |
| -%if comment_system == 'facebook': |
17 |
| -fb: http://ogp.me/ns/fb# \ |
18 |
| -%endif |
19 |
| -'\ |
20 |
| -%endif |
21 |
| -\ |
22 |
| -% if is_rtl: |
23 |
| -dir="rtl" \ |
24 |
| -% endif |
25 |
| -\ |
26 |
| -lang="${lang}"> |
| 7 | + |
| 8 | +{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook') %} |
| 9 | +prefix=' |
| 10 | +{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %} |
| 11 | +og: http://ogp.me/ns# |
| 12 | +{% endif %} |
| 13 | +{% if use_open_graph %} |
| 14 | +article: http://ogp.me/ns/article# |
| 15 | +{% endif %} |
| 16 | +{% if comment_system == 'facebook' %} |
| 17 | +fb: http://ogp.me/ns/fb# |
| 18 | +{% endif %} |
| 19 | +' |
| 20 | +{% endif %} |
| 21 | + |
| 22 | +{% if is_rtl %} |
| 23 | +dir="rtl" |
| 24 | +{% endif %} |
| 25 | + |
| 26 | +lang="{{ lang }}"> |
27 | 27 | <head>
|
28 | 28 | <meta charset="utf-8">
|
29 |
| - %if description: |
30 |
| - <meta name="description" content="${description}"> |
31 |
| - %endif |
32 |
| - <meta name="viewport" content="width=device-width"> |
33 |
| - <title>${title|striphtml} | ${blog_title|striphtml}</title> |
| 29 | + {% if description %} |
| 30 | + <meta name="description" content="{{ description }}"> |
| 31 | + {% endif %} |
| 32 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 33 | + <title>{{ title|e }} | {{ blog_title|e }}</title> |
34 | 34 |
|
35 |
| - ${html_stylesheets()} |
36 |
| - ${html_feedlinks()} |
37 |
| - %if permalink: |
38 |
| - <link rel="canonical" href="${abs_link(permalink)}"> |
39 |
| - %endif |
| 35 | + {{ html_stylesheets() }} |
| 36 | + {{ html_feedlinks() }} |
| 37 | + {% if permalink %} |
| 38 | + <link rel="canonical" href="{{ abs_link(permalink) }}"> |
| 39 | + {% endif %} |
40 | 40 |
|
41 |
| - %if favicons: |
42 |
| - %for name, file, size in favicons: |
43 |
| - <link rel="${name}" href="${file}" sizes="${size}"/> |
44 |
| - %endfor |
45 |
| - %endif |
| 41 | + {% if favicons %} |
| 42 | + {% for name, file, size in favicons %} |
| 43 | + <link rel="{{ name }}" href="{{ file }}" sizes="{{ size }}"/> |
| 44 | + {% endfor %} |
| 45 | + {% endif %} |
46 | 46 |
|
47 |
| - % if comment_system == 'facebook': |
48 |
| - <meta property="fb:app_id" content="${comment_system_id}"> |
49 |
| - % endif |
| 47 | + {% if comment_system == 'facebook' %} |
| 48 | + <meta property="fb:app_id" content="{{ comment_system_id }}"> |
| 49 | + {% endif %} |
50 | 50 |
|
51 |
| - %if prevlink: |
52 |
| - <link rel="prev" href="${prevlink}" type="text/html"> |
53 |
| - %endif |
54 |
| - %if nextlink: |
55 |
| - <link rel="next" href="${nextlink}" type="text/html"> |
56 |
| - %endif |
| 51 | + {% if prevlink %} |
| 52 | + <link rel="prev" href="{{ prevlink }}" type="text/html"> |
| 53 | + {% endif %} |
| 54 | + {% if nextlink %} |
| 55 | + <link rel="next" href="{{ nextlink }}" type="text/html"> |
| 56 | + {% endif %} |
57 | 57 |
|
58 |
| - ${mathjax_config} |
59 |
| - %if use_cdn: |
| 58 | + {% if use_cdn %} |
60 | 59 | <!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
61 |
| - %else: |
62 |
| - <!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]--> |
63 |
| - %endif |
| 60 | + {% else %} |
| 61 | + <!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]--> |
| 62 | + {% endif %} |
| 63 | + <script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script> |
| 64 | + <script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script> |
| 65 | + {{ extra_head_data }} |
| 66 | +{% endmacro %} |
64 | 67 |
|
65 |
| - ${extra_head_data} |
66 |
| -</%def> |
67 |
| - |
68 |
| - |
69 |
| -<%def name="late_load_js()"> |
70 |
| - %if use_bundles: |
71 |
| - %if use_cdn: |
72 |
| - <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> |
73 |
| - <script src="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> |
| 68 | +{% macro late_load_js() %} |
| 69 | + {% if use_bundles %} |
| 70 | + {% if use_cdn %} |
| 71 | + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> |
| 72 | + <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> |
74 | 73 | <script src="/assets/js/all.js"></script>
|
75 |
| - %else: |
| 74 | + {% else %} |
76 | 75 | <script src="/assets/js/all-nocdn.js"></script>
|
77 |
| - %endif |
78 |
| - %else: |
79 |
| - %if use_cdn: |
80 |
| - <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> |
81 |
| - <script src="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> |
82 |
| - %else: |
| 76 | + {% endif %} |
| 77 | + {% else %} |
| 78 | + {% if use_cdn %} |
| 79 | + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> |
| 80 | + <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> |
| 81 | + {% else %} |
83 | 82 | <script src="/assets/js/jquery.min.js"></script>
|
84 | 83 | <script src="/assets/js/bootstrap.min.js"></script>
|
85 | 84 | <script src="/assets/js/moment-with-locales.min.js"></script>
|
86 | 85 | <script src="/assets/js/fancydates.js"></script>
|
87 |
| - %endif |
| 86 | + {% endif %} |
88 | 87 | <script src="/assets/js/jquery.colorbox-min.js"></script>
|
89 |
| - %endif |
90 |
| - %if colorbox_locales[lang]: |
91 |
| - <script src="/assets/js/colorbox-i18n/jquery.colorbox-${colorbox_locales[lang]}.js"></script> |
92 |
| - %endif |
93 |
| - ${social_buttons_code} |
94 |
| -</%def> |
| 88 | + {% endif %} |
| 89 | + {% if colorbox_locales[lang] %} |
| 90 | + <script src="/assets/js/colorbox-i18n/jquery.colorbox-{{ colorbox_locales[lang] }}.js"></script> |
| 91 | + {% endif %} |
| 92 | + {{ social_buttons_code }} |
| 93 | + <script> |
| 94 | + renderMathInElement(document.body); |
| 95 | + </script> |
| 96 | +{% endmacro %} |
95 | 97 |
|
96 | 98 |
|
97 |
| -<%def name="html_stylesheets()"> |
98 |
| - %if use_bundles: |
99 |
| - %if use_cdn: |
100 |
| - <link href="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> |
| 99 | +{% macro html_stylesheets() %} |
| 100 | + {% if use_bundles %} |
| 101 | + {% if use_cdn %} |
| 102 | + <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> |
101 | 103 | <link href="/assets/css/all.css" rel="stylesheet" type="text/css">
|
102 |
| - %else: |
| 104 | + {% else %} |
103 | 105 | <link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
|
104 |
| - %endif |
105 |
| - %else: |
106 |
| - %if use_cdn: |
107 |
| - <link href="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> |
108 |
| - %else: |
| 106 | + {% endif %} |
| 107 | + {% else %} |
| 108 | + {% if use_cdn %} |
| 109 | + <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> |
| 110 | + {% else %} |
109 | 111 | <link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
110 |
| - <link href="/assets/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"> |
111 |
| - %endif |
| 112 | + {% endif %} |
112 | 113 | <link href="/assets/css/rst.css" rel="stylesheet" type="text/css">
|
113 | 114 | <link href="/assets/css/code.css" rel="stylesheet" type="text/css">
|
114 | 115 | <link href="/assets/css/colorbox.css" rel="stylesheet" type="text/css">
|
115 | 116 | <link href="/assets/css/theme.css" rel="stylesheet" type="text/css">
|
116 |
| - %if has_custom_css: |
| 117 | + {% if has_custom_css %} |
117 | 118 | <link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
|
118 |
| - %endif |
119 |
| - %endif |
120 |
| - % if annotations and post and not post.meta('noannotations'): |
121 |
| - ${notes.css()} |
122 |
| - % elif not annotations and post and post.meta('annotations'): |
123 |
| - ${notes.css()} |
124 |
| - % endif |
125 |
| -</%def> |
126 |
| - |
| 119 | + {% endif %} |
| 120 | + {% endif %} |
| 121 | + {% if annotations and post and not post.meta('noannotations') %} |
| 122 | + {{ notes.css() }} |
| 123 | + {% elif not annotations and post and post.meta('annotations') %} |
| 124 | + {{ notes.css() }} |
| 125 | + {% endif %} |
| 126 | +{% endmacro %} |
127 | 127 |
|
128 |
| -<%def name="html_navigation_links()"> |
129 |
| - %for url, text in navigation_links[lang]: |
130 |
| - % if isinstance(url, tuple): |
131 |
| - <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">${text}<b class="caret"></b></a> |
| 128 | +{% macro html_navigation_links() %} |
| 129 | + {% for url, text in navigation_links[lang] %} |
| 130 | + {% if isinstance(url, tuple) %} |
| 131 | + <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ text }}<b class="caret"></b></a> |
132 | 132 | <ul class="dropdown-menu">
|
133 |
| - %for suburl, text in url: |
134 |
| - % if rel_link(permalink, suburl) == "#": |
135 |
| - <li class="active"><a href="${permalink}">${text}</a> |
136 |
| - %else: |
137 |
| - <li><a href="${suburl}">${text}</a> |
138 |
| - %endif |
139 |
| - %endfor |
| 133 | + {% for suburl, text in url %} |
| 134 | + {% if rel_link(permalink, suburl) == "#" %} |
| 135 | + <li class="active"><a href="{{ permalink }}">{{ text }}</a> |
| 136 | + {% else %} |
| 137 | + <li><a href="{{ suburl }}">{{ text }}</a> |
| 138 | + {% endif %} |
| 139 | + {% endfor %} |
140 | 140 | </ul>
|
141 |
| - % else: |
142 |
| - % if rel_link(permalink, url) == "#": |
143 |
| - <li class="active"><a href="${permalink}">${text}</a> |
144 |
| - %else: |
145 |
| - <li><a href="${url}">${text}</a> |
146 |
| - %endif |
147 |
| - % endif |
148 |
| - %endfor |
149 |
| -</%def> |
| 141 | + {% else %} |
| 142 | + {% if rel_link(permalink, url) == "#" %} |
| 143 | + <li class="active"><a href="{{ permalink }}">{{ text }}</a> |
| 144 | + {% else %} |
| 145 | + <li><a href="{{ url }}">{{ text }}</a> |
| 146 | + {% endif %} |
| 147 | + {% endif %} |
| 148 | + {% endfor %} |
| 149 | +{% endmacro %} |
150 | 150 |
|
151 |
| -<%def name="html_feedlinks()"> |
152 |
| - %if rss_link: |
153 |
| - ${rss_link} |
154 |
| - %elif generate_rss: |
155 |
| - %if len(translations) > 1: |
156 |
| - %for language in translations: |
157 |
| - <link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link('rss', None, language)}"> |
158 |
| - %endfor |
159 |
| - %else: |
160 |
| - <link rel="alternate" type="application/rss+xml" title="RSS" href="${_link('rss', None)}"> |
161 |
| - %endif |
162 |
| - %endif |
163 |
| -</%def> |
| 151 | +{% macro html_feedlinks() %} |
| 152 | + {% if rss_link %} |
| 153 | + {{ rss_link }} |
| 154 | + {% elif generate_rss %} |
| 155 | + {% if translations|length > 1 %} |
| 156 | + {% for language in translations %} |
| 157 | + <link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}"> |
| 158 | + {% endfor %} |
| 159 | + {% else %} |
| 160 | + <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link('rss', None) }}"> |
| 161 | + {% endif %} |
| 162 | + {% endif %} |
| 163 | +{% endmacro %} |
164 | 164 |
|
165 |
| -<%def name="html_translations()"> |
166 |
| - %for langname in translations.keys(): |
167 |
| - %if langname != lang: |
168 |
| - <li><a href="${abs_link(_link("root", None, langname))}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></li> |
169 |
| - %endif |
170 |
| - %endfor |
171 |
| -</%def> |
| 165 | +{% macro html_translations() %} |
| 166 | + {% for langname in translations.keys() %} |
| 167 | + {% if langname != lang %} |
| 168 | + <li><a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></li> |
| 169 | + {% endif %} |
| 170 | + {% endfor %} |
| 171 | +{% endmacro %} |
0 commit comments