Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
919b526f
Unverified
Commit
919b526f
authored
5 years ago
by
XhmikosR
Committed by
GitHub
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix shortcodes/example.html class bug. (#29344)
It always used the first placeholder's class before.
parent
b1f49092
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
site/layouts/shortcodes/example.html
+9
-8
site/layouts/shortcodes/example.html
with
9 additions
and
8 deletions
+9
-8
site/layouts/shortcodes/example.html
+
9
-
8
View file @
919b526f
...
...
@@ -23,20 +23,21 @@
{{- if (strings.Contains $input `
<svg
class=
"bd-placeholder-img`) -}}
{{- $.Scratch.Set "
highlight_content
"
""
-
}}
{{
-
$
image_class
:=
""
-
}}
{{
-
$
modified_content
:=
replace
$
input
`<
svg
class=
"bd-placeholder-img` `✂️<svg class="
bd-placeholder-img
`
-
}}
{{
-
$
modified_content =
replace
$
modified_content
"</
svg
>
\n" "
</svg>
✂️" -}}
{{- $modified_content = split $modified_content "✂️" -}}
{{- if (strings.Contains $input `
<svg
class=
"bd-placeholder-img `) -}}
{{- $image_class = replace $input "
bd-placeholder-img
"
"
bd-placeholder-img
✂️
"
-
}}
{{
-
$
image_class =
split
(
replace
$
image_class
`"
width=
"` `✂️"
width=
"`) "
✂️"
-
}}
{{
-
$
image_class =
replace
(
index
$
image_class
1)
"
bd-placeholder-img-lg
"
""
-
}}
{{
-
$
image_class =
trim
$
image_class
"
"
-
}}
{{
-
end
-
}}
{{- range $i, $content_chunk := $modified_content -}}
{{- $image_class := "" -}}
{{- if (strings.Contains $content_chunk `
<svg
class=
"bd-placeholder-img `) -}}
{{- $image_class = replace $content_chunk "
bd-placeholder-img
"
"
bd-placeholder-img
✂️
"
-
}}
{{
-
$
image_class =
split
(
replace
$
image_class
`"
width=
"` `✂️"
width=
"`) "
✂️"
-
}}
{{
-
$
image_class =
replace
(
index
$
image_class
1)
"
bd-placeholder-img-lg
"
""
-
}}
{{
-
$
image_class =
trim
$
image_class
"
"
-
}}
{{
-
end
-
}}
{{
-
if
(
strings.Contains
$
content_chunk
`<
svg
class=
"bd-placeholder-img`) -}}
{{- if $image_class -}}
{{- $.Scratch.Add "
highlight_content
"
(
printf
`<
img
src=
"..."
class=
"%s"
alt=
"..."
>
` $image_class) -}}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment