mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Refactored tag modifier implementation
This commit is contained in:
parent
0f74615dc9
commit
4d7291f25e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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 %}
|
||||||
|
@ -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", "") ~
|
||||||
|
@ -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 %}
|
||||||
|
@ -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)
|
||||||
|
@ -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 (
|
||||||
|
@ -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", "") ~
|
||||||
|
@ -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 %}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user