{{- /* trim the newline */ -}} {{- $content := trim (partial "function/dos2unix.html" .Inner) "\n" -}} {{- $classList := slice -}} {{- with .Get "class" -}} {{- $classList = $classList | append . -}} {{- end -}} {{- $tag := .Get "tag" | default "div" -}} {{- $loop := cond (ne (.Get "group") "") false (.Get "loop") -}} {{- if .Get "code" -}} {{- /* highlight code content without line number */ -}} {{- $content = highlight $content (.Get "code") "lineNos=false, noClasses=false" -}} {{- /* delete outer label */ -}} {{- $content = replaceRE `.*]*>(?s)(.*).*` "$1" $content -}} {{- if .Get "code-link" -}} {{- /* parsing code links */ -}} {{- $content = replaceRE `(]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)()` "$1$2$6$3$1$5$6" $content -}} {{- end -}} {{- $classList = $classList | append "highlight" -}} {{- else -}} {{- $content = $content | .Page.RenderString -}} {{- end -}} {{- $wrapperAttrs := `class="typeit"` -}} {{- with (.Get "group" | string) -}} {{- $wrapperAttrs = printf `%v data-group="%v"` $wrapperAttrs . -}} {{- end -}} {{- with .Get "speed" -}} {{- $wrapperAttrs = printf `%v data-speed="%v"` $wrapperAttrs . -}} {{- end -}} {{- with .Get "cursorSpeed" -}} {{- $wrapperAttrs = printf `%v data-cursor-speed="%v"` $wrapperAttrs . -}} {{- end -}} {{- with .Get "cursorChar" -}} {{- $wrapperAttrs = printf `%v data-cursor-char="%v"` $wrapperAttrs . -}} {{- end -}} {{- with .Get "duration" -}} {{- $wrapperAttrs = printf `%v data-duration="%v"` $wrapperAttrs . -}} {{- end -}} {{- with $loop -}} {{- $wrapperAttrs = printf `%v data-loop="true"` $wrapperAttrs -}} {{- end -}} {{- $innerAttrs := "" -}} {{- with $classList -}} {{- $innerAttrs = printf `class="%v"` (delimit $classList " ") -}} {{- end -}}
{{- printf `<%v %v>` $tag $innerAttrs $tag | safeHTML -}}
{{- .Page.Store.Set "hasTyped" true -}}