diff --git a/material/base.html b/material/base.html index 2ff11418823171c91ebfcd7f6c13098d5987fac9..338b3ced9a7605b669fcfb5e8835f2ccda21068c 100644 --- a/material/base.html +++ b/material/base.html @@ -1,5 +1,6 @@ {% import "partials/language.html" as lang with context %} {% set palette = config.theme.palette %} +{% set font = config.theme.font %} <!DOCTYPE html> <html lang="{{ lang.t('language') }}" class="no-js"> <head> @@ -57,13 +58,12 @@ {% endif %} {% endblock %} {% block fonts %} - {% if config.extra.font != false and 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> + {% if font != false %} + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{ + font.text | replace(' ', '+') + ':300,400,400i,700|' + + font.code | replace(' ', '+') + }}"> + <style>body,input{font-family:"{{ font.text }}","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"{{ font.code }}","Courier New",Courier,monospace}</style> {% endif %} <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> {% endblock %} diff --git a/material/mkdocs_theme.yml b/material/mkdocs_theme.yml index 6e0358f80a35f560fdac8d6b4a80b0b5e2999e86..d0d3ff22685d77c9905f8acb6218098335de1957 100644 --- a/material/mkdocs_theme.yml +++ b/material/mkdocs_theme.yml @@ -14,6 +14,8 @@ # 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. +# Language for theme localization +language: en # 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: @@ -21,6 +23,13 @@ palette: primary: # Accent color for highlighting user interaction, default: indigo accent: +# Fonts used by Material, automatically loaded from Google Fonts - see the site +# for a list of available fonts +font: + # Default font for text + text: Roboto + # Fixed-width font for code listings + code: Roboto Mono # Material includes the search in the header as a partial, not as a separate # template, so it's correct that search.html is missing include_search_page: false diff --git a/material/partials/language.html b/material/partials/language.html index a7de8a2910d3f9bdf99f6579059b40698d79d329..523d10a1d5bdeeaef5d228e2ec21b3d2ccee05ec 100644 --- a/material/partials/language.html +++ b/material/partials/language.html @@ -1,6 +1,6 @@ {% set languages = "en" %} -{% if config and config.extra %} - {% set languages = config.extra.language | default("en") %} +{% if config and config.theme %} + {% set languages = config.theme.language | default("en") %} {% endif %} {% if languages is string %} {% set languages = languages.split(",") | map("trim") %} diff --git a/material/partials/language/kr.html b/material/partials/language/kr.html new file mode 100644 index 0000000000000000000000000000000000000000..27163eb0bd44649f0287b22e85df9a8320e03905 --- /dev/null +++ b/material/partials/language/kr.html @@ -0,0 +1,18 @@ +{% macro t(key) %}{{ { + "language": "kr", + "clipboard.copy": "클립보드로 복사", + "clipboard.copied": "클립보드에 복사됨", + "edit.link.title": "이 페이지를 편집", + "footer.previous": "이전", + "footer.next": "다음", + "meta.comments": "댓글", + "meta.source": "출처", + "search.placeholder": "검색", + "search.result.placeholder": "검색어를 입력하세요", + "search.result.none": "검색어와 일치하는 문서가 없습니다", + "search.result.one": "1개의 일치하는 문서", + "search.result.other": "#개의 일치하는 문서", + "search.tokenizer": "[\s\-]+", + "source.link.title": "저장소로 이동", + "toc.title": "목차" +}[key] }}{% endmacro %} diff --git a/mkdocs.yml b/mkdocs.yml index db061b2f27e289d81a1edddf5b94af7150a6423f..037444a2976f7850f2e6cf71638010e5e340a2ce 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -37,6 +37,10 @@ theme: custom_dir: material # Same values as in mkdocs_theme.yml + language: kr + font: + text: Roboto + code: Roboto Mono palette: primary: accent: blue @@ -49,9 +53,6 @@ extra: language: en feature: tabs: false - palette: - primary: indigo - accent: indigo social: - type: globe link: http://struct.cc diff --git a/src/base.html b/src/base.html index 0301cadc12b02e2c188df4e4b0df85b352a2fd67..2d1b8f461ec87e224f2e05f8f144a8a066bc10af 100644 --- a/src/base.html +++ b/src/base.html @@ -24,6 +24,7 @@ <!-- Theme options --> {% set palette = config.theme.palette %} +{% set font = config.theme.font %} <!DOCTYPE html> <html lang="{{ lang.t('language') }}" class="no-js"> @@ -116,21 +117,19 @@ <!-- Webfonts --> {% block fonts %} - <!-- TODO: remove the second check in the next major version --> - {% if config.extra.font != false and 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(" ", "+") %} + {% if font != false %} <link rel="stylesheet" type="text/css" - href="https://fonts.googleapis.com/css?family={{ font }}" /> + href="https://fonts.googleapis.com/css?family={{ + font.text | replace(' ', '+') + ':300,400,400i,700|' + + font.code | replace(' ', '+') + }}" /> <style> body, input { - font-family: "{{ text }}", "Helvetica Neue", + font-family: "{{ font.text }}", "Helvetica Neue", Helvetica, Arial, sans-serif; } pre, code, kbd { - font-family: "{{ code }}", "Courier New", + font-family: "{{ font.code }}", "Courier New", Courier, monospace; } </style> diff --git a/src/mkdocs_theme.yml b/src/mkdocs_theme.yml index 099ddd2b7e96284d710970f32d522b68a78f9985..fa74252d455286bce7853c84c20808fd037f9ca3 100644 --- a/src/mkdocs_theme.yml +++ b/src/mkdocs_theme.yml @@ -18,6 +18,9 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +# Language for theme localization +language: en + # 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: @@ -28,6 +31,16 @@ palette: # Accent color for highlighting user interaction, default: indigo accent: +# Fonts used by Material, automatically loaded from Google Fonts - see the site +# for a list of available fonts +font: + + # Default font for text + text: Roboto + + # Fixed-width font for code listings + code: Roboto Mono + # Material includes the search in the header as a partial, not as a separate # template, so it's correct that search.html is missing include_search_page: false diff --git a/src/partials/language.html b/src/partials/language.html index 36deee12f48a9dbe84b10d2e732c607ea9dae3e9..4e0007b48f18a97763b23d20d4d0dc1e2c788bd4 100644 --- a/src/partials/language.html +++ b/src/partials/language.html @@ -22,8 +22,8 @@ <!-- Normalize language configuration --> {% set languages = "en" %} -{% if config and config.extra %} - {% set languages = config.extra.language | default("en") %} +{% if config and config.theme %} + {% set languages = config.theme.language | default("en") %} {% endif %} {% if languages is string %} {% set languages = languages.split(",") | map("trim") %} diff --git a/src/partials/language/kr.html b/src/partials/language/kr.html new file mode 100644 index 0000000000000000000000000000000000000000..b449cd5fea155ffc55cbed199cd691a9bb1881e7 --- /dev/null +++ b/src/partials/language/kr.html @@ -0,0 +1,41 @@ +<!-- + 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: Korean --> +{% macro t(key) %}{{ { + "language": "kr", + "clipboard.copy": "클립보드로 복사", + "clipboard.copied": "클립보드에 복사됨", + "edit.link.title": "이 페이지를 편집", + "footer.previous": "이전", + "footer.next": "다음", + "meta.comments": "댓글", + "meta.source": "출처", + "search.placeholder": "검색", + "search.result.placeholder": "검색어를 입력하세요", + "search.result.none": "검색어와 일치하는 문서가 없습니다", + "search.result.one": "1개의 일치하는 문서", + "search.result.other": "#개의 일치하는 문서", + "search.tokenizer": "[\s\-]+", + "source.link.title": "저장소로 이동", + "toc.title": "목차" +}[key] }}{% endmacro %}