diff options
author | uPagge <git@upagge.ru> | 2021-03-03 22:30:26 +0300 |
---|---|---|
committer | uPagge <git@upagge.ru> | 2021-03-03 22:30:26 +0300 |
commit | df370f4ae3be096d4c4a27f9f9074e026c132d3d (patch) | |
tree | 85230fa9f173a21fad3d5a4d231f3269abe1b708 /layouts/shortcodes | |
parent | b6e7e9c46be0ef8d9c722ff873a1cbe1a6240604 (diff) |
typeit del
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r-- | layouts/shortcodes/typeit.html | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/layouts/shortcodes/typeit.html b/layouts/shortcodes/typeit.html deleted file mode 100644 index 1d2ea01..0000000 --- a/layouts/shortcodes/typeit.html +++ /dev/null @@ -1,31 +0,0 @@ -{{- $content := trim .Inner "\n" -}} -{{- $classList := .Get "class" | slice -}} -{{- $tag := .Get "tag" | default "div" -}} - -{{- with .Get "code" -}} - {{- /* highlight code content without line number */ -}} - {{- $content = highlight $content . "linenos=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 -}} - {{- $classList = $classList | append "highlight" -}} -{{- else -}} - {{- $content = $content | .Page.RenderString -}} -{{- end -}} - -{{- /* trim the newline */ -}} -{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}} -{{- $key := .Get "group" | string | default $id -}} -{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}} -{{- $group := index $typeitMap $key -}} -{{- $group = $group | default slice | append $id -}} -{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}} - -<div class="typeit"> - {{- printf `<%v id="%v" class="%v"></%v>` $tag $id (delimit $classList " ") $tag | safeHTML -}} -</div> |