mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-29 01:02:42 -04:00
Ensured compatibility with minijinja (Rust)
This commit is contained in:
@@ -58,8 +58,8 @@
|
||||
{% endblock %}
|
||||
{% block fonts %}
|
||||
{% if config.theme.font != false %}
|
||||
{% set text = config.theme.font.get("text", "Roboto") %}
|
||||
{% set code = config.theme.font.get("code", "Roboto Mono") %}
|
||||
{% set text = config.theme.font.text | d("Roboto", true) %}
|
||||
{% set code = config.theme.font.code | d("Roboto Mono", true) %}
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{
|
||||
text | replace(' ', '+') + ':300,300i,400,400i,700,700i%7C' +
|
||||
@@ -214,38 +214,34 @@
|
||||
{% include "partials/javascripts/consent.html" %}
|
||||
{% endif %}
|
||||
{% block config %}
|
||||
{%- set app = {
|
||||
"base": base_url,
|
||||
"features": features,
|
||||
"translations": {},
|
||||
"search": "assets/javascripts/workers/search.f8cc74c7.min.js" | url
|
||||
} -%}
|
||||
{% set _ = namespace() %}
|
||||
{% set _.tags = config.extra.tags %}
|
||||
{%- if config.extra.version -%}
|
||||
{%- set mike = config.plugins.get("mike") -%}
|
||||
{%- set mike = config.plugins.mike -%}
|
||||
{%- if not mike or mike.config.version_selector -%}
|
||||
{%- set _ = app.update({ "version": config.extra.version }) -%}
|
||||
{%- set _.version = config.extra.version -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- if config.extra.tags -%}
|
||||
{%- set _ = app.update({ "tags": config.extra.tags }) -%}
|
||||
{%- endif -%}
|
||||
{%- set translations = app.translations -%}
|
||||
{%- for key in [
|
||||
"clipboard.copy",
|
||||
"clipboard.copied",
|
||||
"search.result.placeholder",
|
||||
"search.result.none",
|
||||
"search.result.one",
|
||||
"search.result.other",
|
||||
"search.result.more.one",
|
||||
"search.result.more.other",
|
||||
"search.result.term.missing",
|
||||
"select.version"
|
||||
] -%}
|
||||
{%- set _ = translations.update({ key: lang.t(key) }) -%}
|
||||
{%- endfor -%}
|
||||
<script id="__config" type="application/json">
|
||||
{{- app | tojson -}}
|
||||
{{- {
|
||||
"base": base_url,
|
||||
"features": features,
|
||||
"translations": {
|
||||
"clipboard.copy": lang.t("clipboard.copy"),
|
||||
"clipboard.copied": lang.t("clipboard.copied"),
|
||||
"search.result.placeholder": lang.t("search.result.placeholder"),
|
||||
"search.result.none": lang.t("search.result.none"),
|
||||
"search.result.one": lang.t("search.result.one"),
|
||||
"search.result.other": lang.t("search.result.other"),
|
||||
"search.result.more.one": lang.t("search.result.more.one"),
|
||||
"search.result.more.other": lang.t("search.result.more.other"),
|
||||
"search.result.term.missing": lang.t("search.result.term.missing"),
|
||||
"select.version": lang.t("select.version")
|
||||
},
|
||||
"search": "assets/javascripts/workers/search.f8cc74c7.min.js" | url,
|
||||
"tags": _.tags or none,
|
||||
"version": _.version or none
|
||||
} | tojson -}}
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
{#-
|
||||
This file was automatically generated - do not edit
|
||||
-#}
|
||||
{% set cookies = config.extra.consent.cookies | d({}) %}
|
||||
{% if config.extra.analytics %}
|
||||
{% if "analytics" not in cookies %}
|
||||
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
|
||||
{% macro render_cookie(cookie, type) %}
|
||||
{% set checked = "" %}
|
||||
{% if cookie is string %}
|
||||
{% set name = cookie %}
|
||||
{% set checked = "checked" %}
|
||||
{% else %}
|
||||
{% set name = cookie.name %}
|
||||
{% if cookie.checked %}
|
||||
{% set checked = "checked" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.repo_url and "github.com" in config.repo_url %}
|
||||
{% if "github" not in cookies %}
|
||||
{% set _ = cookies.update({ "github": "GitHub" }) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li class="task-list-item">
|
||||
<label class="task-list-control">
|
||||
<input type="checkbox" name="{{ type }}" {{ checked }}>
|
||||
<span class="task-list-indicator"></span>
|
||||
{{ name }}
|
||||
</label>
|
||||
</li>
|
||||
{% endmacro %}
|
||||
{% set actions = config.extra.consent.actions %}
|
||||
{% if not actions %}
|
||||
{% set actions = ["accept", "manage"] %}
|
||||
@@ -24,24 +32,21 @@
|
||||
<input class="md-toggle" type="checkbox" id="__settings" {{ checked }}>
|
||||
<div class="md-consent__settings">
|
||||
<ul class="task-list">
|
||||
{% for type in cookies %}
|
||||
{% set checked = "" %}
|
||||
{% if cookies[type] is string %}
|
||||
{% set name = cookies[type] %}
|
||||
{% set checked = "checked" %}
|
||||
{% else %}
|
||||
{% set name = cookies[type].name %}
|
||||
{% if cookies[type].checked %}
|
||||
{% set checked = "checked" %}
|
||||
{% endif %}
|
||||
{% set cookies = config.extra.consent.cookies %}
|
||||
{% if "analytics" not in cookies %}
|
||||
{% if config.extra.analytics %}
|
||||
{{ render_cookie("Google Analytics", "analytics") }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if "github" not in cookies %}
|
||||
{% if config.repo_url and "github.com" in config.repo_url %}
|
||||
{{ render_cookie("GitHub", "github") }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% for type in cookies %}
|
||||
{% if cookies[type] %}
|
||||
{{ render_cookie(cookies[type], type) }}
|
||||
{% endif %}
|
||||
<li class="task-list-item">
|
||||
<label class="task-list-control">
|
||||
<input type="checkbox" name="{{ type }}" {{ checked }}>
|
||||
<span class="task-list-indicator"></span>
|
||||
{{ name }}
|
||||
</label>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,12 @@
|
||||
{% else %}
|
||||
{% set title = page.title | urlencode %}
|
||||
{% endif %}
|
||||
{{ rating.note.format(url = url, title = title) }}
|
||||
{% set note = rating.note %}
|
||||
{% if note %}
|
||||
{% set note = note | replace("{url}", url) %}
|
||||
{% set note = note | replace("{title}", title) %}
|
||||
{% endif %}
|
||||
{{ note }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -2,47 +2,47 @@
|
||||
This file was automatically generated - do not edit
|
||||
-#}
|
||||
{% if config.theme.icon.admonition %}
|
||||
{% set style = ["\x3cstyle\x3e:root{"] %}
|
||||
{% for type, icon in config.theme.icon.admonition.items() %}
|
||||
{% set _ = namespace(style = "\x3cstyle\x3e:root{") %}
|
||||
{% for type, icon in config.theme.icon.admonition | items %}
|
||||
{% import ".icons/" ~ icon ~ ".svg" as icon %}
|
||||
{% set _ = style.append(
|
||||
{% set _.style = _.style ~
|
||||
"--md-admonition-icon--" ~ type ~ ":" ~
|
||||
"url('data:image/svg+xml;charset=utf-8," ~
|
||||
icon | replace("\n", "") | urlencode ~
|
||||
"');"
|
||||
) %}
|
||||
%}
|
||||
{% endfor %}
|
||||
{% set _ = style.append("}\x3c/style\x3e") %}
|
||||
{{ style | join }}
|
||||
{% set _.style = _.style ~ "}\x3c/style\x3e" %}
|
||||
{{ _.style }}
|
||||
{% endif %}
|
||||
{% if config.theme.icon.annotation %}
|
||||
{% set style = ["\x3cstyle\x3e:root{"] %}
|
||||
{% set _ = namespace(style = "\x3cstyle\x3e:root{") %}
|
||||
{% import ".icons/" ~ config.theme.icon.annotation ~ ".svg" as icon %}
|
||||
{% set _ = style.append(
|
||||
{% set _.style = _.style ~
|
||||
"--md-annotation-icon:" ~
|
||||
"url('data:image/svg+xml;charset=utf-8," ~
|
||||
icon | replace("\n", "") | urlencode ~
|
||||
"');"
|
||||
) %}
|
||||
{% set _ = style.append("}\x3c/style\x3e") %}
|
||||
{{ style | join }}
|
||||
%}
|
||||
{% set _.style = _.style ~ "}\x3c/style\x3e" %}
|
||||
{{ _.style }}
|
||||
{% endif %}
|
||||
{% if config.theme.icon.tag %}
|
||||
{% set style = ["\x3cstyle\x3e"] %}
|
||||
{% for type, icon in config.theme.icon.tag.items() %}
|
||||
{% set _ = namespace(style = "\x3cstyle\x3e:root{") %}
|
||||
{% for type, icon in config.theme.icon.tag | items %}
|
||||
{% import ".icons/" ~ icon ~ ".svg" as icon %}
|
||||
{% if type != "default" %}
|
||||
{% set modifier = ".md-tag--" ~ type %}
|
||||
{% endif %}
|
||||
{% set _ = style.append(
|
||||
{% set _.style = _.style ~
|
||||
".md-tag" ~ modifier ~ "{" ~
|
||||
"--md-tag-icon:" ~
|
||||
"url('data:image/svg+xml;charset=utf-8," ~
|
||||
icon | replace("\n", "") | urlencode ~
|
||||
"');" ~
|
||||
"}"
|
||||
) %}
|
||||
%}
|
||||
{% endfor %}
|
||||
{% set _ = style.append("\x3c/style\x3e") %}
|
||||
{{ style | join }}
|
||||
{% set _.style = _.style ~ "}\x3c/style\x3e" %}
|
||||
{{ _.style }}
|
||||
{% endif %}
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
<span class="{{ class }}"></span>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{% macro render_content(nav_item, ref = nav_item) %}
|
||||
{% macro render_content(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
{% if nav_item.meta and nav_item.meta.icon %}
|
||||
{% include ".icons/" ~ nav_item.meta.icon ~ ".svg" %}
|
||||
{% endif %}
|
||||
@@ -25,7 +26,8 @@
|
||||
{{ render_status(nav_item, nav_item.meta.status) }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{% macro render_pruned(nav_item, ref = nav_item) %}
|
||||
{% macro render_pruned(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
{% set first = nav_item.children | first %}
|
||||
{% if first and first.children %}
|
||||
{{ render_pruned(first, ref) }}
|
||||
@@ -49,14 +51,15 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if nav_item.children %}
|
||||
{% set indexes = [] %}
|
||||
{% set _ = namespace(index = none) %}
|
||||
{% if "navigation.indexes" in features %}
|
||||
{% for nav_item in nav_item.children %}
|
||||
{% if nav_item.is_index and not index is defined %}
|
||||
{% set _ = indexes.append(nav_item) %}
|
||||
{% for item in nav_item.children %}
|
||||
{% if item.is_index and _.index is none %}
|
||||
{% set _.index = item %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% set index = _.index %}
|
||||
{% if "navigation.tabs" in features %}
|
||||
{% if level == 1 and nav_item.active %}
|
||||
{% set class = class ~ " md-nav__item--section" %}
|
||||
@@ -87,14 +90,13 @@
|
||||
{% set indeterminate = "md-toggle--indeterminate" %}
|
||||
{% endif %}
|
||||
<input class="md-nav__toggle md-toggle {{ indeterminate }}" type="checkbox" id="{{ path }}" {{ checked }}>
|
||||
{% if not indexes %}
|
||||
{% if not index %}
|
||||
{% set tabindex = "0" if not is_section %}
|
||||
<label class="md-nav__link" for="{{ path }}" id="{{ path }}_label" tabindex="{{ tabindex }}">
|
||||
{{ render_content(nav_item) }}
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
{% else %}
|
||||
{% set index = indexes | first %}
|
||||
{% set class = "md-nav__link--active" if index == page %}
|
||||
<div class="md-nav__link md-nav__container">
|
||||
<a href="{{ index.url | url }}" class="md-nav__link {{ class }}">
|
||||
@@ -115,7 +117,7 @@
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
{% for nav_item in nav_item.children %}
|
||||
{% if not indexes or nav_item != indexes | first %}
|
||||
{% if not index or nav_item != index %}
|
||||
{{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
{% endif %}
|
||||
{% set title = social.name %}
|
||||
{% if not title and "//" in social.link %}
|
||||
{% set _, url = social.link.split("//") %}
|
||||
{% set title = url.split("/")[0] %}
|
||||
{% set (_, url) = social.link.split("//") %}
|
||||
{% set title = url.split("/") | first %}
|
||||
{% endif %}
|
||||
<a href="{{ social.link }}" target="_blank" rel="{{ rel }}" title="{{ title | e }}" class="md-social__link">
|
||||
{% include ".icons/" ~ social.icon ~ ".svg" %}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</span>
|
||||
{% endmacro %}
|
||||
{% macro render_authors(authors) %}
|
||||
{% set git_authors = config.plugins.get("git-authors") %}
|
||||
{% set git_authors = config.plugins["git-authors"] %}
|
||||
<span class="md-source-file__fact">
|
||||
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
|
||||
{% if authors | length == 1 %}
|
||||
@@ -101,7 +101,7 @@
|
||||
{{ render_created(created) }}
|
||||
{% endif %}
|
||||
{% if git_info %}
|
||||
{{ render_authors(git_info.get("page_authors")) }}
|
||||
{{ render_authors(git_info["page_authors"]) }}
|
||||
{% endif %}
|
||||
{% if committers %}
|
||||
{{ render_committers(committers) }}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{#-
|
||||
This file was automatically generated - do not edit
|
||||
-#}
|
||||
{% macro render_content(nav_item, ref = nav_item) %}
|
||||
{% macro render_content(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
{% if nav_item == ref or "navigation.indexes" in features %}
|
||||
{% if nav_item.is_index and nav_item.meta.icon %}
|
||||
{% include ".icons/" ~ nav_item.meta.icon ~ ".svg" %}
|
||||
@@ -9,7 +10,8 @@
|
||||
{% endif %}
|
||||
{{ ref.title }}
|
||||
{% endmacro %}
|
||||
{% macro render(nav_item, ref = nav_item) %}
|
||||
{% macro render(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
{% set class = "md-tabs__item" %}
|
||||
{% if ref.active %}
|
||||
{% set class = class ~ " md-tabs__item--active" %}
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
|
||||
<!-- Load fonts from Google -->
|
||||
{% if config.theme.font != false %}
|
||||
{% set text = config.theme.font.get("text", "Roboto") %}
|
||||
{% set code = config.theme.font.get("code", "Roboto Mono") %}
|
||||
{% set text = config.theme.font.text | d("Roboto", true) %}
|
||||
{% set code = config.theme.font.code | d("Roboto Mono", true) %}
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
@@ -387,46 +387,40 @@
|
||||
|
||||
<!-- Theme-related configuration -->
|
||||
{% block config %}
|
||||
{%- set app = {
|
||||
"base": base_url,
|
||||
"features": features,
|
||||
"translations": {},
|
||||
"search": "assets/javascripts/workers/search.js" | url
|
||||
} -%}
|
||||
{% set _ = namespace() %}
|
||||
|
||||
<!-- Extra configuration -->
|
||||
{% set _.tags = config.extra.tags %}
|
||||
|
||||
<!-- Versioning -->
|
||||
{%- if config.extra.version -%}
|
||||
{%- set mike = config.plugins.get("mike") -%}
|
||||
{%- set mike = config.plugins.mike -%}
|
||||
{%- if not mike or mike.config.version_selector -%}
|
||||
{%- set _ = app.update({ "version": config.extra.version }) -%}
|
||||
{%- set _.version = config.extra.version -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
<!-- Tags -->
|
||||
{%- if config.extra.tags -%}
|
||||
{%- set _ = app.update({ "tags": config.extra.tags }) -%}
|
||||
{%- endif -%}
|
||||
|
||||
<!-- Translations -->
|
||||
{%- set translations = app.translations -%}
|
||||
{%- for key in [
|
||||
"clipboard.copy",
|
||||
"clipboard.copied",
|
||||
"search.result.placeholder",
|
||||
"search.result.none",
|
||||
"search.result.one",
|
||||
"search.result.other",
|
||||
"search.result.more.one",
|
||||
"search.result.more.other",
|
||||
"search.result.term.missing",
|
||||
"select.version"
|
||||
] -%}
|
||||
{%- set _ = translations.update({ key: lang.t(key) }) -%}
|
||||
{%- endfor -%}
|
||||
|
||||
<!-- Configuration -->
|
||||
<script id="__config" type="application/json">
|
||||
{{- app | tojson -}}
|
||||
{{- {
|
||||
"base": base_url,
|
||||
"features": features,
|
||||
"translations": {
|
||||
"clipboard.copy": lang.t("clipboard.copy"),
|
||||
"clipboard.copied": lang.t("clipboard.copied"),
|
||||
"search.result.placeholder": lang.t("search.result.placeholder"),
|
||||
"search.result.none": lang.t("search.result.none"),
|
||||
"search.result.one": lang.t("search.result.one"),
|
||||
"search.result.other": lang.t("search.result.other"),
|
||||
"search.result.more.one": lang.t("search.result.more.one"),
|
||||
"search.result.more.other": lang.t("search.result.more.other"),
|
||||
"search.result.term.missing": lang.t("search.result.term.missing"),
|
||||
"select.version": lang.t("select.version")
|
||||
},
|
||||
"search": "assets/javascripts/workers/search.js" | url,
|
||||
"tags": _.tags or none,
|
||||
"version": _.version or none
|
||||
} | tojson -}}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -20,18 +20,32 @@
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<!-- Determine cookies -->
|
||||
{% set cookies = config.extra.consent.cookies | d({}) %}
|
||||
{% if config.extra.analytics %}
|
||||
{% if "analytics" not in cookies %}
|
||||
{% set _ = cookies.update({ "analytics": "Google Analytics" }) %}
|
||||
<!-- Render cookie checkbox -->
|
||||
{% macro render_cookie(cookie, type) %}
|
||||
{% set checked = "" %}
|
||||
|
||||
<!-- Cookie with defaults -->
|
||||
{% if cookie is string %}
|
||||
{% set name = cookie %}
|
||||
{% set checked = "checked" %}
|
||||
|
||||
<!-- Cookie with settings -->
|
||||
{% else %}
|
||||
{% set name = cookie.name %}
|
||||
{% if cookie.checked %}
|
||||
{% set checked = "checked" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.repo_url and "github.com" in config.repo_url %}
|
||||
{% if "github" not in cookies %}
|
||||
{% set _ = cookies.update({ "github": "GitHub" }) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li class="task-list-item">
|
||||
<label class="task-list-control">
|
||||
<input type="checkbox" name="{{ type }}" {{ checked }}>
|
||||
<span class="task-list-indicator"></span>
|
||||
{{ name }}
|
||||
</label>
|
||||
</li>
|
||||
{% endmacro %}
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
|
||||
<!-- Determine actions -->
|
||||
{% set actions = config.extra.consent.actions %}
|
||||
@@ -57,24 +71,27 @@
|
||||
/>
|
||||
<div class="md-consent__settings">
|
||||
<ul class="task-list">
|
||||
{% for type in cookies %}
|
||||
{% set checked = "" %}
|
||||
{% if cookies[type] is string %}
|
||||
{% set name = cookies[type] %}
|
||||
{% set checked = "checked" %}
|
||||
{% else %}
|
||||
{% set name = cookies[type].name %}
|
||||
{% if cookies[type].checked %}
|
||||
{% set checked = "checked" %}
|
||||
{% endif %}
|
||||
{% set cookies = config.extra.consent.cookies %}
|
||||
|
||||
<!-- Google Analytics cookie, it not set -->
|
||||
{% if "analytics" not in cookies %}
|
||||
{% if config.extra.analytics %}
|
||||
{{ render_cookie("Google Analytics", "analytics") }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- GitHub cookie, if not set -->
|
||||
{% if "github" not in cookies %}
|
||||
{% if config.repo_url and "github.com" in config.repo_url %}
|
||||
{{ render_cookie("GitHub", "github") }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Configured cookies-->
|
||||
{% for type in cookies %}
|
||||
{% if cookies[type] %}
|
||||
{{ render_cookie(cookies[type], type) }}
|
||||
{% endif %}
|
||||
<li class="task-list-item">
|
||||
<label class="task-list-control">
|
||||
<input type="checkbox" name="{{ type }}" {{ checked }}>
|
||||
<span class="task-list-indicator"></span>
|
||||
{{ name }}
|
||||
</label>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -69,7 +69,12 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Replace {url} and {title} placeholders in note -->
|
||||
{{ rating.note.format(url = url, title = title) }}
|
||||
{% set note = rating.note %}
|
||||
{% if note %}
|
||||
{% set note = note | replace("{url}", url) %}
|
||||
{% set note = note | replace("{title}", title) %}
|
||||
{% endif %}
|
||||
{{ note }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -22,51 +22,51 @@
|
||||
|
||||
<!-- Custom admonition icons -->
|
||||
{% if config.theme.icon.admonition %}
|
||||
{% set style = ["\x3cstyle\x3e:root{"] %}
|
||||
{% for type, icon in config.theme.icon.admonition.items() %}
|
||||
{% set _ = namespace(style = "\x3cstyle\x3e:root{") %}
|
||||
{% for type, icon in config.theme.icon.admonition | items %}
|
||||
{% import ".icons/" ~ icon ~ ".svg" as icon %}
|
||||
{% set _ = style.append(
|
||||
{% set _.style = _.style ~
|
||||
"--md-admonition-icon--" ~ type ~ ":" ~
|
||||
"url('data:image/svg+xml;charset=utf-8," ~
|
||||
icon | replace("\n", "") | urlencode ~
|
||||
"');"
|
||||
) %}
|
||||
%}
|
||||
{% endfor %}
|
||||
{% set _ = style.append("}\x3c/style\x3e") %}
|
||||
{{ style | join }}
|
||||
{% set _.style = _.style ~ "}\x3c/style\x3e" %}
|
||||
{{ _.style }}
|
||||
{% endif %}
|
||||
|
||||
<!-- Custom annotation icon -->
|
||||
{% if config.theme.icon.annotation %}
|
||||
{% set style = ["\x3cstyle\x3e:root{"] %}
|
||||
{% set _ = namespace(style = "\x3cstyle\x3e:root{") %}
|
||||
{% import ".icons/" ~ config.theme.icon.annotation ~ ".svg" as icon %}
|
||||
{% set _ = style.append(
|
||||
{% set _.style = _.style ~
|
||||
"--md-annotation-icon:" ~
|
||||
"url('data:image/svg+xml;charset=utf-8," ~
|
||||
icon | replace("\n", "") | urlencode ~
|
||||
"');"
|
||||
) %}
|
||||
{% set _ = style.append("}\x3c/style\x3e") %}
|
||||
{{ style | join }}
|
||||
%}
|
||||
{% set _.style = _.style ~ "}\x3c/style\x3e" %}
|
||||
{{ _.style }}
|
||||
{% endif %}
|
||||
|
||||
<!-- Custom tag icons -->
|
||||
{% if config.theme.icon.tag %}
|
||||
{% set style = ["\x3cstyle\x3e"] %}
|
||||
{% for type, icon in config.theme.icon.tag.items() %}
|
||||
{% set _ = namespace(style = "\x3cstyle\x3e:root{") %}
|
||||
{% for type, icon in config.theme.icon.tag | items %}
|
||||
{% import ".icons/" ~ icon ~ ".svg" as icon %}
|
||||
{% if type != "default" %}
|
||||
{% set modifier = ".md-tag--" ~ type %}
|
||||
{% endif %}
|
||||
{% set _ = style.append(
|
||||
{% set _.style = _.style ~
|
||||
".md-tag" ~ modifier ~ "{" ~
|
||||
"--md-tag-icon:" ~
|
||||
"url('data:image/svg+xml;charset=utf-8," ~
|
||||
icon | replace("\n", "") | urlencode ~
|
||||
"');" ~
|
||||
"}"
|
||||
) %}
|
||||
%}
|
||||
{% endfor %}
|
||||
{% set _ = style.append("\x3c/style\x3e") %}
|
||||
{{ style | join }}
|
||||
{% set _.style = _.style ~ "}\x3c/style\x3e" %}
|
||||
{{ _.style }}
|
||||
{% endif %}
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
{% endmacro %}
|
||||
|
||||
<!-- Render navigation link content -->
|
||||
{% macro render_content(nav_item, ref = nav_item) %}
|
||||
{% macro render_content(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
|
||||
<!-- Navigation link icon -->
|
||||
{% if nav_item.meta and nav_item.meta.icon %}
|
||||
@@ -64,7 +65,8 @@
|
||||
{% endmacro %}
|
||||
|
||||
<!-- Render navigation item (pruned) -->
|
||||
{% macro render_pruned(nav_item, ref = nav_item) %}
|
||||
{% macro render_pruned(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
{% set first = nav_item.children | first %}
|
||||
|
||||
<!-- Recurse, if the first item has further nested items -->
|
||||
@@ -104,14 +106,15 @@
|
||||
{% if nav_item.children %}
|
||||
|
||||
<!-- Determine all nested items that are index pages -->
|
||||
{% set indexes = [] %}
|
||||
{% set _ = namespace(index = none) %}
|
||||
{% if "navigation.indexes" in features %}
|
||||
{% for nav_item in nav_item.children %}
|
||||
{% if nav_item.is_index and not index is defined %}
|
||||
{% set _ = indexes.append(nav_item) %}
|
||||
{% for item in nav_item.children %}
|
||||
{% if item.is_index and _.index is none %}
|
||||
{% set _.index = item %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% set index = _.index %}
|
||||
|
||||
<!-- Navigation tabs -->
|
||||
{% if "navigation.tabs" in features %}
|
||||
@@ -171,7 +174,7 @@
|
||||
/>
|
||||
|
||||
<!-- Toggle to expand nested items -->
|
||||
{% if not indexes %}
|
||||
{% if not index %}
|
||||
{% set tabindex = "0" if not is_section %}
|
||||
<label
|
||||
class="md-nav__link"
|
||||
@@ -185,7 +188,6 @@
|
||||
|
||||
<!-- Toggle to expand nested items with link to index page -->
|
||||
{% else %}
|
||||
{% set index = indexes | first %}
|
||||
{% set class = "md-nav__link--active" if index == page %}
|
||||
<div class="md-nav__link md-nav__container">
|
||||
<a
|
||||
@@ -225,7 +227,7 @@
|
||||
|
||||
<!-- Nested navigation item -->
|
||||
{% for nav_item in nav_item.children %}
|
||||
{% if not indexes or nav_item != indexes | first %}
|
||||
{% if not index or nav_item != index %}
|
||||
{{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
<!-- Compute title and render link -->
|
||||
{% set title = social.name %}
|
||||
{% if not title and "//" in social.link %}
|
||||
{% set _, url = social.link.split("//") %}
|
||||
{% set title = url.split("/")[0] %}
|
||||
{% set (_, url) = social.link.split("//") %}
|
||||
{% set title = url.split("/") | first %}
|
||||
{% endif %}
|
||||
<a
|
||||
href="{{ social.link }}"
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<!-- Render authors -->
|
||||
{% macro render_authors(authors) %}
|
||||
{% set git_authors = config.plugins.get("git-authors") %}
|
||||
{% set git_authors = config.plugins["git-authors"] %}
|
||||
<span class="md-source-file__fact">
|
||||
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
|
||||
{% if authors | length == 1 %}
|
||||
@@ -161,7 +161,7 @@
|
||||
|
||||
<!-- Authors (git-authors plugin) -->
|
||||
{% if git_info %}
|
||||
{{ render_authors(git_info.get("page_authors")) }}
|
||||
{{ render_authors(git_info["page_authors"]) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- Authors (git-committers plugin) -->
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
-->
|
||||
|
||||
<!-- Render navigation link content -->
|
||||
{% macro render_content(nav_item, ref = nav_item) %}
|
||||
{% macro render_content(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
|
||||
<!-- Navigation link icon -->
|
||||
{% if nav_item == ref or "navigation.indexes" in features %}
|
||||
@@ -35,7 +36,8 @@
|
||||
{% endmacro %}
|
||||
|
||||
<!-- Render navigation item -->
|
||||
{% macro render(nav_item, ref = nav_item) %}
|
||||
{% macro render(nav_item, ref) %}
|
||||
{% set ref = ref or nav_item %}
|
||||
|
||||
<!-- Determine classes -->
|
||||
{% set class = "md-tabs__item" %}
|
||||
|
||||
Reference in New Issue
Block a user