shortcodes: replace markdownify by .RenderString #555

This commit is contained in:
Sören Weber 2023-06-03 13:14:15 +02:00
parent 7552bcc936
commit 61f05936b1
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
9 changed files with 17 additions and 16 deletions

View file

@ -59,11 +59,11 @@ echo "Hello World!"
"content" (slice "content" (slice
(dict (dict
"name" "python" "name" "python"
"content" ("```python\nprint(\"Hello World!\")\n```" | markdownify) "content" ("```python\nprint(\"Hello World!\")\n```" | .RenderString)
) )
(dict (dict
"name" "bash" "name" "bash"
"content" ("```bash\necho \"Hello World!\"\n```" | markdownify) "content" ("```bash\necho \"Hello World!\"\n```" | .RenderString)
) )
) )
)}} )}}

View file

@ -1,3 +1,4 @@
{{- $page := .page }}
{{- $title := T "Search" }} {{- $title := T "Search" }}
<article class="default"> <article class="default">
<header class="headline"> <header class="headline">
@ -9,7 +10,7 @@
<label class="a11y-only" for="search-by-detail">{{ T "Search" }}</label> <label class="a11y-only" for="search-by-detail">{{ T "Search" }}</label>
<input data-search-input id="search-by-detail" class="search-by" name="search-by" type="search" placeholder="{{ T "Search-placeholder" }}"> <input data-search-input id="search-by-detail" class="search-by" name="search-by" type="search" placeholder="{{ T "Search-placeholder" }}">
{{- partial "shortcodes/button.html" (dict {{- partial "shortcodes/button.html" (dict
"context" . "context" $page
"type" "submit" "type" "submit"
"style" "secondary" "style" "secondary"
"icon" "search" "icon" "search"

View file

@ -3,4 +3,4 @@
{{- partial "heading-pre.html" . }}<h1 id="{{ $title | anchorize }}">{{ $title }}</h1>{{ partial "heading-post.html" . }} {{- partial "heading-pre.html" . }}<h1 id="{{ $title | anchorize }}">{{ $title }}</h1>{{ partial "heading-post.html" . }}
{{- end }} {{- end }}
{{- partial "initial.md" . | markdownify }} {{- partial "initial.md" . | .RenderString }}

View file

@ -30,7 +30,7 @@
{{- $urlPrefix := strings.TrimRight "/" $context.RelPermalink }} {{- $urlPrefix := strings.TrimRight "/" $context.RelPermalink }}
{{- with $context }} {{- with $context }}
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}> <div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | markdownify }}</div> <div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
<ul class="box-content attachments-files"> <ul class="box-content attachments-files">
{{- $version := split hugo.Version "." }} {{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }} {{- $major := int (index $version 0) }}

View file

@ -16,5 +16,5 @@
{{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }} {{- end }}
{{- with $context -}} {{- with $context -}}
<span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | markdownify }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content | markdownify }}</span></span> <span class="badge cstyle {{ $style }}{{ if or $icon $title }} badge-with-title{{ end }}">{{ if or $icon $title }}<span class="badge-title">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | .RenderString }}{{ end }}</span>{{ end }}<span class="badge-content"{{ if $color }} style="background-color: {{ $color }};"{{ end }}>{{ $content | .RenderString }}</span></span>
{{- end }} {{- end }}

View file

@ -45,7 +45,7 @@
{{- if and $icon (eq $iconposition "left") }} {{- if and $icon (eq $iconposition "left") }}
<i class="{{ $icon }}"></i> <i class="{{ $icon }}"></i>
{{- end }} {{- end }}
{{ $title | markdownify }} {{ $title | .RenderString }}
{{- if and $icon (eq $iconposition "right") }} {{- if and $icon (eq $iconposition "right") }}
<i class="{{ $icon }}"></i> <i class="{{ $icon }}"></i>
{{- end }} {{- end }}

View file

@ -13,7 +13,7 @@
<label class="expand-label" for="expand-{{ $id }}" > <label class="expand-label" for="expand-{{ $id }}" >
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
<i class="fas fa-chevron-right"></i> <i class="fas fa-chevron-right"></i>
{{ $title | markdownify }} {{ $title | .RenderString }}
</label> </label>
<div id="expandcontent-{{ $id }}" class="expand-content"> <div id="expandcontent-{{ $id }}" class="expand-content">
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> {{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->

View file

@ -17,7 +17,7 @@
{{- end }} {{- end }}
{{- with $context }} {{- with $context }}
<div class="box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}> <div class="box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | markdownify }}</div> <div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
<div class="box-content"> <div class="box-content">
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> {{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->
</div> </div>

View file

@ -6,17 +6,17 @@
<div class="tab-nav"> <div class="tab-nav">
{{- range $idx, $tab := $tabs }} {{- range $idx, $tab := $tabs }}
<button <button
data-tab-item="{{ .name | markdownify | plainify }}" data-tab-item="{{ .name | $context.RenderString | plainify }}"
class="tab-nav-button{{ cond (eq $idx 0) " active" ""}}" class="tab-nav-button{{ cond (eq $idx 0) " active" ""}}"
onclick="switchTab('{{ $groupid }}','{{ .name | markdownify | plainify}}')" onclick="switchTab('{{ $groupid }}','{{ .name | $context.RenderString | plainify}}')"
> >
<span>{{ .name | markdownify }}</span></button> <span>{{ .name | $context.RenderString }}</span></button>
{{- end }} {{- end }}
</div> </div>
<div class="tab-content"> <div class="tab-content">
{{- range $idx, $tab := $tabs }} {{- range $idx, $tab := $tabs }}
<div <div
data-tab-item="{{ .name | markdownify | plainify }}" data-tab-item="{{ .name | $context.RenderString | plainify }}"
class="tab-content-text{{ cond (eq $idx 0) " active" ""}}" class="tab-content-text{{ cond (eq $idx 0) " active" ""}}"
> >
{{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> {{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->