|
1 |
| -## -*- coding: utf-8 -*- |
2 |
| -<%namespace name="base" file="base_helper.tmpl" import="*"/> |
3 | 1 |
|
4 |
| -<%def name="html_header()"> |
5 |
| - <header id="header" role="banner"> |
6 |
| - ${html_site_title()} |
7 |
| - ${html_translation_header()} |
8 |
| - ${html_navigation_links()} |
9 |
| - %if search_form: |
10 |
| - <div class="searchform" role="search"> |
11 |
| - ${search_form} |
12 |
| - </div> |
13 |
| - %endif |
14 |
| - </header> |
15 |
| - ${template_hooks['page_header']()} |
16 |
| -</%def> |
| 2 | +- import "base_helper.jade" as helper with context |
17 | 3 |
|
18 |
| -<%def name="html_site_title()"> |
19 |
| - <h1 id="brand"><a href="${abs_link(_link("root", None, lang))}" title="${blog_title}" rel="home"> |
20 |
| - %if logo_url: |
21 |
| - <img src="${logo_url}" alt="${blog_title}" id="logo"> |
22 |
| - %endif |
| 4 | +mixin html_header() |
| 5 | + header(id="header", role="banner") |
| 6 | + != html_site_title() |
| 7 | + != html_translation_header() |
| 8 | + != html_navigation_links() |
| 9 | + if search_form |
| 10 | + div(class="searchform", role="search") |
| 11 | + != search_form |
| 12 | + != template_hooks['page_header']() |
23 | 13 |
|
24 |
| - % if show_blog_title: |
25 |
| - <span id="blog-title">${blog_title}</span> |
26 |
| - % endif |
27 |
| - </a></h1> |
28 |
| -</%def> |
| 14 | +mixin html_site_title() |
| 15 | + h1(id="brand") |
| 16 | + a(href="#{abs_link(_link("root", None, lang))}" title="#{blog_title}" rel="home") |
| 17 | + if logo_url |
| 18 | + img(src="#{logo_url}", alt="#{blog_title}", id="logo") |
| 19 | + if show_blog_title: |
| 20 | + span(id="blog-title") |
| 21 | + = blog_title |
29 | 22 |
|
30 |
| -<%def name="html_navigation_links()"> |
31 |
| - <nav id="menu" role="navigation"> |
32 |
| - <ul> |
33 |
| - %for url, text in navigation_links[lang]: |
34 |
| - % if isinstance(url, tuple): |
35 |
| - <li> ${text} |
36 |
| - <ul> |
37 |
| - %for suburl, text in url: |
38 |
| - % if rel_link(permalink, suburl) == "#": |
39 |
| - <li class="active"><a href="${permalink}">${text}</a></li> |
40 |
| - %else: |
41 |
| - <li><a href="${suburl}">${text}</a></li> |
42 |
| - %endif |
43 |
| - %endfor |
44 |
| - </ul> |
45 |
| - % else: |
46 |
| - % if rel_link(permalink, url) == "#": |
47 |
| - <li class="active"><a href="${permalink}">${text}</a></li> |
48 |
| - %else: |
49 |
| - <li><a href="${url}">${text}</a></li> |
50 |
| - %endif |
51 |
| - % endif |
52 |
| - %endfor |
53 |
| - ${template_hooks['menu']()} |
54 |
| - ${template_hooks['menu_alt']()} |
55 |
| - </ul> |
56 |
| - </nav> |
57 |
| -</%def> |
| 23 | +mixin html_navigation_links() |
| 24 | + nav(id="menu", role="navigation") |
| 25 | + ul |
| 26 | + for url, text in navigation_links[lang] |
| 27 | + if isinstance(url, tuple) |
| 28 | + li |
| 29 | + = text |
| 30 | + ul |
| 31 | + for suburl, text in url |
| 32 | + if rel_link(permalink, suburl) == "#" |
| 33 | + li(class="active") |
| 34 | + a(href="#{permalink}") |
| 35 | + = text |
| 36 | + else |
| 37 | + li |
| 38 | + a(href="#{suburl}") |
| 39 | + =text |
| 40 | + else |
| 41 | + if rel_link(permalink, url) == "#" |
| 42 | + li(class="active") |
| 43 | + a(href="#{permalink}") |
| 44 | + = text |
| 45 | + else |
| 46 | + li |
| 47 | + a(href="#{url}") |
| 48 | + = text |
58 | 49 |
|
59 |
| -<%def name="html_translation_header()"> |
60 |
| - %if len(translations) > 1: |
61 |
| - <div id="toptranslations"> |
62 |
| - <h2>${messages("Languages:")}</h2> |
63 |
| - ${base.html_translations()} |
64 |
| - </div> |
65 |
| - %endif |
66 |
| -</%def> |
| 50 | + != template_hooks['menu']() |
| 51 | + != template_hooks['menu_alt']() |
| 52 | + |
| 53 | +mixin html_translation_header() |
| 54 | + if len(translations) > 1 |
| 55 | + div(id="toptranslations") |
| 56 | + h2 |
| 57 | + = messages("Languages:") |
| 58 | + = base.html_translations() |
0 commit comments