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

Merge pull request #65 from brendo:issue-63-mkdocs-016-compatible

This commit is contained in:
squidfunk 2016-12-15 16:43:40 +01:00
parent 49020c51ae
commit fe12548f8e
22 changed files with 376 additions and 275 deletions

View File

@ -32,11 +32,12 @@ mkdocs-material-1.0.0-rc.1 (2016-XX-XX)
* Added more detailed documentation on specimen, extensions etc. * Added more detailed documentation on specimen, extensions etc.
* Added a 404.html error page for deployment on GitHub Pages * Added a 404.html error page for deployment on GitHub Pages
* Fixed live reload chain in watch mode when saving a template * Fixed live reload chain in watch mode when saving a template
* Fixed variable references to work with mkdocs 0.16
mkdocs-material-0.2.4 (2016-06-26) mkdocs-material-0.2.4 (2016-06-26)
* Fixed improperly set default favicon * Fixed improperly set default favicon
* Fixed #33: Protocol relative URL for web fonts doesn't work with file:// * Fixed #33: Protocol relative URL for webfonts doesn't work with file://
* Fixed #34: IE11 on Windows 7 doesn't honor max-width on main tag * Fixed #34: IE11 on Windows 7 doesn't honor max-width on main tag
* Fixed #35: Add styling for blockquotes * Fixed #35: Add styling for blockquotes

View File

@ -4,7 +4,7 @@
[![PyPI Downloads][pypi-dl-image]][pypi-dl-link] [![PyPI Downloads][pypi-dl-image]][pypi-dl-link]
[![PyPI Version][pypi-v-image]][pypi-v-link] [![PyPI Version][pypi-v-image]][pypi-v-link]
A material design theme for [MkDocs](http://www.mkdocs.org). A material design theme for [MkDocs 0.16](http://www.mkdocs.org).
[![iOS](docs/images/screen.png)](http://squidfunk.github.io/mkdocs-material/) [![iOS](docs/images/screen.png)](http://squidfunk.github.io/mkdocs-material/)

View File

@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "main.html" %}
{% block content %} {% block content %}
<h1>404 - Not found</h1> <h1>404 - Not found</h1>
{% endblock %} {% endblock %}

View File

@ -5321,7 +5321,11 @@ var Application =
value: true value: true
}); });
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com> * Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
@ -5343,14 +5347,6 @@ var Application =
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
var _jsCookie = __webpack_require__(22);
var _jsCookie2 = _interopRequireDefault(_jsCookie);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Class * Class
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */

View File

@ -1,26 +1,38 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="no-js"> <html class="no-js">
<head> <head>
{% block site_meta %}
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1"> <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
{% if page_title %} {% if config.site_description %}
<title>{{ page_title }} - {{ site_name }}</title> <meta name="description" content="{{ config.site_description }}">
{% elif page_description %} {% endif %}
<title>{{ site_name }} - {{ page_description }}</title> {% if page.canonical_url %}
<link rel="canonical" href="{{ page.canonical_url }}">
{% endif %}
{% if config.site_author %}
<meta name="author" content="{{ config.site_author }}">
{% endif %}
{% if config.site_favicon %}
<link rel="shortcut icon" href="{{ base_url }}/{{ config.site_favicon }}">
{% else %} {% else %}
<title>{{ site_name }}</title> <link rel="shortcut icon" href="{{ base_url }}/assets/images/favicon.ico">
{% endif %}
{% if page_description %}
<meta name="description" content="{{ page_description }}">
{% endif %}
{% if canonical_url %}
<link rel="canonical" href="{{ canonical_url }}">
{% endif %}
{% if site_author %}
<meta name="author" content="{{ site_author }}">
{% endif %} {% endif %}
<meta name="generator" content="mkdocs+mkdocs-material#0.2.1"> <meta name="generator" content="mkdocs+mkdocs-material#0.2.1">
{% endblock %}
{% block htmltitle %}
{% if page.title %}
<title>{{ page.title }} - {{ config.site_name }}</title>
{% elif config.site_description %}
<title>{{ config.site_name }} - {{ config.site_description }}</title>
{% else %}
<title>{{ config.site_name }}</title>
{% endif %}
{% endblock %}
{% block libs %}
<script src="{{ base_url }}/assets/javascripts/modernizr.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr.js"></script>
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
@ -28,6 +40,8 @@
{% for path in extra_css %} {% for path in extra_css %}
<link rel="stylesheet" href="{{ path }}"> <link rel="stylesheet" href="{{ path }}">
{% endfor %} {% endfor %}
{% endblock %}
{%- block extrahead -%}{% endblock %}
</head> </head>
<body> <body>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer"> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer">
@ -37,7 +51,8 @@
<div class="md-container"> <div class="md-container">
<main class="md-main"> <main class="md-main">
<div class="md-main__inner md-grid"> <div class="md-main__inner md-grid">
{% set h1 = "\x3ch1 id=" in content %} {% set h1 = "\x3ch1 id=" in page.content %}
{% block site_nav %}
{% if nav %} {% if nav %}
<div class="md-sidebar md-sidebar--primary" data-md-sidebar="primary"> <div class="md-sidebar md-sidebar--primary" data-md-sidebar="primary">
<div class="md-sidebar__scrollwrap"> <div class="md-sidebar__scrollwrap">
@ -47,7 +62,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if toc %} {% if page.toc %}
<div class="md-sidebar md-sidebar--secondary" data-md-sidebar="secondary"> <div class="md-sidebar md-sidebar--secondary" data-md-sidebar="secondary">
<div class="md-sidebar__scrollwrap"> <div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner"> <div class="md-sidebar__inner">
@ -56,6 +71,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endblock %}
<div class="md-content"> <div class="md-content">
<article class="md-content__inner md-typeset"> <article class="md-content__inner md-typeset">
{% block content %} {% block content %}
@ -64,17 +80,15 @@
Edit Edit
</a> </a>
{% endif %} {% endif %}
{{ content }} {{ page.content }}
{% endblock %} {% endblock %}
<hr> <hr>
<small class="md-content__copyright"> <small class="md-content__copyright">
{% if copyright %} {% if config.copyright %}
{{ copyright }} &ndash; {{ config.copyright }} &ndash;
{% endif %} {% endif %}
This document was created with This document was created with
<a href="http://www.mkdocs.org"> <a href="http://www.mkdocs.org">MkDocs</a>
MkDocs
</a>
and the and the
<a href="http://squidfunk.github.io/mkdocs-material/"> <a href="http://squidfunk.github.io/mkdocs-material/">
Material Material
@ -85,8 +99,11 @@
</div> </div>
</div> </div>
</main> </main>
{% block footer %}
{% include "partials/footer.html" %} {% include "partials/footer.html" %}
{% endblock %}
</div> </div>
{% block scripts %}
{% for extension in config.markdown_extensions %} {% for extension in config.markdown_extensions %}
{% if extension == "pymdownx.arithmatex" %} {% if extension == "pymdownx.arithmatex" %}
{% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %} {% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %}
@ -99,12 +116,7 @@
var config = { var config = {
url: { url: {
base: "{{ base_url }}", base: "{{ base_url }}",
}, }
repo: {
url: "{{ repo_url }}",
icon: "{{ repo_icon }}",
},
storage: window.sessionStorage,
}; };
/* Initialize application */ /* Initialize application */
var app = new Application(config); var app = new Application(config);
@ -113,5 +125,21 @@
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>
{% endfor %} {% endfor %}
{% endblock %}
{% block analytics %}
{% if config.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||
function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();
a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;
a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script',
'//www.google-analytics.com/analytics.js','ga');
ga('create',
'{{ config.google_analytics[0] }}',
'{{ config.google_analytics[1] }}');
ga('send', 'pageview');
</script>
{% endif %}
{% endblock %}
</body> </body>
</html> </html>

1
material/main.html Normal file
View File

@ -0,0 +1 @@
{% extends "base.html" %}

View File

@ -1,9 +1,9 @@
<footer class="md-footer"> <footer class="md-footer">
<div class="md-footer__inner"> <div class="md-footer__inner">
{% if previous_page or next_page %} {% if page.previous_page or page.next_page %}
<nav class="md-footer-nav md-grid"> <nav class="md-footer-nav md-grid">
{% if previous_page %} {% if page.previous_page %}
<a href="{{ previous_page.url }}" title="{{ previous_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> <a href="{{ page.previous_page.url }}" title="{{ page.previous_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--back md-footer-nav__icon"></i> <i class="md-icon md-icon--back md-footer-nav__icon"></i>
</div> </div>
@ -12,19 +12,19 @@
<span class="md-footer-nav__direction"> <span class="md-footer-nav__direction">
Previous Previous
</span> </span>
{{ previous_page.title }} {{ page.previous_page.title }}
</span> </span>
</div> </div>
</a> </a>
{% endif %} {% endif %}
{% if next_page %} {% if page.next_page %}
<a href="{{ next_page.url }}" title="{{ next_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> <a href="{{ page.next_page.url }}" title="{{ page.next_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis"> <span class="md-flex__ellipsis">
<span class="md-footer-nav__direction"> <span class="md-footer-nav__direction">
Next Next
</span> </span>
{{ next_page.title }} {{ page.next_page.title }}
</span> </span>
</div> </div>
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">

View File

@ -2,7 +2,7 @@
<nav class="md-header-nav md-grid"> <nav class="md-header-nav md-grid">
<div class="md-flex"> <div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
<a href="{{ homepage_url }}" title="{{ site_name }}" class="md-icon md-header-nav__icon md-header-nav__icon--home"> <a href="{{ nav.homepage.url }}" title="{{ config.site_name }}" class="md-icon md-header-nav__icon md-header-nav__icon--home">
layers layers
</a> </a>
</div> </div>
@ -13,20 +13,26 @@
</div> </div>
<div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__cell md-flex__cell--stretch">
<span class="md-flex__ellipsis md-header-nav__title"> <span class="md-flex__ellipsis md-header-nav__title">
{{ page_title | default(site_name, true) }} {%- block site_name -%}
{{ page.title | default(config.site_name, true) }}
{% endblock %}
</span> </span>
</div> </div>
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
{%- block search_box -%}
<label class="md-icon md-header-nav__icon md-header-nav__icon--search" for="search"> <label class="md-icon md-header-nav__icon md-header-nav__icon--search" for="search">
search search
</label> </label>
{% include "partials/search.html" %} {% include "partials/search.html" %}
{% endblock %}
</div> </div>
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source"> <div class="md-header-nav__source">
{% if repo_url %} {%- block repo -%}
{% if config.repo_url %}
{% include "partials/source.html" %} {% include "partials/source.html" %}
{% endif %} {% endif %}
{% endblock %}
</div> </div>
</div> </div>
</div> </div>

View File

@ -22,7 +22,7 @@
</ul> </ul>
</nav> </nav>
</li> </li>
{% elif nav_item == current_page %} {% elif nav_item == page %}
<li class="md-nav__item"> <li class="md-nav__item">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc"> <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
<label class="md-nav__link md-nav__link--active" for="toc"> <label class="md-nav__link md-nav__link--active" for="toc">

View File

@ -1,12 +1,12 @@
<nav class="md-nav md-nav--primary"> <nav class="md-nav md-nav--primary">
<label class="md-nav__title" for="drawer">{{ site_name }}</label> <label class="md-nav__title" for="drawer">{{ config.site_name }}</label>
<ul class="md-nav__list"> <ul class="md-nav__list">
{% for nav_item in nav %} {% for nav_item in nav %}
{% set path = "nav-" + loop.index | string %} {% set path = "nav-" + loop.index | string %}
{% include "partials/nav-item.html" %} {% include "partials/nav-item.html" %}
{% endfor %} {% endfor %}
</ul> </ul>
{% if repo_url %} {% if config.repo_url %}
<div class="md-nav__source"> <div class="md-nav__source">
{% include "partials/source.html" %} {% include "partials/source.html" %}
</div> </div>

View File

@ -1,4 +1,4 @@
{% set platform = config.extra.repo_icon or repo_url %} {% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %} {% if "github" in platform %}
{% set repo_type = "github" %} {% set repo_type = "github" %}
{% set repo_icon = "md-source--github" %} {% set repo_icon = "md-source--github" %}
@ -12,7 +12,7 @@
{% set repo_type = "" %} {% set repo_type = "" %}
{% set repo_icon = "" %} {% set repo_icon = "" %}
{% endif %} {% endif %}
<a href="{{ repo_url }}" title="Go to repository" class="md-source {{ repo_icon }}" data-md-source="{{ repo_type }}"> <a href="{{ config.repo_url }}" title="Go to repository" class="md-source {{ repo_icon }}" data-md-source="{{ repo_type }}">
<div class="md-source__repository"> <div class="md-source__repository">
{{ repo_name }} {{ repo_name }}
</div> </div>

View File

@ -1,4 +1,5 @@
<nav class="md-nav md-nav--secondary"> <nav class="md-nav md-nav--secondary">
{% set toc = page.toc %}
{% if h1 %} {% if h1 %}
{% set toc = (toc | first).children %} {% set toc = (toc | first).children %}
{% endif %} {% endif %}

View File

@ -20,7 +20,7 @@
IN THE SOFTWARE. IN THE SOFTWARE.
--> -->
{% extends "base.html" %} {% extends "main.html" %}
<!-- Content block --> <!-- Content block -->
{% block content %} {% block content %}

View File

@ -24,42 +24,58 @@
<html class="no-js"> <html class="no-js">
<head> <head>
<!-- Charset and viewport --> <!-- Block: metatags -->
{% block site_meta %}
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, <meta name="viewport" content="width=device-width,
user-scalable=no, initial-scale=1, maximum-scale=1" /> user-scalable=no, initial-scale=1, maximum-scale=1" />
<!-- Site title -->
{% if page_title %}
<title>{{ page_title }} - {{ site_name }}</title>
{% elif page_description %}
<title>{{ site_name }} - {{ page_description }}</title>
{% else %}
<title>{{ site_name }}</title>
{% endif %}
<!-- Site description --> <!-- Site description -->
{% if page_description %} {% if config.site_description %}
<meta name="description" content="{{ page_description }}" /> <meta name="description" content="{{ config.site_description }}" />
{% endif %} {% endif %}
<!-- Canonical --> <!-- Canonical -->
{% if canonical_url %} {% if page.canonical_url %}
<link rel="canonical" href="{{ canonical_url }}" /> <link rel="canonical" href="{{ page.canonical_url }}" />
{% endif %} {% endif %}
<!-- Author --> <!-- Author -->
{% if site_author %} {% if config.site_author %}
<meta name="author" content="{{ site_author }}" /> <meta name="author" content="{{ config.site_author }}" />
{% endif %}
<!-- Favicon -->
{% if config.site_favicon %}
<link rel="shortcut icon"
href="{{ base_url }}/{{ config.site_favicon }}">
{% else %}
<link rel="shortcut icon"
href="{{ base_url }}/assets/images/favicon.ico">
{% endif %} {% endif %}
<!-- Generator banner --> <!-- Generator banner -->
<meta name="generator" content="mkdocs+$theme-name$#$theme-version$" /> <meta name="generator" content="mkdocs+$theme-name$#$theme-version$" />
{% endblock %}
<!-- Modernizr --> <!-- Block: site title -->
{% block htmltitle %}
{% if page.title %}
<title>{{ page.title }} - {{ config.site_name }}</title>
{% elif config.site_description %}
<title>{{ config.site_name }} - {{ config.site_description }}</title>
{% else %}
<title>{{ config.site_name }}</title>
{% endif %}
{% endblock %}
<!-- Block: JavaScript libraries -->
{% block libs %}
<script src="{{ base_url }}/assets/javascripts/modernizr.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr.js"></script>
{% endblock %}
<!-- Web fonts --> <!-- Block: webfonts and stylesheets -->
{% block styles %}
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700" /> href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700" />
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
@ -75,6 +91,10 @@
{% for path in extra_css %} {% for path in extra_css %}
<link rel="stylesheet" type="text/css" href="{{ path }}" /> <link rel="stylesheet" type="text/css" href="{{ path }}" />
{% endfor %} {% endfor %}
{% endblock %}
<!-- Block: custom front matter -->
{%- block extrahead -%}{% endblock %}
</head> </head>
<body> <body>
@ -103,7 +123,10 @@
necessary for correctly rendering the table of contents which is necessary for correctly rendering the table of contents which is
embedded into the navigation and the actual headline. embedded into the navigation and the actual headline.
--> -->
{% set h1 = "\x3ch1 id=" in content %} {% set h1 = "\x3ch1 id=" in page.content %}
<!-- Block: navigation -->
{% block site_nav %}
<!-- Main navigation --> <!-- Main navigation -->
{% if nav %} {% if nav %}
@ -118,7 +141,7 @@
{% endif %} {% endif %}
<!-- Table of contents --> <!-- Table of contents -->
{% if toc %} {% if page.toc %}
<div class="md-sidebar md-sidebar--secondary" <div class="md-sidebar md-sidebar--secondary"
data-md-sidebar="secondary"> data-md-sidebar="secondary">
<div class="md-sidebar__scrollwrap"> <div class="md-sidebar__scrollwrap">
@ -128,12 +151,13 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endblock %}
<!-- Article --> <!-- Article -->
<div class="md-content"> <div class="md-content">
<article class="md-content__inner md-typeset"> <article class="md-content__inner md-typeset">
<!-- Content block --> <!-- Block: content -->
{% block content %} {% block content %}
<!-- Edit button, if URL was defined --> <!-- Edit button, if URL was defined -->
@ -144,19 +168,17 @@
{% endif %} {% endif %}
<!-- Content --> <!-- Content -->
{{ content }} {{ page.content }}
{% endblock %} {% endblock %}
<!-- Copyright and theme information --> <!-- Copyright and theme information -->
<hr /> <hr />
<small class="md-content__copyright"> <small class="md-content__copyright">
{% if copyright %} {% if config.copyright %}
{{ copyright }} &ndash; {{ config.copyright }} &ndash;
{% endif %} {% endif %}
This document was created with This document was created with
<a href="http://www.mkdocs.org"> <a href="http://www.mkdocs.org">MkDocs</a>
MkDocs
</a>
and the and the
<a href="http://squidfunk.github.io/mkdocs-material/"> <a href="http://squidfunk.github.io/mkdocs-material/">
Material Material
@ -169,10 +191,13 @@
</main> </main>
<!-- Application footer --> <!-- Application footer -->
{% block footer %}
{% include "partials/footer.html" %} {% include "partials/footer.html" %}
{% endblock %}
</div> </div>
<!-- Extension-related JavaScript --> <!-- Block: extension- and theme-related JavaScript -->
{% block scripts %}
{% for extension in config.markdown_extensions %} {% for extension in config.markdown_extensions %}
<!-- MathJax integration --> <!-- MathJax integration -->
@ -190,12 +215,7 @@
var config = { var config = {
url: { url: {
base: "{{ base_url }}", base: "{{ base_url }}",
}, }
repo: {
url: "{{ repo_url }}",
icon: "{{ repo_icon }}",
},
storage: window.sessionStorage,
}; };
/* Initialize application */ /* Initialize application */
@ -205,5 +225,23 @@
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>
{% endfor %} {% endfor %}
{% endblock %}
<!-- Block: analytic scripts -->
{% block analytics %}
{% if config.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||
function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();
a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;
a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script',
'//www.google-analytics.com/analytics.js','ga');
ga('create',
'{{ config.google_analytics[0] }}',
'{{ config.google_analytics[1] }}');
ga('send', 'pageview');
</script>
{% endif %}
{% endblock %}
</body> </body>
</html> </html>

23
src/main.html Normal file
View File

@ -0,0 +1,23 @@
<!--
Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
{% extends "base.html" %}

View File

@ -25,12 +25,12 @@
<div class="md-footer__inner"> <div class="md-footer__inner">
<!-- Link to previous and/or next page --> <!-- Link to previous and/or next page -->
{% if previous_page or next_page %} {% if page.previous_page or page.next_page %}
<nav class="md-footer-nav md-grid"> <nav class="md-footer-nav md-grid">
<!-- Link to previous page --> <!-- Link to previous page -->
{% if previous_page %} {% if page.previous_page %}
<a href="{{ previous_page.url }}" title="{{ previous_page.title }}" <a href="{{ page.previous_page.url }}" title="{{ page.previous_page.title }}"
class="md-flex md-footer-nav__link md-footer-nav__link--prev" class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev"> rel="prev">
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
@ -42,15 +42,15 @@
<span class="md-footer-nav__direction"> <span class="md-footer-nav__direction">
Previous Previous
</span> </span>
{{ previous_page.title }} {{ page.previous_page.title }}
</span> </span>
</div> </div>
</a> </a>
{% endif %} {% endif %}
<!-- Link to next page --> <!-- Link to next page -->
{% if next_page %} {% if page.next_page %}
<a href="{{ next_page.url }}" title="{{ next_page.title }}" <a href="{{ page.next_page.url }}" title="{{ page.next_page.title }}"
class="md-flex md-footer-nav__link md-footer-nav__link--next" class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next"> rel="next">
<div class="md-flex__cell md-flex__cell--stretch <div class="md-flex__cell md-flex__cell--stretch
@ -59,7 +59,7 @@
<span class="md-footer-nav__direction"> <span class="md-footer-nav__direction">
Next Next
</span> </span>
{{ next_page.title }} {{ page.next_page.title }}
</span> </span>
</div> </div>
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">

View File

@ -29,7 +29,7 @@
<!-- Link to home --> <!-- Link to home -->
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
<a href="{{ homepage_url }}" title="{{ site_name }}" <a href="{{ nav.homepage.url }}" title="{{ config.site_name }}"
class="md-icon md-header-nav__icon md-header-nav__icon--home"> class="md-icon md-header-nav__icon md-header-nav__icon--home">
layers layers
</a> </a>
@ -46,12 +46,15 @@
<!-- Header title --> <!-- Header title -->
<div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__cell md-flex__cell--stretch">
<span class="md-flex__ellipsis md-header-nav__title"> <span class="md-flex__ellipsis md-header-nav__title">
{{ page_title | default(site_name, true) }} {%- block site_name -%}
{{ page.title | default(config.site_name, true) }}
{% endblock %}
</span> </span>
</div> </div>
<!-- Button to open search dialogue --> <!-- Button to open search dialogue -->
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
{%- block search_box -%}
<label class="md-icon md-header-nav__icon md-header-nav__icon--search" <label class="md-icon md-header-nav__icon md-header-nav__icon--search"
for="search"> for="search">
search search
@ -59,14 +62,17 @@
<!-- Search interface --> <!-- Search interface -->
{% include "partials/search.html" %} {% include "partials/search.html" %}
{% endblock %}
</div> </div>
<!-- Repository containing source --> <!-- Repository containing source -->
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source"> <div class="md-header-nav__source">
{% if repo_url %} {%- block repo -%}
{% if config.repo_url %}
{% include "partials/source.html" %} {% include "partials/source.html" %}
{% endif %} {% endif %}
{% endblock %}
</div> </div>
</div> </div>
</div> </div>

View File

@ -54,8 +54,8 @@
</nav> </nav>
</li> </li>
<!-- Current navigation item --> <!-- Main navigation item with nested items -->
{% elif nav_item == current_page %} {% elif nav_item == page %}
<li class="md-nav__item"> <li class="md-nav__item">
<!-- Active checkbox expands items contained within nested section --> <!-- Active checkbox expands items contained within nested section -->

View File

@ -22,14 +22,14 @@
<!-- Main navigation --> <!-- Main navigation -->
<nav class="md-nav md-nav--primary"> <nav class="md-nav md-nav--primary">
<label class="md-nav__title" for="drawer">{{ site_name }}</label> <label class="md-nav__title" for="drawer">{{ config.site_name }}</label>
<ul class="md-nav__list"> <ul class="md-nav__list">
{% for nav_item in nav %} {% for nav_item in nav %}
{% set path = "nav-" + loop.index | string %} {% set path = "nav-" + loop.index | string %}
{% include "partials/nav-item.html" %} {% include "partials/nav-item.html" %}
{% endfor %} {% endfor %}
</ul> </ul>
{% if repo_url %} {% if config.repo_url %}
<div class="md-nav__source"> <div class="md-nav__source">
{% include "partials/source.html" %} {% include "partials/source.html" %}
</div> </div>

View File

@ -24,7 +24,7 @@
Check whether the repository is hosted on one of the supported code hosting Check whether the repository is hosted on one of the supported code hosting
platforms (Github, Gitlab or Bitbucket) to show icon. platforms (Github, Gitlab or Bitbucket) to show icon.
--> -->
{% set platform = config.extra.repo_icon or repo_url %} {% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %} {% if "github" in platform %}
{% set repo_type = "github" %} {% set repo_type = "github" %}
{% set repo_icon = "md-source--github" %} <!-- TODO: remove this in favor of type --> {% set repo_icon = "md-source--github" %} <!-- TODO: remove this in favor of type -->
@ -40,7 +40,7 @@
{% endif %} {% endif %}
<!-- Repository containing source --> <!-- Repository containing source -->
<a href="{{ repo_url }}" title="Go to repository" <a href="{{ config.repo_url }}" title="Go to repository"
class="md-source {{ repo_icon }}" data-md-source="{{ repo_type }}"> <!-- use <> for custom / private repo --> class="md-source {{ repo_icon }}" data-md-source="{{ repo_type }}"> <!-- use <> for custom / private repo -->
<div class="md-source__repository"> <div class="md-source__repository">
{{ repo_name }} {{ repo_name }}

View File

@ -22,6 +22,7 @@
<!-- Table of contents --> <!-- Table of contents -->
<nav class="md-nav md-nav--secondary"> <nav class="md-nav md-nav--secondary">
{% set toc = page.toc %}
<!-- <!--
The top-level anchor must be skipped if the article contains a h1 headline, The top-level anchor must be skipped if the article contains a h1 headline,