1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-27 17:00:54 +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
@ -95,4 +96,4 @@ mkdocs-material-0.1.1 (2016-02-11)
mkdocs-material-0.1.0 (2016-02-09) mkdocs-material-0.1.0 (2016-02-09)
* Initial release * Initial release

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

@ -2801,13 +2801,13 @@ var Application =
* this.field('title', 10) * this.field('title', 10)
* this.field('tags', 100) * this.field('tags', 100)
* this.field('body') * this.field('body')
* *
* this.ref('cid') * this.ref('cid')
* *
* this.pipeline.add(function () { * this.pipeline.add(function () {
* // some custom pipeline function * // some custom pipeline function
* }) * })
* *
* }) * })
* *
* @param {Function} config A function that will be called with the new instance * @param {Function} config A function that will be called with the new instance
@ -5321,36 +5321,32 @@ 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; }; }();
* 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.
*/
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"); } } 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>
*
* 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.
*/
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Class * Class
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
@ -5404,4 +5400,4 @@ var Application =
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15))) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)))
/***/ } /***/ }
/******/ ]); /******/ ]);

View File

@ -24,7 +24,7 @@
;(function(window, document, undefined){ ;(function(window, document, undefined){
var tests = []; var tests = [];
/** /**
* *
@ -73,7 +73,7 @@
} }
}; };
// Fake some of Object.create so we can force non test results to be non "own" properties. // Fake some of Object.create so we can force non test results to be non "own" properties.
var Modernizr = function() {}; var Modernizr = function() {};
@ -83,10 +83,10 @@
// Overwrite name so constructor name is nicer :D // Overwrite name so constructor name is nicer :D
Modernizr = new Modernizr(); Modernizr = new Modernizr();
var classes = []; var classes = [];
/** /**
* is returns a boolean if the typeof an obj is exactly type. * is returns a boolean if the typeof an obj is exactly type.
@ -182,7 +182,7 @@
*/ */
var docElement = document.documentElement; var docElement = document.documentElement;
/** /**
* A convenience helper to check if the document we are running in is an SVG document * A convenience helper to check if the document we are running in is an SVG document
@ -192,7 +192,7 @@
*/ */
var isSVG = docElement.nodeName.toLowerCase() === 'svg'; var isSVG = docElement.nodeName.toLowerCase() === 'svg';
/** /**
* setClasses takes an array of class names and adds them to the root element * setClasses takes an array of class names and adds them to the root element
@ -260,7 +260,7 @@
} }
})(); })();
// _l tracks listeners for async tests, as well as tests that execute after the initial run // _l tracks listeners for async tests, as well as tests that execute after the initial run
@ -470,7 +470,7 @@
ModernizrProto.addTest = addTest; ModernizrProto.addTest = addTest;
}); });
/** /**
@ -746,7 +746,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
*/ */
var testStyles = ModernizrProto.testStyles = injectElementWithStyles; var testStyles = ModernizrProto.testStyles = injectElementWithStyles;
/*! /*!
{ {
"name": "@font-face", "name": "@font-face",
@ -814,11 +814,11 @@ Detects support for SVG in `<embed>` or `<object>` elements.
*/ */
var omPrefixes = 'Moz O ms Webkit'; var omPrefixes = 'Moz O ms Webkit';
var cssomPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.split(' ') : []); var cssomPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.split(' ') : []);
ModernizrProto._cssomPrefixes = cssomPrefixes; ModernizrProto._cssomPrefixes = cssomPrefixes;
/** /**
@ -852,7 +852,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
delete modElem.elem; delete modElem.elem;
}); });
var mStyle = { var mStyle = {
style: modElem.elem.style style: modElem.elem.style
@ -864,7 +864,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
delete mStyle.style; delete mStyle.style;
}); });
/** /**
* domToCSS takes a camelCase string and converts it to kebab-case * domToCSS takes a camelCase string and converts it to kebab-case
@ -1054,7 +1054,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
var domPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.toLowerCase().split(' ') : []); var domPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.toLowerCase().split(' ') : []);
ModernizrProto._domPrefixes = domPrefixes; ModernizrProto._domPrefixes = domPrefixes;
/** /**
* fnBind is a super small [bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) polyfill. * fnBind is a super small [bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) polyfill.
@ -1149,7 +1149,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
// Modernizr.testAllProps('boxSizing') // Modernizr.testAllProps('boxSizing')
ModernizrProto.testAllProps = testPropsAll; ModernizrProto.testAllProps = testPropsAll;
/** /**
* testAllProps determines whether a given CSS property is supported in the browser * testAllProps determines whether a given CSS property is supported in the browser
@ -1192,7 +1192,7 @@ Detects support for SVG in `<embed>` or `<object>` elements.
return testPropsAll(prop, undefined, undefined, value, skipValueTest); return testPropsAll(prop, undefined, undefined, value, skipValueTest);
} }
ModernizrProto.testAllProps = testAllProps; ModernizrProto.testAllProps = testAllProps;
/*! /*!
{ {
"name": "CSS Supports", "name": "CSS Supports",
@ -1283,4 +1283,4 @@ Detects support for SVG in `<embed>` or `<object>` elements.
; ;
})(window, document); })(window, document);

View File

@ -1,33 +1,47 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="no-js"> <html class="no-js">
<head> <head>
<meta charset="utf-8"> {% block site_meta %}
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1"> <meta charset="utf-8">
{% if page_title %} <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
<title>{{ page_title }} - {{ site_name }}</title> {% if config.site_description %}
{% elif page_description %} <meta name="description" content="{{ config.site_description }}">
<title>{{ site_name }} - {{ page_description }}</title> {% endif %}
{% else %} {% if page.canonical_url %}
<title>{{ site_name }}</title> <link rel="canonical" href="{{ page.canonical_url }}">
{% endif %} {% endif %}
{% if page_description %} {% if config.site_author %}
<meta name="description" content="{{ page_description }}"> <meta name="author" content="{{ config.site_author }}">
{% endif %} {% endif %}
{% if canonical_url %} {% if config.site_favicon %}
<link rel="canonical" href="{{ canonical_url }}"> <link rel="shortcut icon" href="{{ base_url }}/{{ config.site_favicon }}">
{% endif %} {% else %}
{% if site_author %} <link rel="shortcut icon" href="{{ base_url }}/assets/images/favicon.ico">
<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 %}
<script src="{{ base_url }}/assets/javascripts/modernizr.js"></script> {% block htmltitle %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700"> {% if page.title %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400"> <title>{{ page.title }} - {{ config.site_name }}</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> {% elif config.site_description %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.css"> <title>{{ config.site_name }} - {{ config.site_description }}</title>
{% for path in extra_css %} {% else %}
<link rel="stylesheet" href="{{ path }}"> <title>{{ config.site_name }}</title>
{% endfor %} {% endif %}
{% endblock %}
{% block libs %}
<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+Mono:400">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.css">
{% for path in extra_css %}
<link rel="stylesheet" href="{{ path }}">
{% 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,25 +51,27 @@
<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 %}
{% if nav %} {% block site_nav %}
<div class="md-sidebar md-sidebar--primary" data-md-sidebar="primary"> {% if nav %}
<div class="md-sidebar__scrollwrap"> <div class="md-sidebar md-sidebar--primary" data-md-sidebar="primary">
<div class="md-sidebar__inner"> <div class="md-sidebar__scrollwrap">
{% include "partials/nav.html" %} <div class="md-sidebar__inner">
{% include "partials/nav.html" %}
</div>
</div> </div>
</div> </div>
</div> {% endif %}
{% endif %} {% if page.toc %}
{% if 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"> {% include "partials/toc.html" %}
{% include "partials/toc.html" %} </div>
</div> </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,33 +99,47 @@
</div> </div>
</div> </div>
</main> </main>
{% include "partials/footer.html" %} {% block footer %}
{% include "partials/footer.html" %}
{% endblock %}
</div> </div>
{% for extension in config.markdown_extensions %} {% block scripts %}
{% if extension == "pymdownx.arithmatex" %} {% for extension in config.markdown_extensions %}
{% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %} {% if extension == "pymdownx.arithmatex" %}
<script src="https://cdn.mathjax.org/{{ path }}"></script> {% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %}
<script src="https://cdn.mathjax.org/{{ path }}"></script>
{% endif %}
{% endfor %}
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
<script>
/* Configuration for application */
var config = {
url: {
base: "{{ base_url }}",
}
};
/* Initialize application */
var app = new Application(config);
app.initialize();
</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% 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 %} {% endif %}
{% endfor %} {% endblock %}
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
<script>
/* Configuration for application */
var config = {
url: {
base: "{{ base_url }}",
},
repo: {
url: "{{ repo_url }}",
icon: "{{ repo_icon }}",
},
storage: window.sessionStorage,
};
/* Initialize application */
var app = new Application(config);
app.initialize();
</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% endfor %}
</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">
<label class="md-icon md-header-nav__icon md-header-nav__icon--search" for="search"> {%- block search_box -%}
search <label class="md-icon md-header-nav__icon md-header-nav__icon--search" for="search">
</label> search
{% include "partials/search.html" %} </label>
{% 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 -%}
{% include "partials/source.html" %} {% if config.repo_url %}
{% endif %} {% include "partials/source.html" %}
{% 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,7 +1,7 @@
{% 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" %}
{% elif "gitlab" in platform %} {% elif "gitlab" in platform %}
{% set repo_type = "gitlab" %} {% set repo_type = "gitlab" %}
{% set repo_icon = "md-source--gitlab" %} {% set repo_icon = "md-source--gitlab" %}
@ -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,9 +20,9 @@
IN THE SOFTWARE. IN THE SOFTWARE.
--> -->
{% extends "base.html" %} {% extends "main.html" %}
<!-- Content block --> <!-- Content block -->
{% block content %} {% block content %}
<h1>404 - Not found</h1> <h1>404 - Not found</h1>
{% endblock %} {% endblock %}

View File

@ -24,57 +24,77 @@
<html class="no-js"> <html class="no-js">
<head> <head>
<!-- Charset and viewport --> <!-- Block: metatags -->
<meta charset="utf-8" /> {% block site_meta %}
<meta name="viewport" content="width=device-width, <meta charset="utf-8" />
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" />
<!-- Site title --> <!-- Site description -->
{% 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>
{% else %}
<title>{{ site_name }}</title>
{% endif %}
<!-- Site description --> <!-- Canonical -->
{% if page_description %} {% if page.canonical_url %}
<meta name="description" content="{{ page_description }}" /> <link rel="canonical" href="{{ page.canonical_url }}" />
{% endif %} {% endif %}
<!-- Canonical --> <!-- Author -->
{% if canonical_url %} {% if config.site_author %}
<link rel="canonical" href="{{ canonical_url }}" /> <meta name="author" content="{{ config.site_author }}" />
{% endif %} {% endif %}
<!-- Author --> <!-- Favicon -->
{% if site_author %} {% if config.site_favicon %}
<meta name="author" content="{{ site_author }}" /> <link rel="shortcut icon"
{% endif %} href="{{ base_url }}/{{ config.site_favicon }}">
{% else %}
<link rel="shortcut icon"
href="{{ base_url }}/assets/images/favicon.ico">
{% 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 -->
<script src="{{ base_url }}/assets/javascripts/modernizr.js"></script> {% 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 %}
<!-- Web fonts --> <!-- Block: JavaScript libraries -->
<link rel="stylesheet" type="text/css" {% block libs %}
href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700" /> <script src="{{ base_url }}/assets/javascripts/modernizr.js"></script>
<link rel="stylesheet" type="text/css" {% endblock %}
href="https://fonts.googleapis.com/css?family=Roboto+Mono:400" />
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<!-- Theme-related stylesheets --> <!-- Block: webfonts and stylesheets -->
<link rel="stylesheet" type="text/css" {% block styles %}
href="{{ base_url }}/assets/stylesheets/application.css" /> <link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700" />
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family=Roboto+Mono:400" />
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<!-- Custom stylesheets --> <!-- Theme-related stylesheets -->
{% for path in extra_css %} <link rel="stylesheet" type="text/css"
<link rel="stylesheet" type="text/css" href="{{ path }}" /> href="{{ base_url }}/assets/stylesheets/application.css" />
{% endfor %}
<!-- Custom stylesheets -->
{% for path in extra_css %}
<link rel="stylesheet" type="text/css" href="{{ path }}" />
{% endfor %}
{% endblock %}
<!-- Block: custom front matter -->
{%- block extrahead -%}{% endblock %}
</head> </head>
<body> <body>
@ -103,37 +123,41 @@
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 %}
<!-- Main navigation --> <!-- Block: navigation -->
{% if nav %} {% block site_nav %}
<div class="md-sidebar md-sidebar--primary"
data-md-sidebar="primary"> <!-- Main navigation -->
<div class="md-sidebar__scrollwrap"> {% if nav %}
<div class="md-sidebar__inner"> <div class="md-sidebar md-sidebar--primary"
{% include "partials/nav.html" %} data-md-sidebar="primary">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
{% include "partials/nav.html" %}
</div>
</div> </div>
</div> </div>
</div> {% 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">
<div class="md-sidebar__inner"> <div class="md-sidebar__inner">
{% include "partials/toc.html" %} {% include "partials/toc.html" %}
</div>
</div> </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,41 +191,57 @@
</main> </main>
<!-- Application footer --> <!-- Application footer -->
{% include "partials/footer.html" %} {% block footer %}
{% include "partials/footer.html" %}
{% endblock %}
</div> </div>
<!-- Extension-related JavaScript --> <!-- Block: extension- and theme-related JavaScript -->
{% for extension in config.markdown_extensions %} {% block scripts %}
{% for extension in config.markdown_extensions %}
<!-- MathJax integration --> <!-- MathJax integration -->
{% 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" %}
<script src="https://cdn.mathjax.org/{{ path }}"></script> <script src="https://cdn.mathjax.org/{{ path }}"></script>
{% endif %}
{% endfor %}
<!-- Theme-related and custom JavaScript -->
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
<script>
/* Configuration for application */
var config = {
url: {
base: "{{ base_url }}",
}
};
/* Initialize application */
var app = new Application(config);
app.initialize();
</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% 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 %} {% endif %}
{% endfor %} {% endblock %}
<!-- Theme-related and custom JavaScript -->
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
<script>
/* Configuration for application */
var config = {
url: {
base: "{{ base_url }}",
},
repo: {
url: "{{ repo_url }}",
icon: "{{ repo_icon }}",
},
storage: window.sessionStorage,
};
/* Initialize application */
var app = new Application(config);
app.initialize();
</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% endfor %}
</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,27 +46,33 @@
<!-- 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">
<label class="md-icon md-header-nav__icon md-header-nav__icon--search" {%- block search_box -%}
for="search"> <label class="md-icon md-header-nav__icon md-header-nav__icon--search"
search for="search">
</label> search
</label>
<!-- 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 -%}
{% include "partials/source.html" %} {% if config.repo_url %}
{% endif %} {% include "partials/source.html" %}
{% 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,