From 5e7ad632de9f8aa87af0a0c822fadb7717b83606 Mon Sep 17 00:00:00 2001
From: squidfunk <martin.donath@squidfunk.com>
Date: Sat, 21 Oct 2017 18:13:49 +0200
Subject: [PATCH] Improved downward compatibility with custom partials

---
 material/partials/language.html    |  5 +++-
 material/partials/language/es.html | 18 ++++++++++++++
 material/partials/language/pl.html |  1 +
 material/partials/language/sv.html | 18 ++++++++++++++
 src/partials/language.html         |  5 +++-
 src/partials/language/pl.html      | 39 ++++++++++++++++--------------
 src/partials/language/sv.html      | 35 +++++++++++++--------------
 7 files changed, 83 insertions(+), 38 deletions(-)
 create mode 100644 material/partials/language/es.html
 create mode 100755 material/partials/language/pl.html
 create mode 100644 material/partials/language/sv.html

diff --git a/material/partials/language.html b/material/partials/language.html
index 0d2f3c25..a7de8a29 100644
--- a/material/partials/language.html
+++ b/material/partials/language.html
@@ -1,4 +1,7 @@
-{% set languages = config.extra.language | default("en") %}
+{% set languages = "en" %}
+{% if config and config.extra %}
+  {% set languages = config.extra.language | default("en") %}
+{% endif %}
 {% if languages is string %}
   {% set languages = languages.split(",") | map("trim") %}
 {% endif %}
diff --git a/material/partials/language/es.html b/material/partials/language/es.html
new file mode 100644
index 00000000..1e2dbf68
--- /dev/null
+++ b/material/partials/language/es.html
@@ -0,0 +1,18 @@
+{% macro t(key) %}{{ {
+  "language": "es",
+  "clipboard.copy": "Copiar al portapapeles",
+  "clipboard.copied": "Copiado al portapapeles",
+  "edit.link.title": "Editar esta página",
+  "footer.previous": "Anterior",
+  "footer.next": "Siguiente",
+  "meta.comments": "Comentarios",
+  "meta.source": "Fuente",
+  "search.placeholder": "Búsqueda",
+  "search.result.placeholder": "Teclee para comenzar búsqueda",
+  "search.result.none": "No se encontraron documentos",
+  "search.result.one": "1 documento encontrado",
+  "search.result.other": "# documentos encontrados",
+  "search.tokenizer": "[\s\-]+",
+  "source.link.title": "Ir al repositorio",
+  "toc.title": "Tabla de contenidos"
+}[key] }}{% endmacro %}
diff --git a/material/partials/language/pl.html b/material/partials/language/pl.html
new file mode 100755
index 00000000..54889e5c
--- /dev/null
+++ b/material/partials/language/pl.html
@@ -0,0 +1 @@
+{% macro t(key) %}{{ {
  "language": "pl",
  "clipboard.copy": "Kopiuj do schowka",
  "clipboard.copied": "Skopiowane",
  "edit.link.title": "Edytuj tę stronę",
  "footer.previous": "Poprzednia strona",
  "footer.next": "Następna strona",
  "meta.comments": "Komentarze",
  "meta.source": "Kod źródłowy",
  "search.placeholder": "Szukaj",
  "search.result.placeholder": "Zacznij pisać, aby szukać",
  "search.result.none": "Brak wyników wyszukiwania",
  "search.result.one": "Wyniki wyszukiwania: 1",
  "search.result.other": "Wyniki wyszukiwania: #",
  "search.tokenizer": "[\s\-]+",
  "source.link.title": "Idź do repozytorium",
  "toc.title": "Spis treści"
}[key] }}{% endmacro %}
diff --git a/material/partials/language/sv.html b/material/partials/language/sv.html
new file mode 100644
index 00000000..1d164713
--- /dev/null
+++ b/material/partials/language/sv.html
@@ -0,0 +1,18 @@
+{% macro t(key) %}{{ {
+  "language": "sv",
+  "clipboard.copy": "Kopiera till urklipp",
+  "clipboard.copied": "Kopierat till urklipp",
+  "edit.link.title": "Redigera sidan",
+  "footer.previous": "Föregående",
+  "footer.next": "Nästa",
+  "meta.comments": "Kommentarer",
+  "meta.source": "Källa",
+  "search.placeholder": "Sök",
+  "search.result.placeholder": "Skriv sökord",
+  "search.result.none": "Inga sökresultat",
+  "search.result.one": "1 sökresultat",
+  "search.result.other": "# sökresultat",
+  "search.tokenizer": "[\s\-]+",
+  "source.link.title": "Gå till datakatalog",
+  "toc.title": "Innehållsförteckning"
+}[key] }}{% endmacro %}
diff --git a/src/partials/language.html b/src/partials/language.html
index 1f70d87a..36deee12 100644
--- a/src/partials/language.html
+++ b/src/partials/language.html
@@ -21,7 +21,10 @@
 -->
 
 <!-- Normalize language configuration -->
-{% set languages = config.extra.language | default("en") %}
+{% set languages = "en" %}
+{% if config and config.extra %}
+  {% set languages = config.extra.language | default("en") %}
+{% endif %}
 {% if languages is string %}
   {% set languages = languages.split(",") | map("trim") %}
 {% endif %}
diff --git a/src/partials/language/pl.html b/src/partials/language/pl.html
index fab243e0..5039b2fc 100755
--- a/src/partials/language/pl.html
+++ b/src/partials/language/pl.html
@@ -1,20 +1,23 @@
-<!--
-  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.
+<!--
+  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.
 -->
 
 <!-- Translations: Polish -->
@@ -35,4 +38,4 @@
   "search.tokenizer": "[\s\-]+",
   "source.link.title": "Idź do repozytorium",
   "toc.title": "Spis treści"
-}[key] }}{% endmacro %}
\ No newline at end of file
+}[key] }}{% endmacro %}
diff --git a/src/partials/language/sv.html b/src/partials/language/sv.html
index f5f8add1..07d8d7b3 100644
--- a/src/partials/language/sv.html
+++ b/src/partials/language/sv.html
@@ -1,27 +1,26 @@
 <!--
-Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
+  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:
+  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 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.
+  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.
 -->
 
 <!-- Translations: Swedish -->
-
 {% macro t(key) %}{{ {
   "language": "sv",
   "clipboard.copy": "Kopiera till urklipp",
@@ -39,4 +38,4 @@ IN THE SOFTWARE.
   "search.tokenizer": "[\s\-]+",
   "source.link.title": "Gå till datakatalog",
   "toc.title": "Innehållsförteckning"
-}[key] }}{% endmacro %}
\ No newline at end of file
+}[key] }}{% endmacro %}
-- 
GitLab