diff --git a/material/templates/base.html b/material/templates/base.html
index d3e958b00..7737b5d0d 100644
--- a/material/templates/base.html
+++ b/material/templates/base.html
@@ -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) %}
- {{- 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 -}}
{% endblock %}
{% block scripts %}
diff --git a/material/templates/partials/consent.html b/material/templates/partials/consent.html
index 4ac5cb775..45bd22c6a 100644
--- a/material/templates/partials/consent.html
+++ b/material/templates/partials/consent.html
@@ -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 %}
+
+
+
+{% endmacro %}
{% set actions = config.extra.consent.actions %}
{% if not actions %}
{% set actions = ["accept", "manage"] %}
@@ -24,24 +32,21 @@
- {% 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 %}
-
-
-
{% endfor %}
diff --git a/material/templates/partials/feedback.html b/material/templates/partials/feedback.html
index 2cde98c75..b7c4b9d86 100644
--- a/material/templates/partials/feedback.html
+++ b/material/templates/partials/feedback.html
@@ -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 }}
{% endfor %}
diff --git a/material/templates/partials/icons.html b/material/templates/partials/icons.html
index 37da7364f..7d3aaded0 100644
--- a/material/templates/partials/icons.html
+++ b/material/templates/partials/icons.html
@@ -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 %}
diff --git a/material/templates/partials/nav-item.html b/material/templates/partials/nav-item.html
index a0bcdcfb9..d7050dd7f 100644
--- a/material/templates/partials/nav-item.html
+++ b/material/templates/partials/nav-item.html
@@ -10,7 +10,8 @@
{% 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 %}
- {% if not indexes %}
+ {% if not index %}
{% set tabindex = "0" if not is_section %}
{% else %}
- {% set index = indexes | first %}
{% set class = "md-nav__link--active" if index == page %}