mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Restructured partials
This commit is contained in:
parent
f850641437
commit
364309d47a
@ -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
|
||||
|
@ -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) %}{{ {
|
||||
|
@ -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 %}
|
||||
|
@ -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">
|
@ -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>
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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>
|
@ -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" %}
|
||||
|
@ -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 %}
|
||||
|
||||
|
@ -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" />
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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">
|
||||
|
@ -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>
|
@ -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" %}
|
||||
|
Loading…
Reference in New Issue
Block a user