chore: refactor some code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{{- $content := .Inner | transform.Unmarshal | jsonify -}}
|
||||
{{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}}
|
||||
{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
|
||||
<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
{{- end -}}
|
||||
{{- $darkStyle = $darkStyle | default $lightStyle -}}
|
||||
{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}}
|
||||
{{- $id := dict "content" $options "scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "Content" $options "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "mapbox" true -}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{{- $id := dict "content" (trim .Inner "\n") "scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "Content" (trim .Inner "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
<div class="mermaid" id="{{ $id }}"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $content := .Inner | .Page.RenderString -}}
|
||||
{{- $id := dict "scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $tag := .Get 1 | default "div" -}}
|
||||
{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* trim the newline */ -}}
|
||||
{{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $key := .Get "group" | string | default $id -}}
|
||||
{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}}
|
||||
{{- $group := index $typeitMap $key -}}
|
||||
|
||||
Reference in New Issue
Block a user