1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-24 07:30:12 +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>
{% endblock %}
{% 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 %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

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

View File

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

View File

@ -116,7 +116,7 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]):
classes.append("md-tag-icon")
type = self.tags_map.get(tag)
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
classes = " ".join(classes)

View File

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

View File

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

View File

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

View File

@ -116,7 +116,7 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]):
classes.append("md-tag-icon")
type = self.tags_map.get(tag)
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
classes = " ".join(classes)