From fe12548f8eed3f4aae018cb5cd848261e9b03412 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Thu, 15 Dec 2016 16:43:40 +0100 Subject: [PATCH] Merge pull request #65 from brendo:issue-63-mkdocs-016-compatible --- CHANGELOG | 5 +- README.md | 2 +- material/404.html | 4 +- material/assets/javascripts/application.js | 58 +++-- material/assets/javascripts/modernizr.js | 34 +-- material/base.html | 176 ++++++++------- material/main.html | 1 + material/partials/footer.html | 14 +- material/partials/header.html | 24 ++- material/partials/nav-item.html | 2 +- material/partials/nav.html | 4 +- material/partials/source.html | 6 +- material/partials/toc.html | 1 + src/404.html | 4 +- src/base.html | 238 ++++++++++++--------- src/main.html | 23 ++ src/partials/footer.html | 14 +- src/partials/header.html | 28 ++- src/partials/nav-item.html | 4 +- src/partials/nav.html | 4 +- src/partials/source.html | 4 +- src/partials/toc.html | 1 + 22 files changed, 376 insertions(+), 275 deletions(-) create mode 100644 material/main.html create mode 100644 src/main.html diff --git a/CHANGELOG b/CHANGELOG index 59933a652..5223bd020 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,11 +32,12 @@ mkdocs-material-1.0.0-rc.1 (2016-XX-XX) * Added more detailed documentation on specimen, extensions etc. * Added a 404.html error page for deployment on GitHub Pages * 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) * 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 #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) - * Initial release \ No newline at end of file + * Initial release diff --git a/README.md b/README.md index b5b7e91d7..0f4205ffd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![PyPI Downloads][pypi-dl-image]][pypi-dl-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/) diff --git a/material/404.html b/material/404.html index 3bbe15915..67cfc1126 100644 --- a/material/404.html +++ b/material/404.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "main.html" %} {% block content %}

404 - Not found

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/material/assets/javascripts/application.js b/material/assets/javascripts/application.js index 81af084cc..b5caa9d59 100644 --- a/material/assets/javascripts/application.js +++ b/material/assets/javascripts/application.js @@ -2801,13 +2801,13 @@ var Application = * this.field('title', 10) * this.field('tags', 100) * this.field('body') - * + * * this.ref('cid') - * + * * this.pipeline.add(function () { * // some custom pipeline function * }) - * + * * }) * * @param {Function} config A function that will be called with the new instance @@ -5321,36 +5321,32 @@ var Application = 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; }; }(); /* - * Copyright (c) 2016 Martin Donath - * - * 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 }; } + 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 + * + * 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 * ------------------------------------------------------------------------- */ @@ -5404,4 +5400,4 @@ var Application = /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15))) /***/ } -/******/ ]); \ No newline at end of file +/******/ ]); diff --git a/material/assets/javascripts/modernizr.js b/material/assets/javascripts/modernizr.js index 6ed45dcf7..6dbb469cb 100644 --- a/material/assets/javascripts/modernizr.js +++ b/material/assets/javascripts/modernizr.js @@ -24,7 +24,7 @@ ;(function(window, document, undefined){ var tests = []; - + /** * @@ -73,7 +73,7 @@ } }; - + // Fake some of Object.create so we can force non test results to be non "own" properties. var Modernizr = function() {}; @@ -83,10 +83,10 @@ // Overwrite name so constructor name is nicer :D Modernizr = new Modernizr(); - + var classes = []; - + /** * is returns a boolean if the typeof an obj is exactly type. @@ -182,7 +182,7 @@ */ var docElement = document.documentElement; - + /** * 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'; - + /** * 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 @@ -470,7 +470,7 @@ ModernizrProto.addTest = addTest; }); - + /** @@ -746,7 +746,7 @@ Detects support for SVG in `` or `` elements. */ var testStyles = ModernizrProto.testStyles = injectElementWithStyles; - + /*! { "name": "@font-face", @@ -814,11 +814,11 @@ Detects support for SVG in `` or `` elements. */ var omPrefixes = 'Moz O ms Webkit'; - + var cssomPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.split(' ') : []); ModernizrProto._cssomPrefixes = cssomPrefixes; - + /** @@ -852,7 +852,7 @@ Detects support for SVG in `` or `` elements. delete modElem.elem; }); - + var mStyle = { style: modElem.elem.style @@ -864,7 +864,7 @@ Detects support for SVG in `` or `` elements. delete mStyle.style; }); - + /** * domToCSS takes a camelCase string and converts it to kebab-case @@ -1054,7 +1054,7 @@ Detects support for SVG in `` or `` elements. var domPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.toLowerCase().split(' ') : []); ModernizrProto._domPrefixes = domPrefixes; - + /** * 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 `` or `` elements. // Modernizr.testAllProps('boxSizing') ModernizrProto.testAllProps = testPropsAll; - + /** * testAllProps determines whether a given CSS property is supported in the browser @@ -1192,7 +1192,7 @@ Detects support for SVG in `` or `` elements. return testPropsAll(prop, undefined, undefined, value, skipValueTest); } ModernizrProto.testAllProps = testAllProps; - + /*! { "name": "CSS Supports", @@ -1283,4 +1283,4 @@ Detects support for SVG in `` or `` elements. ; -})(window, document); \ No newline at end of file +})(window, document); diff --git a/material/base.html b/material/base.html index 7fd2b928a..1fca06577 100644 --- a/material/base.html +++ b/material/base.html @@ -1,33 +1,47 @@ - - - {% if page_title %} - {{ page_title }} - {{ site_name }} - {% elif page_description %} - {{ site_name }} - {{ page_description }} - {% else %} - {{ site_name }} - {% endif %} - {% if page_description %} - - {% endif %} - {% if canonical_url %} - - {% endif %} - {% if site_author %} - - {% endif %} - - - - - - - {% for path in extra_css %} - - {% endfor %} + {% block site_meta %} + + + {% if config.site_description %} + + {% endif %} + {% if page.canonical_url %} + + {% endif %} + {% if config.site_author %} + + {% endif %} + {% if config.site_favicon %} + + {% else %} + + {% endif %} + + {% endblock %} + {% block htmltitle %} + {% if page.title %} + {{ page.title }} - {{ config.site_name }} + {% elif config.site_description %} + {{ config.site_name }} - {{ config.site_description }} + {% else %} + {{ config.site_name }} + {% endif %} + {% endblock %} + {% block libs %} + + {% endblock %} + {% block styles %} + + + + + {% for path in extra_css %} + + {% endfor %} + {% endblock %} + {%- block extrahead -%}{% endblock %} @@ -37,25 +51,27 @@
- {% set h1 = "\x3ch1 id=" in content %} - {% if nav %} -
-
-
- {% include "partials/nav.html" %} + {% set h1 = "\x3ch1 id=" in page.content %} + {% block site_nav %} + {% if nav %} +
+
+
+ {% include "partials/nav.html" %} +
-
- {% endif %} - {% if toc %} -
-
-
- {% include "partials/toc.html" %} + {% endif %} + {% if page.toc %} +
+
+
+ {% include "partials/toc.html" %} +
-
- {% endif %} + {% endif %} + {% endblock %}
{% block content %} @@ -64,17 +80,15 @@ Edit {% endif %} - {{ content }} + {{ page.content }} {% endblock %}
- {% if copyright %} - {{ copyright }} – + {% if config.copyright %} + {{ config.copyright }} – {% endif %} This document was created with - - MkDocs - + MkDocs and the Material @@ -85,33 +99,47 @@
- {% include "partials/footer.html" %} + {% block footer %} + {% include "partials/footer.html" %} + {% endblock %}
- {% for extension in config.markdown_extensions %} - {% if extension == "pymdownx.arithmatex" %} - {% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %} - + {% block scripts %} + {% for extension in config.markdown_extensions %} + {% if extension == "pymdownx.arithmatex" %} + {% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %} + + {% endif %} + {% endfor %} + + + {% for path in extra_javascript %} + + {% endfor %} + {% endblock %} + {% block analytics %} + {% if config.google_analytics %} + {% endif %} - {% endfor %} - - - {% for path in extra_javascript %} - - {% endfor %} + {% endblock %} diff --git a/material/main.html b/material/main.html new file mode 100644 index 000000000..94d9808cc --- /dev/null +++ b/material/main.html @@ -0,0 +1 @@ +{% extends "base.html" %} diff --git a/material/partials/footer.html b/material/partials/footer.html index 85db44d05..49d9f204a 100644 --- a/material/partials/footer.html +++ b/material/partials/footer.html @@ -1,9 +1,9 @@