1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-30 18:24:35 +01:00

Refactored tag modifier implementation

This commit is contained in:
squidfunk 2023-02-26 15:28:47 +01:00
parent 0f74615dc9
commit 4d7291f25e
10 changed files with 12 additions and 12 deletions

View File

@ -240,7 +240,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.2a6f1dda.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.3e1761d0.min.js' | url }}"></script>
{% for path in config.extra_javascript %} {% for path in config.extra_javascript %}
<script src="{{ path | url }}"></script> <script src="{{ path | url }}"></script>
{% endfor %} {% endfor %}

View File

@ -23,7 +23,7 @@
{% set modifier = "--" ~ type %} {% set modifier = "--" ~ type %}
{% endif %} {% endif %}
{% set _ = style.append( {% set _ = style.append(
".md-tag-icon" ~ modifier ~ "{" ~ ".md-tag" ~ modifier ~ "{" ~
"--md-tag-icon:" ~ "--md-tag-icon:" ~
"url('data:image/svg+xml;charset=utf-8," ~ "url('data:image/svg+xml;charset=utf-8," ~
icon | replace("\n", "") ~ icon | replace("\n", "") ~

View File

@ -10,7 +10,7 @@
{% if config.extra.tags %} {% if config.extra.tags %}
{% set icon = " md-tag-icon" %} {% set icon = " md-tag-icon" %}
{% if tag.type %} {% if tag.type %}
{% set icon = icon ~ " md-tag-icon--" ~ tag.type %} {% set icon = icon ~ " md-tag--" ~ tag.type %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if tag.url %} {% if tag.url %}

View File

@ -116,7 +116,7 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]):
classes.append("md-tag-icon") classes.append("md-tag-icon")
type = self.tags_map.get(tag) type = self.tags_map.get(tag)
if type: if type:
classes.append(f"md-tag-icon--{type}") classes.append(f"md-tag--{type}")
# Render section for tag and a link to each page # Render section for tag and a link to each page
classes = " ".join(classes) classes = " ".join(classes)

View File

@ -90,7 +90,7 @@ function renderSearchDocument(
{document.tags && document.tags.map(tag => { {document.tags && document.tags.map(tag => {
const type = tags const type = tags
? tag in tags ? tag in tags
? `md-tag-icon md-tag-icon--${tags[tag]}` ? `md-tag-icon md-tag--${tags[tag]}`
: "md-tag-icon" : "md-tag-icon"
: "" : ""
return ( return (

View File

@ -45,7 +45,7 @@
{% set modifier = "--" ~ type %} {% set modifier = "--" ~ type %}
{% endif %} {% endif %}
{% set _ = style.append( {% set _ = style.append(
".md-tag-icon" ~ modifier ~ "{" ~ ".md-tag" ~ modifier ~ "{" ~
"--md-tag-icon:" ~ "--md-tag-icon:" ~
"url('data:image/svg+xml;charset=utf-8," ~ "url('data:image/svg+xml;charset=utf-8," ~
icon | replace("\n", "") ~ icon | replace("\n", "") ~

View File

@ -32,7 +32,7 @@
{% if config.extra.tags %} {% if config.extra.tags %}
{% set icon = " md-tag-icon" %} {% set icon = " md-tag-icon" %}
{% if tag.type %} {% if tag.type %}
{% set icon = icon ~ " md-tag-icon--" ~ tag.type %} {% set icon = icon ~ " md-tag--" ~ tag.type %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@ -116,7 +116,7 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]):
classes.append("md-tag-icon") classes.append("md-tag-icon")
type = self.tags_map.get(tag) type = self.tags_map.get(tag)
if type: if type:
classes.append(f"md-tag-icon--{type}") classes.append(f"md-tag--{type}")
# Render section for tag and a link to each page # Render section for tag and a link to each page
classes = " ".join(classes) classes = " ".join(classes)