mirror of
https://github.com/idanoo/m2.nz
synced 2025-07-03 13:52:13 +00:00
Update Theme
This commit is contained in:
parent
a212477863
commit
d47be661bd
212 changed files with 13069 additions and 8406 deletions
|
@ -19,11 +19,11 @@
|
|||
|
||||
{{- with $caption -}}
|
||||
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
{{- partial "plugin/img.html" $options -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- . | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
{{- partial "plugin/img.html" $options -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -12,4 +12,4 @@
|
|||
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get 2) | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
{{- partial "plugin/a.html" $options -}}
|
||||
|
|
9
themes/LoveIt/layouts/shortcodes/person.html
Normal file
9
themes/LoveIt/layouts/shortcodes/person.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{- $url := cond .IsNamedParams (.Get "url") (.Get 0) -}}
|
||||
{{- $name := cond .IsNamedParams (.Get "name") (.Get 1) -}}
|
||||
{{- $text := cond .IsNamedParams (.Get "text") (.Get 2) -}}
|
||||
{{- $pic := cond .IsNamedParams (.Get "picture") (.Get 3) -}}
|
||||
{{- $options := dict "Class" "person-mention" "Name" $name "URL" $url "Text" $text "Image" $pic -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $options = dict "Nickname" (.Get "nick") | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- partial "plugin/h-card" $options -}}
|
|
@ -1,18 +1,21 @@
|
|||
{{- $content := trim .Inner "\n" -}}
|
||||
{{- $classList := .Get "class" | slice -}}
|
||||
{{- $classList := slice -}}
|
||||
{{- with .Get "class" -}}
|
||||
{{- $classList = $classList | append . -}}
|
||||
{{- end -}}
|
||||
{{- $tag := .Get "tag" | default "div" -}}
|
||||
|
||||
{{- with .Get "code" -}}
|
||||
{{- if .Get "code" -}}
|
||||
{{- /* highlight code content without line number */ -}}
|
||||
{{- $content = highlight $content . "linenos=false" -}}
|
||||
{{- $content = highlight $content (.Get "code") "lineNos=false, noClasses=false" -}}
|
||||
{{- /* delete outer label */ -}}
|
||||
{{- $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content -}}
|
||||
{{- /* parsing markdown links */ -}}
|
||||
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content -}}
|
||||
{{- /* replace " " to " " and replace "\n" to "<br />" */ -}}
|
||||
{{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "<br />" -}}
|
||||
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
|
||||
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
|
||||
{{- $content = replaceRE `.*<code[^<>]*>(?s)(.*)</code>.*` "$1" $content -}}
|
||||
{{- if .Get "code-link" -}}
|
||||
{{- /* parsing code links */ -}}
|
||||
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=\"$4\">$3</a>$1$5$6" $content -}}
|
||||
{{- end -}}
|
||||
{{- /* split multiline string */ -}}
|
||||
{{- $content = split $content "\n" -}}
|
||||
{{- $classList = $classList | append "highlight" -}}
|
||||
{{- else -}}
|
||||
{{- $content = $content | .Page.RenderString -}}
|
||||
|
@ -26,6 +29,11 @@
|
|||
{{- $group = $group | default slice | append $id -}}
|
||||
{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
|
||||
|
||||
{{- $attrs := printf `id="%v"` $id -}}
|
||||
{{- with $classList -}}
|
||||
{{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="typeit">
|
||||
{{- printf `<%v id="%v" class="%v"></%v>` $tag $id (delimit $classList " ") $tag | safeHTML -}}
|
||||
{{- printf `<%v %v></%v>` $tag $attrs $tag | safeHTML -}}
|
||||
</div>
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
|
||||
{{- $alt := printf "LoveIt %v | %v" $label $version -}}
|
||||
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">
|
||||
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/img.html" -}}
|
||||
</a>
|
Loading…
Add table
Add a link
Reference in a new issue