diff options
Diffstat (limited to 'layouts/index.html')
| -rw-r--r-- | layouts/index.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..0a84145 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,55 @@ +{{ 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'>%s</a></span>" $leaf $link $ac | safeHTML}} + {{ else }} + {{ $leaf = printf "<span id='terminal'>%s├── <a href='%s'>%s</a></span><br>" $leaf $link $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 }} |
