From 364309d47aff40e5b9f13fa308375df3f86372ff Mon Sep 17 00:00:00 2001
From: squidfunk <scifish@gmail.com>
Date: Fri, 13 Jan 2017 00:31:37 +0100
Subject: [PATCH] Restructured partials

---
 docs/customization.md                         |  4 +-
 docs/getting-started.md                       |  4 +-
 material/base.html                            | 27 +++++++++--
 material/partials/fonts.html                  |  8 ----
 material/partials/footer.html                 |  6 +--
 .../partials/{i18n.html => language.html}     |  0
 material/partials/search.html                 |  4 +-
 material/partials/source.html                 |  4 +-
 material/partials/svgs.html                   | 10 ----
 material/partials/toc.html                    |  4 +-
 src/base.html                                 | 47 +++++++++++++++++--
 src/partials/fonts.html                       | 42 -----------------
 src/partials/footer.html                      |  6 +--
 src/partials/{i18n.html => language.html}     |  0
 src/partials/search.html                      |  4 +-
 src/partials/source.html                      |  4 +-
 src/partials/svgs.html                        | 38 ---------------
 src/partials/toc.html                         |  4 +-
 18 files changed, 86 insertions(+), 130 deletions(-)
 delete mode 100644 material/partials/fonts.html
 rename material/partials/{i18n.html => language.html} (100%)
 delete mode 100644 material/partials/svgs.html
 delete mode 100644 src/partials/fonts.html
 rename src/partials/{i18n.html => language.html} (100%)
 delete mode 100644 src/partials/svgs.html

diff --git a/docs/customization.md b/docs/customization.md
index 3b6311cf..00cdbcbe 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 1d770d6b..fdd2fee6 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 1d2d05cf..7ad65747 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 39f7aea8..00000000
--- 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 5a063b2e..4c39d0e0 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 875d22d0..87783dbf 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 5dbaee2e..221b551a 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 82385c7d..00000000
--- 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 d17dc707..004067dd 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 06de751a..9383f155 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 038c6147..00000000
--- 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 27d79ccd..4cd481fd 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 d1514a4e..3ba60ba7 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 9d8e9093..d6dd8c20 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 8b88039b..00000000
--- 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 999bb245..b35d5e80 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" %}
-- 
GitLab