diff --git a/docs/content/shortcodes/tree.en.md b/docs/content/shortcodes/tree.en.md index 556c64d49c..3e8dac388a 100644 --- a/docs/content/shortcodes/tree.en.md +++ b/docs/content/shortcodes/tree.en.md @@ -79,9 +79,9 @@ The **NAME** can be followed by optional double colons (`::`) to define an **ICO - by brand color: `primary`, `secondary`, `accent` - by color: `blue`, `cyan`, `green`, `grey`, `magenta`, `orange`, `red` - by special color: `default`, `transparent`, `code` - - you can also [define your own styles](#defining-own-styles). + - you can also [define your own styles](shortcodes/notice#defining-own-styles). - If a **style** and a named HTML color have the same name, the HTML color will be used. + If a **style** and a named HTML color have the same name, the **style** color will be used. ## Examples @@ -106,7 +106,7 @@ Every possible combination - and now with color::fa-fw fab fa-php - script.php::fa-fw fab fa-markdown::purple - alt script.php::fa-fw fab fa-markdown::#888cc4 - - magic.php::fa-fw fab fa-markdown::magic + - magic.php::fa-fw fab fa-markdown::orange ``` ```` @@ -126,5 +126,5 @@ Every possible combination - and now with color::fa-fw fab fa-php - script.php::fa-fw fab fa-php::purple - alt script.php::fa-fw fab fa-php::#888cc4 - - magic.php::fa-fw fab fa-php::magic + - magic.php::fa-fw fab fa-php::orange ```` diff --git a/layouts/partials/shortcodes/tree.html b/layouts/partials/shortcodes/tree.html index 66fa326538..7570747d71 100644 --- a/layouts/partials/shortcodes/tree.html +++ b/layouts/partials/shortcodes/tree.html @@ -1,7 +1,31 @@ {{ $content := .content | .page.RenderString }} <div class="list-tree"> -{{- $content = (replaceRE `<li>([^<>:]+)::([\w-]+)::([^<>\n\r\t ]+)` `<li><i class="fa-fw fas fa-$2 cstyle $3" style="color: $3;"></i><span>$1</span>` $content) }} -{{- $content = (replaceRE `<li>([^<>:]+)::([^<>:]+)::([^<>\n\r\t ]+)` `<li><i class="$2 cstyle $3" style="color: $3;"></i><span>$1</span>` $content) }} +{{- $matches := findRESubmatch `<li>([^<>:]+)::([\w-]+)::([^<>\n\r\t ]+)` $content }} +{{- range $matches }} + {{- $name := index . 1 }} + {{- $icon := index . 2 }} + {{- $color := index . 3 }} + {{- $replacement := "" }} + {{- if (where site.Params.boxStyle "identifier" $color | first 1) }} + {{- $replacement = printf `<li><i class="fa-fw fas fa-%s cstyle %s"></i><span>%s</span>` $icon $color $name }} + {{- else }} + {{- $replacement = printf `<li><i class="fa-fw fas fa-%s" style="color: %s;"></i><span>%s</span>` $icon $color $name }} + {{- end }} + {{- $content = replace $content (index . 0) $replacement }} +{{- end }} +{{- $matches := findRESubmatch `<li>([^<>:]+)::([^<>:]+)::([^<>\n\r\t ]+)` $content }} +{{- range $matches }} + {{- $name := index . 1 }} + {{- $icon := index . 2 }} + {{- $color := index . 3 }} + {{- $replacement := "" }} + {{- if (where site.Params.boxStyle "identifier" $color | first 1) }} + {{- $replacement = printf `<li><i class="%s cstyle %s"></i><span>%s</span>` $icon $color $name }} + {{- else }} + {{- $replacement = printf `<li><i class="%s" style="color: %s;"></i><span>%s</span>` $icon $color $name }} + {{- end }} + {{- $content = replace $content (index . 0) $replacement }} +{{- end }} {{- $content = (replaceRE `<li>([^<>:]+)::([\w-]+)([\n\r\t ]*<)` `<li><i class="fa-fw fas fa-$2"></i><span>$1</span>$3` $content) }} {{- $content = (replaceRE `<li>([^<>:]+)::([^<>\n\r\t]+)` `<li><i class="$2"></i><span>$1</span>` $content) }} {{- $content | safeHTML -}} diff --git a/layouts/partials/version.txt b/layouts/partials/version.txt index bd15d9fcb3..601cf8f3b1 100644 --- a/layouts/partials/version.txt +++ b/layouts/partials/version.txt @@ -1 +1 @@ -7.5.0+0d71747e13e0d9d91321f28327447ea0b4310bcc \ No newline at end of file +7.5.0+964ca24fd04abba3d8c22dd7bdc9de5a707e08fe \ No newline at end of file