1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-12 01:50:52 +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)
* Fixed #3: Ordered lists within an unordered list have ::before content

View File

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

View File

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

View File

@ -3,7 +3,9 @@
<div class="previous">
{% if previous_page %}
<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="button button-previous" role="button" aria-label="Previous">
<i class="icon icon-back"></i>
@ -20,7 +22,9 @@
<div class="next">
{% if next_page %}
<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="stretch">
<div class="title">

View File

@ -19,21 +19,19 @@
{% endfor %}
</span>
{% endif %}
{% if page_title %}
{{ page_title }}
{% else %}
{{ site_name }}
{% endif %}
{{ page_title | default(site_name, true) }}
</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">
<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>
{% 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">
<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>
{% endif %}
<div class="button button-search" role="button" aria-label="Search">

View File

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

View File

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

View File

@ -58,7 +58,7 @@
{% endif %}
<!-- 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"
href="{{ base_url }}/{{ icon }}" />
<link rel="icon" type="image/x-icon"
@ -87,15 +87,9 @@
href="{{ base_url }}/assets/stylesheets/application.css" />
<!-- Configure webfonts -->
{% if config.extra.font != 'none' %}
{% set text = 'Ubuntu' %}
{% if config.extra.font and config.extra.font.text %}
{% 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 %}
{% if config.extra.font != "none" %}
{% set text = config.extra.get("font", {}).text | default("Ubuntu") %}
{% set code = config.extra.get("font", {}).code | default("Ubuntu Mono") %}
{% set font = text + ':400,700|' + code | replace(' ', '+') %}
<link rel="stylesheet" type="text/css"
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
end of the repository name, we just do a string comparison and kill it.
-->
{% if repo_name == 'GitHub' and repo_url %}
{% set repo_id = repo_url | replace('https://github.com/', '') %}
{% if repo_id[-1:] == '/' %}
{% if repo_name == "GitHub" and repo_url %}
{% set repo_id = repo_url | replace("https://github.com/", "") %}
{% if repo_id[-1:] == "/" %}
{% set repo_id = repo_id[:-1] %}
{% endif %}
{% endif %}
@ -173,11 +167,7 @@
<!-- Headline -->
{% if not h1 %}
{% if page_title %}
<h1>{{ page_title }}</h1>
{% else %}
<h1>{{ site_name }}</h1>
{% endif %}
<h1>{{ page_title | default(site_name, true)}}</h1>
{% endif %}
<!-- Article content -->

View File

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

View File

@ -6,7 +6,9 @@
<div class="previous">
{% if previous_page %}
<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="button button-previous"
role="button" aria-label="Previous">
@ -26,7 +28,9 @@
<div class="next">
{% if next_page %}
<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="stretch">
<div class="title">

View File

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

View File

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