diff --git a/docs/customization.md b/docs/customization.md index 3b6311cf73eeb030c9312a99fb649ffc8159a40a..00cdbcbe0b8e9b75574943bf5833218b7c98ffee 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -98,16 +98,14 @@ The directory layout of the Material theme is as follows: │ ├─ javascripts/ # JavaScript │ └─ stylesheets/ # Stylesheets ├─ partials/ -│ ├─ fonts.html # Webfont definitions │ ├─ footer.html # Footer bar │ ├─ header.html # Header bar -│ ├─ i18n.html # Localized labels +│ ├─ language.html # Localized labels │ ├─ nav-item.html # Main navigation item │ ├─ nav.html # Main navigation │ ├─ search.html # Search box │ ├─ social.html # Social links │ ├─ source.html # Repository information -│ ├─ svgs.html # Inline SVG definitions │ ├─ toc-item.html # Table of contents item │ └─ toc.html # Table of contents ├─ 404.html # 404 error page diff --git a/docs/getting-started.md b/docs/getting-started.md index 1d770d6b9cbf6163afe6d7d90dbac6cc1948a308..fdd2fee65566f0cbbbe8073142da923edda14c6e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -281,8 +281,8 @@ google_analytics: ### Localization <small>L10N</small> In order to localize the labels (e.g. *Previous* and *Next* in the footer), -you can override the file `partials/i18n.html` to provide your own translations -inside the macro `t`: +you can override the file `partials/language.html` to provide your own +translations inside the macro `t`: ``` jinja {% macro t(key) %}{{ { diff --git a/material/base.html b/material/base.html index 1d2d05cfd25ea81c5416578ad2adbdde6a1476c3..7ad6574775c3f730907ea954f68a6eb1970ec2e2 100644 --- a/material/base.html +++ b/material/base.html @@ -1,4 +1,4 @@ -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <!DOCTYPE html> <html class="no-js"> <head> @@ -34,7 +34,15 @@ <script src="{{ base_url }}/assets/javascripts/modernizr-facb31f4a3.js"></script> {% endblock %} {% block fonts %} - {% include "partials/fonts.html" %} + {% if config.extra.font != "none" %} + {% set text = config.extra.get("font", {}).text | default("Roboto") %} + {% set code = config.extra.get("font", {}).code + | default("Roboto Mono") %} + {% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %} + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{ font }}"> + <style>body,input{font-family:"{{ text }}","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"{{ code }}","Courier New",Courier,monospace}</style> + {% endif %} + <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> {% endblock %} {% block styles %} <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-ff220fd69d.css"> @@ -55,7 +63,18 @@ {% else %} <body> {% endif %} - {% include "partials/svgs.html" %} + <svg class="md-svg"> + <defs> + {% set platform = config.extra.repo_icon or config.repo_url %} + {% if "github" in platform %} + {% include "assets/images/icons/github-1da075986e.svg" %} + {% elif "gitlab" in platform %} + {% include "assets/images/icons/gitlab-5ad3f9f9e5.svg" %} + {% elif "bitbucket" in platform %} + {% include "assets/images/icons/bitbucket-670608a71a.svg" %} + {% endif %} + </defs> + </svg> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="search"> <label class="md-overlay" data-md-component="overlay" for="drawer"></label> @@ -88,7 +107,7 @@ <div class="md-content"> <article class="md-content__inner md-typeset"> {% if config.edit_uri %} - <a href="{{ page.edit_url }}" title="{{ i18n.t('edit.link.title') }}" class="md-icon md-content__edit">edit</a> + <a href="{{ page.edit_url }}" title="{{ lang.t('edit.link.title') }}" class="md-icon md-content__edit">edit</a> {% endif %} {% block content %} {% if not "\x3ch1 id=" in page.content %} diff --git a/material/partials/fonts.html b/material/partials/fonts.html deleted file mode 100644 index 39f7aea820ced95b19a0da3b8d5cec7670d81d29..0000000000000000000000000000000000000000 --- a/material/partials/fonts.html +++ /dev/null @@ -1,8 +0,0 @@ -{% if config.extra.font != "none" %} - {% set text = config.extra.get("font", {}).text | default("Roboto") %} - {% set code = config.extra.get("font", {}).code | default("Roboto Mono") %} - {% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %} - <link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{ font }}"> - <style>body,input{font-family:"{{ text }}","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"{{ code }}","Courier New",Courier,monospace}</style> -{% endif %} -<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> diff --git a/material/partials/footer.html b/material/partials/footer.html index 5a063b2e2688984393a154da4a77956a823ff306..4c39d0e01c5a7d6f5d2e5839c088081dbb0bf018 100644 --- a/material/partials/footer.html +++ b/material/partials/footer.html @@ -1,4 +1,4 @@ -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <footer class="md-footer"> {% if page.previous_page or page.next_page %} <div class="md-footer-nav"> @@ -11,7 +11,7 @@ <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> - {{ i18n.t('footer.previous') }} + {{ lang.t('footer.previous') }} </span> {{ page.previous_page.title }} </span> @@ -23,7 +23,7 @@ <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> - {{ i18n.t('footer.next') }} + {{ lang.t('footer.next') }} </span> {{ page.next_page.title }} </span> diff --git a/material/partials/i18n.html b/material/partials/language.html similarity index 100% rename from material/partials/i18n.html rename to material/partials/language.html diff --git a/material/partials/search.html b/material/partials/search.html index 875d22d02676ccac13b30d46dc2d0abbeb266f3f..87783dbf081ec57d523990c8c95c5e8fc9a4915e 100644 --- a/material/partials/search.html +++ b/material/partials/search.html @@ -1,9 +1,9 @@ -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <div class="md-search" data-md-component="search"> <div class="md-search__overlay"></div> <div class="md-search__inner"> <form class="md-search__form" name="search"> - <input type="text" class="md-search__input" name="query" placeholder="{{ i18n.t('search.placeholder') }}" accesskey="s" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false"> + <input type="text" class="md-search__input" name="query" placeholder="{{ lang.t('search.placeholder') }}" accesskey="s" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false"> <label class="md-icon md-search__icon" for="search"></label> </form> <div class="md-search__output"> diff --git a/material/partials/source.html b/material/partials/source.html index 5dbaee2e66272a2d48f83e8be83f40f20dc42635..221b551ab3d8a87c7fa14a3c8f63760be395f902 100644 --- a/material/partials/source.html +++ b/material/partials/source.html @@ -1,4 +1,4 @@ -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} {% set platform = config.extra.repo_icon or config.repo_url %} {% if "github" in platform %} {% set repo_type = "github" %} @@ -10,7 +10,7 @@ {% set repo_type = "" %} {% endif %} {% block repo %} - <a href="{{ config.repo_url }}" title="{{ i18n.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}"> + <a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}"> {% if repo_type %} <div class="md-source__icon"> <svg viewBox="0 0 24 24" width="24" height="24"> diff --git a/material/partials/svgs.html b/material/partials/svgs.html deleted file mode 100644 index 82385c7d4c58f8a981b9864b40ef92cd5f4c8e95..0000000000000000000000000000000000000000 --- a/material/partials/svgs.html +++ /dev/null @@ -1,10 +0,0 @@ -<div class="md-svg"> - {% set platform = config.extra.repo_icon or config.repo_url %} - {% if "github" in platform %} - {% include "assets/images/icons/github-1da075986e.svg" %} - {% elif "gitlab" in platform %} - {% include "assets/images/icons/gitlab-5ad3f9f9e5.svg" %} - {% elif "bitbucket" in platform %} - {% include "assets/images/icons/bitbucket-670608a71a.svg" %} - {% endif %} -</div> diff --git a/material/partials/toc.html b/material/partials/toc.html index d17dc7074d7bcaa0e2d6deb8d638473acc37adad..004067dda9103cf62ed2b27b9b50dc38f84b5b2f 100644 --- a/material/partials/toc.html +++ b/material/partials/toc.html @@ -1,11 +1,11 @@ -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <nav class="md-nav md-nav--secondary"> {% set toc_ = page.toc %} {% if "\x3ch1 id=" in page.content %} {% set toc_ = (toc_ | first).children %} {% endif %} {% if toc_ and (toc_ | first) %} - <label class="md-nav__title" for="toc">{{ i18n.t('toc.title') }}</label> + <label class="md-nav__title" for="toc">{{ lang.t('toc.title') }}</label> <ul class="md-nav__list" data-md-scrollfix> {% for toc_item in toc_ %} {% include "partials/toc-item.html" %} diff --git a/src/base.html b/src/base.html index 06de751a79f6c2a03a530d7b7a3524ddc31d8a26..9383f15547020470fdf723e7a3b1a5360ed04cca 100644 --- a/src/base.html +++ b/src/base.html @@ -20,7 +20,7 @@ IN THE SOFTWARE. --> -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <!DOCTYPE html> <html class="no-js"> @@ -77,7 +77,28 @@ <!-- Block: webfonts --> {% block fonts %} - {% include "partials/fonts.html" %} + {% if config.extra.font != "none" %} + {% set text = config.extra.get("font", {}).text | default("Roboto") %} + {% set code = config.extra.get("font", {}).code + | default("Roboto Mono") %} + {% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %} + <link rel="stylesheet" type="text/css" + href="https://fonts.googleapis.com/css?family={{ font }}" /> + <style> + body, input { + font-family: "{{ text }}", "Helvetica Neue", + Helvetica, Arial, sans-serif; + } + pre, code, kbd { + font-family: "{{ code }}", "Courier New", + Courier, monospace; + } + </style> + {% endif %} + + <!-- Material icons as a default iconset --> + <link rel="stylesheet" type="text/css" + href="https://fonts.googleapis.com/icon?family=Material+Icons" /> {% endblock %} <!-- Block: stylesheets --> @@ -114,8 +135,24 @@ <body> {% endif %} - <!-- Inline SVGs --> - {% include "partials/svgs.html" %} + <!-- Hidden container for inline SVGs --> + <svg class="md-svg"> + <defs> + + <!-- + Check whether the repository is hosted on one of the supported code + hosting platforms (Github, Gitlab or Bitbucket) to show icon. + --> + {% set platform = config.extra.repo_icon or config.repo_url %} + {% if "github" in platform %} + {% include "assets/images/icons/github.svg" %} + {% elif "gitlab" in platform %} + {% include "assets/images/icons/gitlab.svg" %} + {% elif "bitbucket" in platform %} + {% include "assets/images/icons/bitbucket.svg" %} + {% endif %} + </defs> + </svg> <!-- State toggles --> <input class="md-toggle" data-md-toggle="drawer" @@ -173,7 +210,7 @@ <!-- Edit button, if URL was defined --> {% if config.edit_uri %} <a href="{{ page.edit_url }}" - title="{{ i18n.t('edit.link.title') }}" + title="{{ lang.t('edit.link.title') }}" class="md-icon md-content__edit">edit</a> {% endif %} diff --git a/src/partials/fonts.html b/src/partials/fonts.html deleted file mode 100644 index 038c614739a19f505d25155b858d371094fc1ea5..0000000000000000000000000000000000000000 --- a/src/partials/fonts.html +++ /dev/null @@ -1,42 +0,0 @@ -<!-- - Copyright (c) 2016-2017 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. ---> - -<!-- Proportional and monospaced fonts --> -{% if config.extra.font != "none" %} - {% set text = config.extra.get("font", {}).text | default("Roboto") %} - {% set code = config.extra.get("font", {}).code | default("Roboto Mono") %} - {% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %} - <link rel="stylesheet" type="text/css" - href="https://fonts.googleapis.com/css?family={{ font }}" /> - <style> - body, input { - font-family: "{{ text }}", "Helvetica Neue", Helvetica, Arial, sans-serif; - } - pre, code, kbd { - font-family: "{{ code }}", "Courier New", Courier, monospace; - } - </style> -{% endif %} - -<!-- Material icons as a default iconset --> -<link rel="stylesheet" type="text/css" - href="https://fonts.googleapis.com/icon?family=Material+Icons" /> diff --git a/src/partials/footer.html b/src/partials/footer.html index 27d79ccd73f1cc735e9ba681a02aacde3c944c02..4cd481fd5beb9ae24e3a6c9bd30d1f4a0494e840 100644 --- a/src/partials/footer.html +++ b/src/partials/footer.html @@ -20,7 +20,7 @@ IN THE SOFTWARE. --> -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <!-- Application footer --> <footer class="md-footer"> @@ -44,7 +44,7 @@ md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> - {{ i18n.t('footer.previous') }} + {{ lang.t('footer.previous') }} </span> {{ page.previous_page.title }} </span> @@ -61,7 +61,7 @@ md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> - {{ i18n.t('footer.next') }} + {{ lang.t('footer.next') }} </span> {{ page.next_page.title }} </span> diff --git a/src/partials/i18n.html b/src/partials/language.html similarity index 100% rename from src/partials/i18n.html rename to src/partials/language.html diff --git a/src/partials/search.html b/src/partials/search.html index d1514a4edacb0ace1412367bb4569bf16311d3fe..3ba60ba7b3d51559fc6f298436413abe7303ee1f 100644 --- a/src/partials/search.html +++ b/src/partials/search.html @@ -20,7 +20,7 @@ IN THE SOFTWARE. --> -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <!-- Search interface --> <div class="md-search" data-md-component="search"> @@ -28,7 +28,7 @@ <div class="md-search__inner"> <form class="md-search__form" name="search"> <input type="text" class="md-search__input" name="query" - placeholder="{{ i18n.t('search.placeholder') }}" + placeholder="{{ lang.t('search.placeholder') }}" accesskey="s" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" /> <label class="md-icon md-search__icon" for="search"></label> diff --git a/src/partials/source.html b/src/partials/source.html index 9d8e90935917fd93051c8b6210b003da06d9957b..d6dd8c20ad5fdfea60677442ebbadfcaa7557256 100644 --- a/src/partials/source.html +++ b/src/partials/source.html @@ -20,7 +20,7 @@ IN THE SOFTWARE. --> -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <!-- Check whether the repository is hosted on one of the supported code hosting @@ -39,7 +39,7 @@ <!-- Repository containing source --> {% block repo %} - <a href="{{ config.repo_url }}" title="{{ i18n.t('source.link.title') }}" + <a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}"> {% if repo_type %} <div class="md-source__icon"> diff --git a/src/partials/svgs.html b/src/partials/svgs.html deleted file mode 100644 index 8b88039be9bd6a3b39bef0847cf2ddc60af629f3..0000000000000000000000000000000000000000 --- a/src/partials/svgs.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - Copyright (c) 2016-2017 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. ---> - -<!-- Hidden container for inline SVGs --> -<div class="md-svg"> - - <!-- - Check whether the repository is hosted on one of the supported code hosting - platforms (Github, Gitlab or Bitbucket) to show icon. - --> - {% set platform = config.extra.repo_icon or config.repo_url %} - {% if "github" in platform %} - {% include "assets/images/icons/github.svg" %} - {% elif "gitlab" in platform %} - {% include "assets/images/icons/gitlab.svg" %} - {% elif "bitbucket" in platform %} - {% include "assets/images/icons/bitbucket.svg" %} - {% endif %} -</div> diff --git a/src/partials/toc.html b/src/partials/toc.html index 999bb2450303bfff332a73d580c8a47f2288323e..b35d5e807afa9921d407d9822329abb56459e326 100644 --- a/src/partials/toc.html +++ b/src/partials/toc.html @@ -20,7 +20,7 @@ IN THE SOFTWARE. --> -{% import "partials/i18n.html" as i18n %} +{% import "partials/language.html" as lang %} <!-- Table of contents --> <nav class="md-nav md-nav--secondary"> @@ -38,7 +38,7 @@ <!-- Render item list --> {% if toc_ and (toc_ | first) %} - <label class="md-nav__title" for="toc">{{ i18n.t('toc.title') }}</label> + <label class="md-nav__title" for="toc">{{ lang.t('toc.title') }}</label> <ul class="md-nav__list" data-md-scrollfix> {% for toc_item in toc_ %} {% include "partials/toc-item.html" %}