diff options
Diffstat (limited to 'alabaster-lite/sidebars')
-rw-r--r-- | alabaster-lite/sidebars/about.html | 16 | ||||
-rw-r--r-- | alabaster-lite/sidebars/navigation.html | 50 | ||||
-rw-r--r-- | alabaster-lite/sidebars/related.html | 15 | ||||
-rw-r--r-- | alabaster-lite/sidebars/toc.html | 28 |
4 files changed, 109 insertions, 0 deletions
diff --git a/alabaster-lite/sidebars/about.html b/alabaster-lite/sidebars/about.html new file mode 100644 index 0000000..674dab4 --- /dev/null +++ b/alabaster-lite/sidebars/about.html @@ -0,0 +1,16 @@ +{% if theme.logo %} + <p class="logo"> + <a href="{{nav.homepage.url|url}}"> + <img class="logo" src="{{base_url}}/{{theme.logo}}" title="{{theme.logo_title}}"> + </a> + </p> + {% if theme.logo_name %} + <h1 class="logo">{{ config.site_name }}</h1> + {% endif %} +{% else %} + <h1 class="logo"><a href="{{nav.homepage.url|url}}">{{ config.site_name }}</a></h1> +{% endif %} + +{% if config.site_description %} + <p class="blurb">{{ config.site_description }}</p> +{% endif %} diff --git a/alabaster-lite/sidebars/navigation.html b/alabaster-lite/sidebars/navigation.html new file mode 100644 index 0000000..3d609b0 --- /dev/null +++ b/alabaster-lite/sidebars/navigation.html @@ -0,0 +1,50 @@ +{% macro _toc_tree_inner(toc) -%} + <ul> + {% for toc_item in toc %} + <li><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li> + {{ _toc_tree_inner(toc_item.children) }} + {% endfor %} + </ul> +{%- endmacro %} + +{% macro toc_tree(toc) -%} + {# This ignores H1s #} + {% for toc_item in toc %} + {{ _toc_tree_inner(toc_item.children) }} + {% endfor %} +{%- endmacro %} + +{% macro nav_tree(nav) -%} + <ul> + {% for nav_item in nav %} + {% if not nav_item.children %} + <li> + <a href="{{ nav_item.url }}">{{ nav_item.title }}</a> + </li> + {% if nav_item == page %} + {{ toc_tree(page.toc) }} + {% endif %} + {% else %} + <li> + {{ nav_item.title }} + {{ nav_tree(nav_item.children) }} + </li> + {% endif %} + {% endfor %} + </ul> +{%- endmacro %} + +<h3>Navigation</h3> + +<nav> + {{ nav_tree(nav) }} + + {% if theme.extra_nav_links %} + <hr> + <ul> + {% for text, uri in theme.extra_nav_links.items() %} + <li class="toctree-l1"><a href="{{ uri }}">{{ text }}</a></li> + {% endfor %} + </ul> + {% endif %} +</nav> diff --git a/alabaster-lite/sidebars/related.html b/alabaster-lite/sidebars/related.html new file mode 100644 index 0000000..f49e019 --- /dev/null +++ b/alabaster-lite/sidebars/related.html @@ -0,0 +1,15 @@ +{% if page.previous_page or page.next_page %} + <h3>Related Topics</h3> + <ul> + {% if page.previous_page %} + <li>Previous: <a href="{{page.previous_page.url|url}}" title="previous chapter"> + {{page.previous_page.title}} + </a></li> + {% endif %} + {% if page.next_page %} + <li>Next: <a href="{{page.next_page.url|url}}" title="next chapter"> + {{page.next_page.title}} + </a></li> + {% endif %} + </ul> +{% endif %} diff --git a/alabaster-lite/sidebars/toc.html b/alabaster-lite/sidebars/toc.html new file mode 100644 index 0000000..cce0f4a --- /dev/null +++ b/alabaster-lite/sidebars/toc.html @@ -0,0 +1,28 @@ +{% macro _toc_tree_inner(toc) -%} + <ul> + {% for toc_item in toc %} + <li><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li> + {{ _toc_tree_inner(toc_item.children) }} + {% endfor %} + </ul> +{%- endmacro %} + +{% macro toc_tree(toc) -%} + {# This ignores H1s #} + {% for toc_item in toc %} + {{ _toc_tree_inner(toc_item.children) }} + {% endfor %} +{%- endmacro %} + +<nav> + {{ toc_tree(page.toc) }} + + {% if theme.extra_nav_links %} + <hr> + <ul> + {% for text, uri in theme.extra_nav_links.items() %} + <li class="toctree-l1"><a href="{{ uri }}">{{ text }}</a></li> + {% endfor %} + </ul> + {% endif %} +</nav> |