diff options
author | it-gro <13005925+it-gro@users.noreply.github.com> | 2021-08-24 08:41:54 +0300 |
---|---|---|
committer | it-gro <13005925+it-gro@users.noreply.github.com> | 2021-08-24 08:41:54 +0300 |
commit | f4a5b4122f1a644dd04ecb222bba7d093fe07570 (patch) | |
tree | 4634dfc12cd897bf0a02b926cc14f9b7eb441373 | |
parent | 4419bf88c71bf2a7f6318274ede07a5babf2a2ac (diff) |
wip
-rw-r--r--[-rwxr-xr-x] | exampleSite/bin/hugo-server-sh | 0 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 12 | ||||
-rw-r--r-- | layouts/_default/list.html | 3 | ||||
-rw-r--r-- | layouts/partials/head.stylesheets.html | 5 | ||||
-rw-r--r-- | layouts/partials/header.nav.google.translate.html | 2 | ||||
-rw-r--r-- | layouts/partials/main.teaserpic.card.html | 9 | ||||
-rw-r--r-- | layouts/shortcodes/highlightfile.html | 37 |
7 files changed, 61 insertions, 7 deletions
diff --git a/exampleSite/bin/hugo-server-sh b/exampleSite/bin/hugo-server-sh index 7da57a9..7da57a9 100755..100644 --- a/exampleSite/bin/hugo-server-sh +++ b/exampleSite/bin/hugo-server-sh diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5b5b5e5..c641fac 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -50,16 +50,16 @@ {{- end}} {{- /* .Content */}} - {{/*- $.Scratch.Set `myContent` (.Content | replaceRE `(?s:</div>\s?</p>)` `</div>` | replaceRE `(?s:</pre>\s?</p>)` `</pre>` | replaceRE `(?s:</figure>\s*</p>)` `</figure>` ) */}} - {{- $myContent := (.Content | replaceRE `(?s:</div>\s?</p>)` `</div>` | replaceRE `(?s:</pre>\s?</p>)` `</pre>` | replaceRE `(?s:</figure>\s*</p>)` `</figure>` ) }} + {{- $.Scratch.Set `myContent` (.Content | replaceRE `(?s:</div>\s?</p>)` `</div>` | replaceRE `(?s:</pre>\s?</p>)` `</pre>` | replaceRE `(?s:</figure>\s*</p>)` `</figure>` ) }} + {{/*- $myContent := (.Content | replaceRE `(?s:</div>\s?</p>)` `</div>` | replaceRE `(?s:</pre>\s?</p>)` `</pre>` | replaceRE `(?s:</figure>\s*</p>)` `</figure>` ) */}} {{- if isset $.Site.Params (lower `anchor` ) }} {{- if $.Site.Params.anchor.enable }} - {{/*- $.Scratch.Set `myContent` ( ($.Scratch.Get `myContent`) | replaceRE `(<h[1-9] id="([^"]+)".+)(</h[1-9]+>)` (printf `${1} <a class="anchor w3-small " href="#${2}"><i class="%s"></i></a> ${3}` (default "fas fa-link" $.Site.Params.anchor.icon) ) ) */}} - {{- $myContent := ( ($.Scratch.Get `myContent`) | replaceRE `(<h[1-9] id="([^"]+)".+)(</h[1-9]+>)` (printf `${1} <a class="anchor w3-small " href="#${2}"><i class="%s"></i></a> ${3}` (default "fas fa-link" $.Site.Params.anchor.icon) ) ) }} + {{- $.Scratch.Set `myContent` ( ($.Scratch.Get `myContent`) | replaceRE `(<h[1-9] id="([^"]+)".+)(</h[1-9]+>)` (printf `${1} <a class="anchor w3-small " href="#${2}"><i class="%s"></i></a> ${3}` (default "fas fa-link" $.Site.Params.anchor.icon) ) ) }} + {{/*- $myContent := ( ($.Scratch.Get `myContent`) | replaceRE `(<h[1-9] id="([^"]+)".+)(</h[1-9]+>)` (printf `${1} <a class="anchor w3-small " href="#${2}"><i class="%s"></i></a> ${3}` (default "fas fa-link" $.Site.Params.anchor.icon) ) ) */}} {{- end }} {{- end }} - {{/*- ($.Scratch.Get `myContent`) | safeHTML */}} - {{- $myContent | safeHTML }} + {{- ($.Scratch.Get `myContent`) | safeHTML }} + {{/*- $myContent | safeHTML */}} {{- partial `main.related.html` . -}} {{- end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..5081aba --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,3 @@ +{{- if or $.Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }} + {{- `<!-- _default/list.html (empty but here to avoid error message) -->` | safeHTML }} +{{- end}} diff --git a/layouts/partials/head.stylesheets.html b/layouts/partials/head.stylesheets.html index 5dd5f65..591dd78 100644 --- a/layouts/partials/head.stylesheets.html +++ b/layouts/partials/head.stylesheets.html @@ -16,7 +16,10 @@ <link rel="stylesheet" id="theme-colors" href='{{ relURL `vendor/w3css/4/w3-theme-red.css` }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}' /> {{- end }} -<link rel="stylesheet" href='{{ relURL `css/syntax.min.css` }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}' /> + +<!-- <link rel="stylesheet" href='{{ relURL `css/syntax.css` }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}' /> --> +<!-- <link rel="stylesheet" href='{{ relURL `css/syntax.min.css` }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}' /> --> +<link href="{{ .Site.BaseURL }}{{- with .Site.Params.syntaxStyle}}/css/syntax/syntax.{{.}}.css{{else}}/css/syntax.css{{end}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"> {{/* Highlight */}} <link rel="stylesheet" href='{{ relURL `css/w3css-basic.min.css` }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}' /> <link rel="stylesheet" href='{{ relURL `css/res-gallery.min.css` }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}' /> diff --git a/layouts/partials/header.nav.google.translate.html b/layouts/partials/header.nav.google.translate.html index 1f493ec..6f2f227 100644 --- a/layouts/partials/header.nav.google.translate.html +++ b/layouts/partials/header.nav.google.translate.html @@ -8,6 +8,8 @@ { pageLanguage: '{{ .Site.LanguageCode }}' , layout: google.translate.TranslateElement.FloatPosition.TOP_RIGHT + , includedLanguages: 'de,en,fr' + //, includedLanguages: 'en,fr,da,ms,zh-CN' , multilanguagePage: true } , 'google_translate_element' diff --git a/layouts/partials/main.teaserpic.card.html b/layouts/partials/main.teaserpic.card.html index 42ec093..7e0080b 100644 --- a/layouts/partials/main.teaserpic.card.html +++ b/layouts/partials/main.teaserpic.card.html @@ -10,3 +10,12 @@ {{- $myImgCmd := .Param `resImgTeaserInCardCmd` | default $myImgCmd }} {{- $myImgOpt := .Param `resImgTeaserInCardOpt` | default $myImgOpt }} {{ partial `resource.image.html` (dict `page` . `class` $myImgClass `style` $myImgStyle `img` $myImg `cmd` $myImgCmd `opt` $myImgOpt ) }} + +{{- if .Param `youtubeThumbnail` }} +{{- $myYoutubeThumbnail := .Param `youtubeThumbnail`}} +<img + class="w3-image w3-left w3-round w3-hover-opacity" + style="max-width:150px; max-height:150px; width: auto; height: auto; margin: 0px 8px 16px 0px;" + src='https://img.youtube.com/vi/{{$myYoutubeThumbnail}}/0.jpg' +> +{{- end }} diff --git a/layouts/shortcodes/highlightfile.html b/layouts/shortcodes/highlightfile.html new file mode 100644 index 0000000..d66291a --- /dev/null +++ b/layouts/shortcodes/highlightfile.html @@ -0,0 +1,37 @@ +<!-- +Highlights file and provides download link. +File should be located either in the same directory or full path should be specified. +--> + +{{- $src := (.Get "file") -}} +{{- $lang := .Get "language" | default ("python") }} +{{- $opt := .Get "opt" | default ("linenos=table") }} + +{{- if in $src "/" -}} + {{ $filelink := (strings.TrimPrefix "/static" $src ) }} + {{ $justTheSplit := split $filelink "/" }} + {{ $lastPartOnly := index (last 1 $justTheSplit) 0}} + + {{/* <a class="linktofile" href="{{ .Site.BaseURL }}/{{ $filelink }}"/> */}} + {{/* <a class="linktofile" href="{{ $filelink | absURL }}"/> */}} + <a class="linktofile" href="{{ cond (eq (len .Site.BaseURL) 0) ($filelink | absURL) (printf `%s/%s` .Site.BaseURL $filelink)}}"/> + {{ $lastPartOnly }} + </a> + + {{$file := $src | readFile}} + {{/* {{ highlight (print $file) $lang $opt}} */}} + {{/* highlight ($file | replaceRE `\r` ``) $lang $opt */}} + {{ highlight ( trim (readFile $src | replaceRE "\r\n" "\n") "\n") $lang $opt }} + +{{- else -}} + {{ $file := (printf "%s%s" $.Page.File.Dir $src) }} + + {{/* <a class="linktofile" href="{{ .Site.BaseURL }}/{{ $file }}"/> */}} + {{/* <a class="linktofile" href="{{ $file | absURL }}"/> */}} + <a class="linktofile" href="{{ cond (eq (len .Site.BaseURL) 0) ($file | absURL) (printf `%s/%s` .Site.BaseURL $file)}}"/> + {{ $src }} + </a> + + {{ highlight (trim (readFile (printf "content/%s" $file)) "\n") $lang $opt}} + +{{- end -}} |