supleed2-old-landing-page/layouts/index.html

55 lines
3 KiB
HTML
Raw Permalink Normal View History

{{ define "main" }}
{{ $env := printf "<strong><span id='user'>%s@%s</span><span id='terminal'>:</span><span id='dir'>~/%s</span></strong><span id='terminal'>$</span>" .Site.Params.Terminal.userName .Site.Params.Terminal.pcName "" | safeHTML }}
{{ $envWithDir := printf "<strong><span id='user'>%s@%s</span><span id='terminal'>:</span><span id='dir'>~/%s</span></strong><span id='terminal'>$</span>" .Site.Params.Terminal.userName .Site.Params.Terminal.pcName .Site.Params.Terminal.workDir | safeHTML }}
{{ $cd := printf "<span id='terminal'>cd %s</span>" .Site.Params.Terminal.workDir | safeHTML }}
{{ $cat := printf "<span id=terminal>cat %s</span>" .Site.Params.Terminal.profile | safeHTML }}
{{ $description := "" }}
{{ if eq (substr .Site.Params.Terminal.description -3 3) ".md" }}
{{ $s := "" }}
{{ with .Site.GetPage .Site.Params.Terminal.description }}
<!-- replace the first p tag with a br tag -->
{{ $s = replaceRE "</?p[^>]*>" "" .Content 1 }}
{{ end }}
{{ $description = printf "<span id='terminal'>%s</span>" $s | safeHTML}}
{{ else }}
{{ $limit := sub (len (findRE "\n" .Site.Params.Terminal.description)) 1 }}
{{ $description = printf "<span id='terminal'>%s</span>" .Site.Params.Terminal.description }}
{{ $description = replaceRE "\n" "<br>" $description $limit| safeHTML }}
{{ end }}
{{ $tree := "" }}
{{ $leaf := "" }}
{{ if .Site.Params.Tree.use }}
{{ $tree = printf "<span id='terminal'>tree ./%s/</span>" .Site.Params.Tree.folderName | safeHTML}}
{{ $leaf = printf "%s<strong><span id='dir'>./%s/</span></strong><br>" $leaf .Site.Params.Tree.folderName | safeHTML}}
{{ range $index, $val := .Site.Params.Tree.files }}
{{ $ac := index $val 0}}
{{ $link := index $val 1}}
<!-- pass link (i.e. http, https) and mailto -->
{{ $l := $.Site.GetPage $link }}
{{ if $l }}
{{ $link = $l.Permalink}}
{{ end }}
{{ if eq (add $index 1) (len $.Site.Params.Tree.files) }}
{{ $leaf = printf "<span id='terminal'>%s└── <a href='%s' target='_blank' rel='noopener noreferrer me' title='%s'>%s</a></span>" $leaf $link $ac $ac | safeHTML}}
{{ else }}
{{ $leaf = printf "<span id='terminal'>%s├── <a href='%s' target='_blank' rel='noopener noreferrer me' title='%s'>%s</a></span><br>" $leaf $link $ac $ac | safeHTML}}
{{ end }}
{{ end }}
{{ end }}
{{ $end := $env }}
{{ $payload := delimit (slice $cd $cat $description $tree $leaf $end) "" }}
{{ $ps1Delay := $.Site.Params.Terminal.ps1Delay }}
{{ $stdoutDelay := $.Site.Params.Terminal.stdoutDelay }}
{{ $commandDelay := $.Site.Params.Terminal.commandDelay }}
{{ partial "partials/typeIndex.html" (dict "context" . "env" $env "cd" $cd "envWithDir" $envWithDir "cat" $cat "description" $description "tree" $tree "leaf" $leaf "ps1delay" $ps1Delay "stdoutdelay" $stdoutDelay "commanddelay" $commandDelay ) }}
{{ end }}