mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Moved language and features to theme configuration
This commit is contained in:
parent
a5d90ea2a9
commit
5fbba74c80
@ -1,4 +1,5 @@
|
|||||||
{% import "partials/language.html" as lang with context %}
|
{% import "partials/language.html" as lang with context %}
|
||||||
|
{% set feature = config.theme.feature %}
|
||||||
{% set palette = config.theme.palette %}
|
{% set palette = config.theme.palette %}
|
||||||
{% set font = config.theme.font %}
|
{% set font = config.theme.font %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -104,7 +105,6 @@
|
|||||||
{% include "partials/header.html" %}
|
{% include "partials/header.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<div class="md-container">
|
<div class="md-container">
|
||||||
{% set feature = config.extra.get("feature", {}) %}
|
|
||||||
{% if feature.tabs %}
|
{% if feature.tabs %}
|
||||||
{% include "partials/tabs.html" %}
|
{% include "partials/tabs.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -16,6 +16,12 @@
|
|||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
# Language for theme localization
|
# Language for theme localization
|
||||||
language: en
|
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
|
# 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
|
# documentation - possible values can be looked up in the getting started guide
|
||||||
palette:
|
palette:
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
{% set languages = "en" %}
|
{% import "partials/language/" + config.theme.language + ".html" as lang %}
|
||||||
{% 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 %}
|
|
||||||
{% macro t(key) %}{{ {
|
{% macro t(key) %}{{ {
|
||||||
"search.languages": languages | join(", ")
|
"search.languages": (config.extra.search | default({})).language | default("")
|
||||||
}[key] or lang.t(key) }}{% endmacro %}
|
}[key] or lang.t(key) }}{% endmacro %}
|
||||||
|
17
mkdocs.yml
17
mkdocs.yml
@ -37,22 +37,23 @@ theme:
|
|||||||
custom_dir: material
|
custom_dir: material
|
||||||
|
|
||||||
# Same values as in mkdocs_theme.yml
|
# Same values as in mkdocs_theme.yml
|
||||||
language: kr
|
language: en
|
||||||
|
feature:
|
||||||
|
tabs: false
|
||||||
|
palette:
|
||||||
|
primary:
|
||||||
|
accent:
|
||||||
font:
|
font:
|
||||||
text: Roboto
|
text: Roboto
|
||||||
code: Roboto Mono
|
code: Roboto Mono
|
||||||
palette:
|
|
||||||
primary:
|
|
||||||
accent: blue
|
|
||||||
|
|
||||||
plugins:
|
#plugins: []
|
||||||
- search: null
|
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
extra:
|
extra:
|
||||||
language: en
|
language: en
|
||||||
feature:
|
search:
|
||||||
tabs: false
|
languages: en, de, fr
|
||||||
social:
|
social:
|
||||||
- type: globe
|
- type: globe
|
||||||
link: http://struct.cc
|
link: http://struct.cc
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
{% import "partials/language.html" as lang with context %}
|
{% import "partials/language.html" as lang with context %}
|
||||||
|
|
||||||
<!-- Theme options -->
|
<!-- Theme options -->
|
||||||
|
{% set feature = config.theme.feature %}
|
||||||
{% set palette = config.theme.palette %}
|
{% set palette = config.theme.palette %}
|
||||||
{% set font = config.theme.font %}
|
{% set font = config.theme.font %}
|
||||||
|
|
||||||
@ -200,7 +201,6 @@
|
|||||||
|
|
||||||
<!-- Container, necessary for web-application context -->
|
<!-- Container, necessary for web-application context -->
|
||||||
<div class="md-container">
|
<div class="md-container">
|
||||||
{% set feature = config.extra.get("feature", {}) %}
|
|
||||||
|
|
||||||
<!-- Tabs with outline -->
|
<!-- Tabs with outline -->
|
||||||
{% if feature.tabs %}
|
{% if feature.tabs %}
|
||||||
|
@ -21,6 +21,14 @@
|
|||||||
# Language for theme localization
|
# Language for theme localization
|
||||||
language: en
|
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
|
# 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
|
# documentation - possible values can be looked up in the getting started guide
|
||||||
palette:
|
palette:
|
||||||
|
@ -20,19 +20,10 @@
|
|||||||
IN THE SOFTWARE.
|
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 translations for given language -->
|
||||||
{% import "partials/language/" + (languages | first) + ".html" as lang %}
|
{% import "partials/language/" + config.theme.language + ".html" as lang %}
|
||||||
|
|
||||||
<!-- Re-export translations -->
|
<!-- Re-export translations -->
|
||||||
{% macro t(key) %}{{ {
|
{% macro t(key) %}{{ {
|
||||||
"search.languages": languages | join(", ")
|
"search.languages": (config.extra.search | default({})).language | default("")
|
||||||
}[key] or lang.t(key) }}{% endmacro %}
|
}[key] or lang.t(key) }}{% endmacro %}
|
||||||
|
Loading…
Reference in New Issue
Block a user