1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-24 07:30:12 +01:00

Fixed #9: Text for prev/next footer navigation should be customizable

This commit is contained in:
squidfunk 2016-02-24 12:40:02 +01:00
parent 60f2982c25
commit bf8be26e0a
12 changed files with 70 additions and 82 deletions

View File

@ -1,3 +1,8 @@
mkdocs-material-0.x.x (2016-xx-xx)
* Fixed #9: Text for prev/next footer navigation should be customizable
* Refactored templates (replaced if/else with modifiers where possible)
mkdocs-material-0.1.3 (2016-02-21) mkdocs-material-0.1.3 (2016-02-21)
* Fixed #3: Ordered lists within an unordered list have ::before content * Fixed #3: Ordered lists within an unordered list have ::before content

View File

@ -34,7 +34,7 @@
{% if config.extra.logo %} {% if config.extra.logo %}
<link rel="apple-touch-icon" href="{{ base_url }}/{{ config.extra.logo }}"> <link rel="apple-touch-icon" href="{{ base_url }}/{{ config.extra.logo }}">
{% endif %} {% endif %}
{% set icon = icon | default('assets/images/favicon-e565ddfa3b.ico') %} {% set icon = icon | default("assets/images/favicon-e565ddfa3b.ico") %}
<link rel="shortcut icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}">
<link rel="icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}"> <link rel="icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}">
<style> <style>
@ -54,15 +54,9 @@
} }
</style> </style>
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-eaf860cca2.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-eaf860cca2.css">
{% if config.extra.font != 'none' %} {% if config.extra.font != "none" %}
{% set text = 'Ubuntu' %} {% set text = config.extra.get("font", {}).text | default("Ubuntu") %}
{% if config.extra.font and config.extra.font.text %} {% set code = config.extra.get("font", {}).code | default("Ubuntu Mono") %}
{% set text = config.extra.font.text %}
{% endif %}
{% set code = 'Ubuntu Mono' %}
{% if config.extra.font and config.extra.font.code %}
{% set code = config.extra.font.code %}
{% endif %}
{% set font = text + ':400,700|' + code | replace(' ', '+') %} {% set font = text + ':400,700|' + code | replace(' ', '+') %}
<link rel="stylesheet" href="//fonts.googleapis.com/css?family={{ font }}"> <link rel="stylesheet" href="//fonts.googleapis.com/css?family={{ font }}">
<style> <style>
@ -81,9 +75,9 @@
{% block extrahead %}{% endblock %} {% block extrahead %}{% endblock %}
</head> </head>
<body> <body>
{% if repo_name == 'GitHub' and repo_url %} {% if repo_name == "GitHub" and repo_url %}
{% set repo_id = repo_url | replace('https://github.com/', '') %} {% set repo_id = repo_url | replace("https://github.com/", "") %}
{% if repo_id[-1:] == '/' %} {% if repo_id[-1:] == "/" %}
{% set repo_id = repo_id[:-1] %} {% set repo_id = repo_id[:-1] %}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -104,11 +98,7 @@
<article class="article"> <article class="article">
<div class="wrapper"> <div class="wrapper">
{% if not h1 %} {% if not h1 %}
{% if page_title %} <h1>{{ page_title | default(site_name, true)}}</h1>
<h1>{{ page_title }}</h1>
{% else %}
<h1>{{ site_name }}</h1>
{% endif %}
{% endif %} {% endif %}
{{ content }} {{ content }}
<aside class="copyright" role="note"> <aside class="copyright" role="note">

View File

@ -1,5 +1,5 @@
<nav aria-label="Navigation"> <nav aria-label="Navigation">
{% set home = repo_url | default('/', true) %} {% set home = repo_url | default("/", true) %}
<a href="{{ home }}" class="project"> <a href="{{ home }}" class="project">
<div class="banner"> <div class="banner">
{% if config.extra.logo %} {% if config.extra.logo %}
@ -18,17 +18,17 @@
</a> </a>
<div class="scrollable"> <div class="scrollable">
<div class="wrapper"> <div class="wrapper">
{% if repo_name == 'GitHub' and repo_url %} {% if repo_name == "GitHub" and repo_url %}
<ul class="repo"> <ul class="repo">
<li class="repo-download"> <li class="repo-download">
{% set version = config.extra.version | default('master') %} {% set version = config.extra.version | default("master") %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" title="Download {{ site_name }} from GitHub" data-action="download"> <a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" title="Download" data-action="download">
<i class="icon icon-download"></i> Download <i class="icon icon-download"></i> Download
</a> </a>
</li> </li>
<li class="repo-stars"> <li class="repo-stars">
<a href="{{ repo_url }}" target="_blank" title="Star {{ site_name }} on GitHub" data-action="star"> <a href="{{ repo_url }}/stargazers" target="_blank" title="Stargazers" data-action="star">
<i class="icon icon-star"></i> Star <i class="icon icon-star"></i> Stars
<span class="count">&ndash;</span> <span class="count">&ndash;</span>
</a> </a>
</li> </li>

View File

@ -3,7 +3,9 @@
<div class="previous"> <div class="previous">
{% if previous_page %} {% if previous_page %}
<a href="{{ previous_page.url }}" title="{{ previous_page.title }}"> <a href="{{ previous_page.url }}" title="{{ previous_page.title }}">
<span class="direction">Previous</span> <span class="direction">
{{ config.extra.get("i18n", {}).prev | default("Prev") }}
</span>
<div class="page"> <div class="page">
<div class="button button-previous" role="button" aria-label="Previous"> <div class="button button-previous" role="button" aria-label="Previous">
<i class="icon icon-back"></i> <i class="icon icon-back"></i>
@ -20,7 +22,9 @@
<div class="next"> <div class="next">
{% if next_page %} {% if next_page %}
<a href="{{ next_page.url }}" title="{{ next_page.title }}"> <a href="{{ next_page.url }}" title="{{ next_page.title }}">
<span class="direction">Next</span> <span class="direction">
{{ config.extra.get("i18n", {}).next | default("Next") }}
</span>
<div class="page"> <div class="page">
<div class="stretch"> <div class="stretch">
<div class="title"> <div class="title">

View File

@ -19,21 +19,19 @@
{% endfor %} {% endfor %}
</span> </span>
{% endif %} {% endif %}
{% if page_title %} {{ page_title | default(site_name, true) }}
{{ page_title }}
{% else %}
{{ site_name }}
{% endif %}
</div> </div>
</div> </div>
{% if config.extra.author and config.extra.author.twitter %} {% if config.extra.get("author", {}).twitter %}
{% set author = config.extra.author.twitter %}
<div class="button button-twitter" role="button" aria-label="Twitter"> <div class="button button-twitter" role="button" aria-label="Twitter">
<a href="https://twitter.com/{{ config.extra.author.twitter }}" title="@{{ config.extra.author.twitter }} on Twitter" target="_blank" class="toggle-button icon icon-twitter"></a> <a href="https://twitter.com/{{ author }}" title="@{{ author }} on Twitter" target="_blank" class="toggle-button icon icon-twitter"></a>
</div> </div>
{% endif %} {% endif %}
{% if config.extra.author and config.extra.author.github %} {% if config.extra.get("author", {}).github %}
{% set author = config.extra.author.github %}
<div class="button button-github" role="button" aria-label="GitHub"> <div class="button button-github" role="button" aria-label="GitHub">
<a href="https://github.com/{{ config.extra.author.github }}" title="@{{ config.extra.author.github }} on GitHub" target="_blank" class="toggle-button icon icon-github"></a> <a href="https://github.com/{{ author }}" title="@{{ author }} on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
</div> </div>
{% endif %} {% endif %}
<div class="button button-search" role="button" aria-label="Search"> <div class="button button-search" role="button" aria-label="Search">

View File

@ -3,7 +3,7 @@
<span class="section">{{ nav_item.title }}</span> <span class="section">{{ nav_item.title }}</span>
<ul> <ul>
{% for nav_item in nav_item.children %} {% for nav_item in nav_item.children %}
{% include 'nav.html' %} {% include "nav.html" %}
{% endfor %} {% endfor %}
</ul> </ul>
</li> </li>
@ -14,8 +14,7 @@
</a> </a>
{% if nav_item == current_page %} {% if nav_item == current_page %}
{% if h1 %} {% if h1 %}
{% set toc_item = toc | first %} {% set toc = (toc | first).children %}
{% set toc = toc_item.children %}
{% endif %} {% endif %}
{% if toc %} {% if toc %}
<ul> <ul>

View File

@ -44,13 +44,16 @@ extra:
author: author:
github: squidfunk github: squidfunk
twitter: squidfunk twitter: squidfunk
i18n:
prev: Prev
next: Next
# Extensions # Extensions
markdown_extensions: markdown_extensions:
- codehilite(css_class=code) - codehilite(css_class=code)
- admonition - admonition
- toc: - toc:
permalink: permalink: '#'
# Page tree # Page tree
pages: pages:

View File

@ -58,7 +58,7 @@
{% endif %} {% endif %}
<!-- Favicon --> <!-- Favicon -->
{% set icon = icon | default('assets/images/favicon.ico') %} {% set icon = icon | default("assets/images/favicon.ico") %}
<link rel="shortcut icon" type="image/x-icon" <link rel="shortcut icon" type="image/x-icon"
href="{{ base_url }}/{{ icon }}" /> href="{{ base_url }}/{{ icon }}" />
<link rel="icon" type="image/x-icon" <link rel="icon" type="image/x-icon"
@ -87,15 +87,9 @@
href="{{ base_url }}/assets/stylesheets/application.css" /> href="{{ base_url }}/assets/stylesheets/application.css" />
<!-- Configure webfonts --> <!-- Configure webfonts -->
{% if config.extra.font != 'none' %} {% if config.extra.font != "none" %}
{% set text = 'Ubuntu' %} {% set text = config.extra.get("font", {}).text | default("Ubuntu") %}
{% if config.extra.font and config.extra.font.text %} {% set code = config.extra.get("font", {}).code | default("Ubuntu Mono") %}
{% set text = config.extra.font.text %}
{% endif %}
{% set code = 'Ubuntu Mono' %}
{% if config.extra.font and config.extra.font.code %}
{% set code = config.extra.font.code %}
{% endif %}
{% set font = text + ':400,700|' + code | replace(' ', '+') %} {% set font = text + ':400,700|' + code | replace(' ', '+') %}
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="//fonts.googleapis.com/css?family={{ font }}" /> href="//fonts.googleapis.com/css?family={{ font }}" />
@ -127,9 +121,9 @@
regular expressions out-of-the-box. Since there might be a slash at the regular expressions out-of-the-box. Since there might be a slash at the
end of the repository name, we just do a string comparison and kill it. end of the repository name, we just do a string comparison and kill it.
--> -->
{% if repo_name == 'GitHub' and repo_url %} {% if repo_name == "GitHub" and repo_url %}
{% set repo_id = repo_url | replace('https://github.com/', '') %} {% set repo_id = repo_url | replace("https://github.com/", "") %}
{% if repo_id[-1:] == '/' %} {% if repo_id[-1:] == "/" %}
{% set repo_id = repo_id[:-1] %} {% set repo_id = repo_id[:-1] %}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -173,11 +167,7 @@
<!-- Headline --> <!-- Headline -->
{% if not h1 %} {% if not h1 %}
{% if page_title %} <h1>{{ page_title | default(site_name, true)}}</h1>
<h1>{{ page_title }}</h1>
{% else %}
<h1>{{ site_name }}</h1>
{% endif %}
{% endif %} {% endif %}
<!-- Article content --> <!-- Article content -->

View File

@ -1,6 +1,6 @@
<!-- Navigation --> <!-- Navigation -->
<nav aria-label="Navigation"> <nav aria-label="Navigation">
{% set home = repo_url | default('/', true) %} {% set home = repo_url | default("/", true) %}
<!-- Project information --> <!-- Project information -->
<a href="{{ home }}" class="project"> <a href="{{ home }}" class="project">
@ -33,21 +33,19 @@
<div class="wrapper"> <div class="wrapper">
<!-- Repository --> <!-- Repository -->
{% if repo_name == 'GitHub' and repo_url %} {% if repo_name == "GitHub" and repo_url %}
<ul class="repo"> <ul class="repo">
<li class="repo-download"> <li class="repo-download">
{% set version = config.extra.version | default('master') %} {% set version = config.extra.version | default("master") %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" <a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank"
title="Download {{ site_name }} from GitHub" title="Download" data-action="download">
data-action="download">
<i class="icon icon-download"></i> Download <i class="icon icon-download"></i> Download
</a> </a>
</li> </li>
<li class="repo-stars"> <li class="repo-stars">
<a href="{{ repo_url }}" target="_blank" <a href="{{ repo_url }}/stargazers" target="_blank"
title="Star {{ site_name }} on GitHub" title="Stargazers" data-action="star">
data-action="star"> <i class="icon icon-star"></i> Stars
<i class="icon icon-star"></i> Star
<span class="count">&ndash;</span> <span class="count">&ndash;</span>
</a> </a>
</li> </li>

View File

@ -6,7 +6,9 @@
<div class="previous"> <div class="previous">
{% if previous_page %} {% if previous_page %}
<a href="{{ previous_page.url }}" title="{{ previous_page.title }}"> <a href="{{ previous_page.url }}" title="{{ previous_page.title }}">
<span class="direction">Previous</span> <span class="direction">
{{ config.extra.get("i18n", {}).prev | default("Prev") }}
</span>
<div class="page"> <div class="page">
<div class="button button-previous" <div class="button button-previous"
role="button" aria-label="Previous"> role="button" aria-label="Previous">
@ -26,7 +28,9 @@
<div class="next"> <div class="next">
{% if next_page %} {% if next_page %}
<a href="{{ next_page.url }}" title="{{ next_page.title }}"> <a href="{{ next_page.url }}" title="{{ next_page.title }}">
<span class="direction">Next</span> <span class="direction">
{{ config.extra.get("i18n", {}).next | default("Next") }}
</span>
<div class="page"> <div class="page">
<div class="stretch"> <div class="stretch">
<div class="title"> <div class="title">

View File

@ -26,28 +26,26 @@
{% endfor %} {% endfor %}
</span> </span>
{% endif %} {% endif %}
{% if page_title %} {{ page_title | default(site_name, true) }}
{{ page_title }}
{% else %}
{{ site_name }}
{% endif %}
</div> </div>
</div> </div>
<!-- Twitter --> <!-- Twitter -->
{% if config.extra.author and config.extra.author.twitter %} {% if config.extra.get("author", {}).twitter %}
{% set author = config.extra.author.twitter %}
<div class="button button-twitter" role="button" aria-label="Twitter"> <div class="button button-twitter" role="button" aria-label="Twitter">
<a href="https://twitter.com/{{ config.extra.author.twitter }}" <a href="https://twitter.com/{{ author }}"
title="@{{ config.extra.author.twitter }} on Twitter" target="_blank" title="@{{ author }} on Twitter" target="_blank"
class="toggle-button icon icon-twitter"></a> class="toggle-button icon icon-twitter"></a>
</div> </div>
{% endif %} {% endif %}
<!-- GitHub --> <!-- GitHub -->
{% if config.extra.author and config.extra.author.github %} {% if config.extra.get("author", {}).github %}
{% set author = config.extra.author.github %}
<div class="button button-github" role="button" aria-label="GitHub"> <div class="button button-github" role="button" aria-label="GitHub">
<a href="https://github.com/{{ config.extra.author.github }}" <a href="https://github.com/{{ author }}"
title="@{{ config.extra.author.github }} on GitHub" target="_blank" title="@{{ author }} on GitHub" target="_blank"
class="toggle-button icon icon-github"></a> class="toggle-button icon icon-github"></a>
</div> </div>
{% endif %} {% endif %}

View File

@ -6,7 +6,7 @@
<!-- Render pages of section --> <!-- Render pages of section -->
{% for nav_item in nav_item.children %} {% for nav_item in nav_item.children %}
{% include 'nav.html' %} {% include "nav.html" %}
{% endfor %} {% endfor %}
</ul> </ul>
</li> </li>
@ -29,8 +29,7 @@
with the children of the anchor. with the children of the anchor.
--> -->
{% if h1 %} {% if h1 %}
{% set toc_item = toc | first %} {% set toc = (toc | first).children %}
{% set toc = toc_item.children %}
{% endif %} {% endif %}
<!-- Render anchors of active page --> <!-- Render anchors of active page -->