diff --git a/material/base.html b/material/base.html index 338b3ced9a7605b669fcfb5e8835f2ccda21068c..be00d682908def286ef8ab35f12cbd3bd1768509 100644 --- a/material/base.html +++ b/material/base.html @@ -1,4 +1,5 @@ {% import "partials/language.html" as lang with context %} +{% set feature = config.theme.feature %} {% set palette = config.theme.palette %} {% set font = config.theme.font %} <!DOCTYPE html> @@ -104,7 +105,6 @@ {% include "partials/header.html" %} {% endblock %} <div class="md-container"> - {% set feature = config.extra.get("feature", {}) %} {% if feature.tabs %} {% include "partials/tabs.html" %} {% endif %} diff --git a/material/mkdocs_theme.yml b/material/mkdocs_theme.yml index d0d3ff22685d77c9905f8acb6218098335de1957..8ddef23bbe9e1c81bfa3eb1551b697da08b1b9a4 100644 --- a/material/mkdocs_theme.yml +++ b/material/mkdocs_theme.yml @@ -16,6 +16,12 @@ # IN THE SOFTWARE. # Language for theme localization language: en +# Feature flags for functionality that alters behavior significantly, and thus +# may be a matter of taste +feature: + # Another layer on top of the main navigation for larger screens in the form + # of tabs, especially useful for larger documentation projects + tabs: false # Sets the primary and accent color palettes as defined in the Material Design # documentation - possible values can be looked up in the getting started guide palette: diff --git a/material/partials/language.html b/material/partials/language.html index 523d10a1d5bdeeaef5d228e2ec21b3d2ccee05ec..34b80c3db648c2a71f0ad1fb80b84612e136a3a4 100644 --- a/material/partials/language.html +++ b/material/partials/language.html @@ -1,11 +1,4 @@ -{% set languages = "en" %} -{% if config and config.theme %} - {% set languages = config.theme.language | default("en") %} -{% endif %} -{% if languages is string %} - {% set languages = languages.split(",") | map("trim") %} -{% endif %} -{% import "partials/language/" + (languages | first) + ".html" as lang %} +{% import "partials/language/" + config.theme.language + ".html" as lang %} {% macro t(key) %}{{ { - "search.languages": languages | join(", ") + "search.languages": (config.extra.search | default({})).language | default("") }[key] or lang.t(key) }}{% endmacro %} diff --git a/mkdocs.yml b/mkdocs.yml index 037444a2976f7850f2e6cf71638010e5e340a2ce..3aab83f22da9d03620345dd4bdabf57a2059a4c3 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -37,22 +37,23 @@ theme: custom_dir: material # Same values as in mkdocs_theme.yml - language: kr + language: en + feature: + tabs: false + palette: + primary: + accent: font: text: Roboto code: Roboto Mono - palette: - primary: - accent: blue -plugins: - - search: null +#plugins: [] # Options extra: language: en - feature: - tabs: false + search: + languages: en, de, fr social: - type: globe link: http://struct.cc diff --git a/src/base.html b/src/base.html index 2d1b8f461ec87e224f2e05f8f144a8a066bc10af..65cea6998bc19218d5c9fedb18195a35732d6ece 100644 --- a/src/base.html +++ b/src/base.html @@ -23,6 +23,7 @@ {% import "partials/language.html" as lang with context %} <!-- Theme options --> +{% set feature = config.theme.feature %} {% set palette = config.theme.palette %} {% set font = config.theme.font %} @@ -200,7 +201,6 @@ <!-- Container, necessary for web-application context --> <div class="md-container"> - {% set feature = config.extra.get("feature", {}) %} <!-- Tabs with outline --> {% if feature.tabs %} diff --git a/src/mkdocs_theme.yml b/src/mkdocs_theme.yml index fa74252d455286bce7853c84c20808fd037f9ca3..1d99cc73e342cf42254dbad4337f423564f2e3b5 100644 --- a/src/mkdocs_theme.yml +++ b/src/mkdocs_theme.yml @@ -21,6 +21,14 @@ # Language for theme localization language: en +# Feature flags for functionality that alters behavior significantly, and thus +# may be a matter of taste +feature: + + # Another layer on top of the main navigation for larger screens in the form + # of tabs, especially useful for larger documentation projects + tabs: false + # Sets the primary and accent color palettes as defined in the Material Design # documentation - possible values can be looked up in the getting started guide palette: diff --git a/src/partials/language.html b/src/partials/language.html index 4e0007b48f18a97763b23d20d4d0dc1e2c788bd4..d44efb78914679c15ca8c7642fa8447317333abe 100644 --- a/src/partials/language.html +++ b/src/partials/language.html @@ -20,19 +20,10 @@ IN THE SOFTWARE. --> -<!-- Normalize language configuration --> -{% set languages = "en" %} -{% if config and config.theme %} - {% set languages = config.theme.language | default("en") %} -{% endif %} -{% if languages is string %} - {% set languages = languages.split(",") | map("trim") %} -{% endif %} - <!-- Import translations for given language --> -{% import "partials/language/" + (languages | first) + ".html" as lang %} +{% import "partials/language/" + config.theme.language + ".html" as lang %} <!-- Re-export translations --> {% macro t(key) %}{{ { - "search.languages": languages | join(", ") + "search.languages": (config.extra.search | default({})).language | default("") }[key] or lang.t(key) }}{% endmacro %}