Initial commit.
This commit is contained in:
37
themes/blowfish/layouts/shortcodes/alert.html
Normal file
37
themes/blowfish/layouts/shortcodes/alert.html
Normal file
@@ -0,0 +1,37 @@
|
||||
{{ if .IsNamedParams }}
|
||||
{{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get "icon") ) }}
|
||||
{{ $.Scratch.Set "cardColor" (.Get "cardColor") }}
|
||||
{{ $.Scratch.Set "iconColor" (.Get "iconColor") }}
|
||||
{{ $.Scratch.Set "textColor" (.Get "textColor") }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "icon" (default "triangle-exclamation" (.Get 0) ) }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<div
|
||||
{{ if not ($.Scratch.Get "cardColor") }}
|
||||
class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900"
|
||||
{{ else }}
|
||||
class="flex px-4 py-3 rounded-md" style="background-color: {{ $.Scratch.Get "cardColor" }}"
|
||||
{{ end }}
|
||||
>
|
||||
<span
|
||||
{{ if not ($.Scratch.Get "iconColor") }}
|
||||
class="text-primary-400 ltr:pr-3 rtl:pl-3 flex items-center"
|
||||
{{ else }}
|
||||
class="ltr:pr-3 rtl:pl-3 flex items-center" style="color: {{ $.Scratch.Get "iconColor" }}"
|
||||
{{ end }}
|
||||
>
|
||||
{{ partial "icon.html" ($.Scratch.Get "icon") }}
|
||||
</span>
|
||||
|
||||
<span
|
||||
{{ if not ($.Scratch.Get "textColor") }}
|
||||
class="dark:text-neutral-300"
|
||||
{{ else }}
|
||||
style="color: {{ $.Scratch.Get "textColor" }}"
|
||||
{{ end }}
|
||||
>
|
||||
{{- .Inner | markdownify -}}
|
||||
</span>
|
||||
</div>
|
||||
10
themes/blowfish/layouts/shortcodes/article.html
Normal file
10
themes/blowfish/layouts/shortcodes/article.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ $link := .Get "link" }}
|
||||
{{ $target := .Page }}
|
||||
{{ if ne $link .Page.RelPermalink }}
|
||||
{{ $target = index (first 1 (where .Site.AllPages "RelPermalink" $link)) 0 }}
|
||||
{{ end }}
|
||||
{{ if $target }}
|
||||
<section class="space-y-10 w-full">
|
||||
{{ partial "article-link/simple.html" $target }}
|
||||
</section>
|
||||
{{ end }}
|
||||
1
themes/blowfish/layouts/shortcodes/badge.html
Normal file
1
themes/blowfish/layouts/shortcodes/badge.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ partial "badge.html" .Inner }}
|
||||
8
themes/blowfish/layouts/shortcodes/button.html
Normal file
8
themes/blowfish/layouts/shortcodes/button.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<a
|
||||
class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700"
|
||||
{{ with .Get "href" }}href="{{ . }}"{{ end }}
|
||||
{{ with .Get "target" }}target="{{ . }}"{{ end }}
|
||||
{{ with .Get "rel" }}rel="{{ . }}"{{ end }}
|
||||
role="button">
|
||||
{{ .Inner }}
|
||||
</a>
|
||||
101
themes/blowfish/layouts/shortcodes/carousel.html
Normal file
101
themes/blowfish/layouts/shortcodes/carousel.html
Normal file
@@ -0,0 +1,101 @@
|
||||
{{ $id := delimit (slice "carousel" (partial "functions/uid.html" .)) "-" }}
|
||||
{{ $aspect := default "16-9" (.Get "aspectRatio") }}
|
||||
{{ $interval := default "2000" (.Get "interval") }}
|
||||
|
||||
{{ $page := .Page.Resources }}
|
||||
{{ $imagesTemp := .Get "images" }}
|
||||
{{ $imagesTemp = strings.TrimPrefix "{" $imagesTemp }}
|
||||
{{ $imagesTemp = strings.TrimSuffix "}" $imagesTemp }}
|
||||
{{ $imagesTemp := strings.Split $imagesTemp "," }}
|
||||
{{ $images := slice }}
|
||||
{{ range $imagesTemp }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $images = $images | append (resources.GetRemote .) }}
|
||||
{{ else }}
|
||||
{{ $images = $images | append ($page.Match .) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<div id="{{ $id }}" class="relative" data-twe-carousel-init data-twe-ride="carousel">
|
||||
<div
|
||||
class="absolute right-0 bottom-0 left-0 z-2 mx-[15%] mb-10 flex list-none justify-center p-0"
|
||||
data-twe-carousel-indicators>
|
||||
{{ $num := 0 }}
|
||||
{{ range $images }}
|
||||
<button
|
||||
type="button"
|
||||
data-twe-target="#{{ $id }}"
|
||||
data-twe-slide-to="{{ $num }}"
|
||||
{{ if eq $num 0 }}data-twe-carousel-active aria-current="true"{{ end }}
|
||||
class="mx-[3px] box-content h-[3px] w-[30px] flex-initial cursor-pointer border-0 border-y-[10px] border-solid border-transparent bg-neutral bg-clip-padding p-0 -indent-[999px] opacity-50 transition-opacity duration-[600ms] ease-[cubic-bezier(0.25,0.1,0.25,1.0)] motion-reduce:transition-none"
|
||||
aria-label="Slide {{ $num }}"></button>
|
||||
|
||||
{{ $num = add $num 1 }}
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
<div class="relative w-full overflow-hidden after:clear-both after:block after:content-['']">
|
||||
{{ $num := 0 }}
|
||||
{{ range $images }}
|
||||
<div
|
||||
class="relative float-left -mr-[100%] {{ if not (eq $num 0) }}
|
||||
hidden
|
||||
{{ end }} w-full transition-transform duration-[{{ $interval }}ms] ease-in-out motion-reduce:transition-none"
|
||||
data-twe-carousel-item
|
||||
{{ if eq $num 0 }}data-twe-carousel-active{{ end }}>
|
||||
<div class="ratio-{{ $aspect }} single_hero_background">
|
||||
<img
|
||||
src="{{ .RelPermalink }}"
|
||||
class="block absolute top-0 object-cover w-full h-full nozoom"
|
||||
alt="carousel image {{ $num }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ $num = add $num 1 }}
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
<button
|
||||
class="absolute top-0 bottom-0 left-0 z-2 flex w-[15%] items-center justify-center border-0 bg-none p-0 text-center text-white opacity-50 transition-opacity duration-150 ease-[cubic-bezier(0.25,0.1,0.25,1.0)] hover:text-white hover:no-underline hover:opacity-90 hover:outline-none focus:text-white focus:no-underline focus:opacity-90 focus:outline-none motion-reduce:transition-none"
|
||||
type="button"
|
||||
data-twe-target="#{{ $id }}"
|
||||
data-twe-slide="prev">
|
||||
<span class="inline-block h-8 w-8">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="4.5"
|
||||
stroke="currentColor"
|
||||
class="h-6 w-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" />
|
||||
</svg>
|
||||
</span>
|
||||
<span
|
||||
class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]"
|
||||
>Previous</span
|
||||
>
|
||||
</button>
|
||||
<button
|
||||
class="absolute top-0 bottom-0 right-0 z-[1] flex w-[15%] items-center justify-center border-0 bg-none p-0 text-center text-white opacity-50 transition-opacity duration-150 ease-[cubic-bezier(0.25,0.1,0.25,1.0)] hover:text-white hover:no-underline hover:opacity-90 hover:outline-none focus:text-white focus:no-underline focus:opacity-90 focus:outline-none motion-reduce:transition-none"
|
||||
type="button"
|
||||
data-twe-target="#{{ $id }}"
|
||||
data-twe-slide="next">
|
||||
<span class="inline-block h-8 w-8">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="4.5"
|
||||
stroke="currentColor"
|
||||
class="h-6 w-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
|
||||
</svg>
|
||||
</span>
|
||||
<span
|
||||
class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]"
|
||||
>Nextsads</span
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
12
themes/blowfish/layouts/shortcodes/chart.html
Normal file
12
themes/blowfish/layouts/shortcodes/chart.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ $id := delimit (slice "chart" (partial "functions/uid.html" .)) "-" }}
|
||||
<div class="chart">
|
||||
<canvas id="{{ $id }}"></canvas>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
const ctx = document.getElementById("{{ $id }}");
|
||||
const chart = new Chart(ctx, {
|
||||
{{ .Inner | safeJS }}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
59
themes/blowfish/layouts/shortcodes/codeberg.html
Normal file
59
themes/blowfish/layouts/shortcodes/codeberg.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}}
|
||||
{{- $codebergData := resources.GetRemote $codebergURL | transform.Unmarshal -}}
|
||||
{{- with $codebergData -}}
|
||||
<div class="codeberg-card-wrapper">
|
||||
<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer">
|
||||
<div
|
||||
class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl">
|
||||
<div class="flex items-center">
|
||||
<span class="text-2xl text-neutral-800 dark:text-neutral mr-[10px]">
|
||||
{{ partial "icon.html" "codeberg" }}
|
||||
</span>
|
||||
<div
|
||||
id="{{ $id }}-full_name"
|
||||
class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral">
|
||||
{{ .full_name | markdownify }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .description | markdownify }}
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "star" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-stars_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .stars_count }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "fork" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .forks_count }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ $fetchRepo := resources.Get "js/fetch-repo.js" }}
|
||||
{{ $fetchRepo = $fetchRepo | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script
|
||||
async
|
||||
type="text/javascript"
|
||||
src="{{ $fetchRepo.RelPermalink }}"
|
||||
integrity="{{ $fetchRepo.Data.Integrity }}"
|
||||
data-repo-url="{{ $codebergURL }}"
|
||||
data-repo-id="{{ $id }}"></script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
27
themes/blowfish/layouts/shortcodes/codeimporter.html
Normal file
27
themes/blowfish/layouts/shortcodes/codeimporter.html
Normal file
@@ -0,0 +1,27 @@
|
||||
{{ $url := .Get "url" }}
|
||||
{{ $type := .Get "type" }}
|
||||
{{ $startLine := .Get "startLine" | default 1 | int }}
|
||||
{{ $startLine = sub $startLine 1 }}
|
||||
{{ $endLine := .Get "endLine" | default -1 | int }}
|
||||
{{ $selectedLines := slice }}
|
||||
{{ with resources.GetRemote (urls.Parse $url) }}
|
||||
{{ $lines := split .Content "\n" }}
|
||||
{{ $totalLine := $lines | len }}
|
||||
|
||||
{{ if ne $endLine -1 }}
|
||||
{{ $endLine = math.Min $endLine $totalLine }}
|
||||
{{ else }}
|
||||
{{ $endLine = $totalLine }}
|
||||
{{ end }}
|
||||
|
||||
{{ if gt $startLine $endLine }}
|
||||
{{ errorf "Code Importer Shortcode - startLine is greater than endLine" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ $selectedLines := first $endLine $lines }}
|
||||
{{ $selectedLines = after $startLine $selectedLines }}
|
||||
{{ $codeBlock := printf "```%s\n%s\n```" $type (delimit $selectedLines "\n") }}
|
||||
{{ $codeBlock | markdownify }}
|
||||
{{ else }}
|
||||
{{ errorf "Code Importer Shortcode - Unable to get remote resource" . }}
|
||||
{{ end }}
|
||||
51
themes/blowfish/layouts/shortcodes/figure.html
Normal file
51
themes/blowfish/layouts/shortcodes/figure.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
|
||||
{{ if .Get "default" }}
|
||||
{{ partial "hugo-embedded/shortcodes/figure-default.html" . }}
|
||||
{{ else }}
|
||||
{{- $url := urls.Parse (.Get "src") }}
|
||||
{{- $altText := .Get "alt" }}
|
||||
{{- $caption := .Get "caption" }}
|
||||
{{- $href := .Get "href" }}
|
||||
{{- $class := .Get "class" }}
|
||||
{{- $target := .Get "target" | default "_blank" }}
|
||||
{{- $nozoom := .Get "nozoom" | default false -}}
|
||||
|
||||
<figure>
|
||||
{{- with $href }}<a href="{{ . }}" {{ with $target }}target="{{ . }}"{{ end }}>{{ end -}}
|
||||
{{- if findRE "^https?" $url.Scheme }}
|
||||
<img class="my-0 rounded-md{{ with $nozoom }} nozoom{{ end }}{{ with $class }} {{ . }}{{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" />
|
||||
{{- else }}
|
||||
{{- $resource := "" }}
|
||||
{{- if $.Page.Resources.GetMatch ($url.String) }}
|
||||
{{- $resource = $.Page.Resources.GetMatch ($url.String) }}
|
||||
{{- else if resources.GetMatch ($url.String) }}
|
||||
{{- $resource = resources.Get ($url.String) }}
|
||||
{{- end }}
|
||||
{{- with $resource }}
|
||||
{{- if or $disableImageOptimization (eq .MediaType.SubType "svg")}}
|
||||
<img
|
||||
class="my-0 rounded-md{{ with $nozoom }} nozoom{{ end }}{{ with $class }} {{ . }}{{ end }}"
|
||||
src="{{ .RelPermalink }}"
|
||||
alt="{{ $altText }}"
|
||||
/>
|
||||
{{- else }}
|
||||
<img
|
||||
class="my-0 rounded-md{{ with $nozoom }} nozoom{{ end }}{{ with $class }} {{ . }}{{ end }}"
|
||||
srcset="
|
||||
{{ (.Resize "330x").RelPermalink }} 330w,
|
||||
{{ (.Resize "660x").RelPermalink }} 660w,
|
||||
{{ (.Resize "1024x").RelPermalink }} 1024w,
|
||||
{{ (.Resize "1320x").RelPermalink }} 2x"
|
||||
src="{{ (.Resize "660x").RelPermalink }}"
|
||||
data-zoom-src="{{ (.Resize "1320x").RelPermalink }}"
|
||||
alt="{{ $altText }}"
|
||||
/>
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
<img class="my-0 rounded-md{{ with $nozoom }} nozoom{{ end }}{{ with $class }} {{ . }}{{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" />
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
||||
{{ if $href }}</a>{{ end }}
|
||||
</figure>
|
||||
{{- end -}}
|
||||
59
themes/blowfish/layouts/shortcodes/forgejo.html
Normal file
59
themes/blowfish/layouts/shortcodes/forgejo.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{{ $id := delimit (slice "forgejo" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $forgejoURL := print (.Get "server" | default .Site.Params.forgejoDefaultServer) "/api/v1/repos/" (.Get "repo") -}}
|
||||
{{- $forgejoData := resources.GetRemote $forgejoURL | transform.Unmarshal -}}
|
||||
{{- with $forgejoData -}}
|
||||
<div class="forgejo-card-wrapper">
|
||||
<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer">
|
||||
<div
|
||||
class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl">
|
||||
<div class="flex items-center">
|
||||
<span class="text-2xl text-neutral-800 dark:text-neutral mr-[10px]">
|
||||
{{ partial "icon.html" "forgejo" }}
|
||||
</span>
|
||||
<div
|
||||
id="{{ $id }}-full_name"
|
||||
class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral">
|
||||
{{ .full_name | markdownify }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .description | markdownify }}
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "star" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-stars_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .stars_count }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "fork" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .forks_count }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ $fetchRepo := resources.Get "js/fetch-repo.js" }}
|
||||
{{ $fetchRepo = $fetchRepo | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script
|
||||
async
|
||||
type="text/javascript"
|
||||
src="{{ $fetchRepo.RelPermalink }}"
|
||||
integrity="{{ $fetchRepo.Data.Integrity }}"
|
||||
data-repo-url="{{ $forgejoURL }}"
|
||||
data-repo-id="{{ $id }}"></script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
31
themes/blowfish/layouts/shortcodes/gallery.html
Normal file
31
themes/blowfish/layouts/shortcodes/gallery.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{{ $id := delimit (slice "gallery" (partial "functions/uid.html" .)) "-" -}}
|
||||
{{ $content := .Inner -}}
|
||||
|
||||
{{/* find all img tags */}}
|
||||
{{ range findRE `<img\s+[^>]*>` $content -}}
|
||||
{{ $imgTag := . -}}
|
||||
{{/* extract src attribute */}}
|
||||
{{ with findRESubmatch `src=['"]([^'"]+)['"]` $imgTag -}}
|
||||
{{ $srcAttr := index (index . 0) 0 -}}
|
||||
{{ $srcValue := index (index . 0) 1 -}}
|
||||
{{ $srcValueFinal := $srcValue -}}
|
||||
|
||||
{{ if or (hasPrefix $srcValue "http://") (hasPrefix $srcValue "https://") -}}
|
||||
{{ with resources.GetRemote $srcValue -}}{{ $srcValueFinal = .RelPermalink -}}{{ end -}}
|
||||
{{ else -}}
|
||||
{{ with $.Page.Resources.GetMatch $srcValue -}}
|
||||
{{ $srcValueFinal = .RelPermalink -}}
|
||||
{{ else -}}
|
||||
{{ with resources.GetMatch $srcValue -}}{{ $srcValueFinal = .RelPermalink -}}{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ $newTag := replace $imgTag $srcAttr (printf `src="%s"` $srcValueFinal) -}}
|
||||
{{ $content = replace $content $imgTag $newTag -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
|
||||
<div id="{{- $id -}}" class="gallery">
|
||||
{{ $content | safeHTML -}}
|
||||
</div>
|
||||
3
themes/blowfish/layouts/shortcodes/gist.html
Normal file
3
themes/blowfish/layouts/shortcodes/gist.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<script src="https://gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js{{ if len .Params | eq 3 }}
|
||||
?file={{ index .Params 2 }}
|
||||
{{ end }}"></script>
|
||||
59
themes/blowfish/layouts/shortcodes/gitea.html
Normal file
59
themes/blowfish/layouts/shortcodes/gitea.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{{ $id := delimit (slice "gitea" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $giteaURL := print (.Get "server" | default .Site.Params.giteaDefaultServer) "/api/v1/repos/" (.Get "repo") -}}
|
||||
{{- $giteaData := resources.GetRemote $giteaURL | transform.Unmarshal -}}
|
||||
{{- with $giteaData -}}
|
||||
<div class="gitea-card-wrapper">
|
||||
<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer">
|
||||
<div
|
||||
class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl">
|
||||
<div class="flex items-center">
|
||||
<span class="text-2xl text-neutral-800 dark:text-neutral mr-[10px]">
|
||||
{{ partial "icon.html" "gitea" }}
|
||||
</span>
|
||||
<div
|
||||
id="{{ $id }}-full_name"
|
||||
class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral">
|
||||
{{ .full_name | markdownify }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .description | markdownify }}
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "star" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-stars_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .stars_count }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "fork" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .forks_count }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ $fetchRepo := resources.Get "js/fetch-repo.js" }}
|
||||
{{ $fetchRepo = $fetchRepo | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script
|
||||
async
|
||||
type="text/javascript"
|
||||
src="{{ $fetchRepo.RelPermalink }}"
|
||||
integrity="{{ $fetchRepo.Data.Integrity }}"
|
||||
data-repo-url="{{ $giteaURL }}"
|
||||
data-repo-id="{{ $id }}"></script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
75
themes/blowfish/layouts/shortcodes/github.html
Normal file
75
themes/blowfish/layouts/shortcodes/github.html
Normal file
@@ -0,0 +1,75 @@
|
||||
{{ $id := delimit (slice "github" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}}
|
||||
{{- $githubData := resources.GetRemote $githubURL | transform.Unmarshal -}}
|
||||
{{- $githubThumbnailURL := print "https://opengraph.githubassets.com/0/" (.Get "repo") -}}
|
||||
{{- $showThumbnail := .Get "showThumbnail" | default true -}}
|
||||
|
||||
|
||||
<div class="github-card-wrapper">
|
||||
{{- with $githubData -}}
|
||||
<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer">
|
||||
<div
|
||||
class="w-full md:w-auto p-0 m-0 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl">
|
||||
{{- if $showThumbnail -}}
|
||||
<div class="w-full nozoom">
|
||||
<img
|
||||
src="{{ $githubThumbnailURL }}"
|
||||
alt="GitHub Repository Thumbnail"
|
||||
class="nozoom mt-0 mb-0 w-full h-full object-cover">
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<div class="w-full md:w-auto pt-3 p-5">
|
||||
<div class="flex items-center">
|
||||
<span class="text-2xl text-neutral-800 dark:text-neutral mr-[10px]">
|
||||
{{ partial "icon.html" "github" }}
|
||||
</span>
|
||||
<div
|
||||
id="{{ $id }}-full_name"
|
||||
class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral">
|
||||
{{ .full_name | markdownify }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .description | markdownify }}
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "star" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .stargazers_count }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "fork" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .forks }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ $fetchRepo := resources.Get "js/fetch-repo.js" }}
|
||||
{{ $fetchRepo = $fetchRepo | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script
|
||||
async
|
||||
type="text/javascript"
|
||||
src="{{ $fetchRepo.RelPermalink }}"
|
||||
integrity="{{ $fetchRepo.Data.Integrity }}"
|
||||
data-repo-url="{{ $githubURL }}"
|
||||
data-repo-id="{{ $id }}"></script>
|
||||
</a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
52
themes/blowfish/layouts/shortcodes/gitlab.html
Normal file
52
themes/blowfish/layouts/shortcodes/gitlab.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{{ $id := delimit (slice "gitlab" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $gitlabURL := print (default "https://gitlab.com/" (.Get "baseURL")) "api/v4/projects/" (.Get "projectID") -}}
|
||||
|
||||
{{- $gitLabData := resources.GetRemote $gitlabURL | transform.Unmarshal -}}
|
||||
{{- with $gitLabData -}}
|
||||
<div class="gitlab-card-wrapper">
|
||||
<a id="{{ $id }}" target="_blank" href="{{ .web_url }}" class="cursor-pointer">
|
||||
<div
|
||||
class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl">
|
||||
<div class="flex items-center">
|
||||
<span class="text-2xl text-neutral-800 dark:text-neutral mr-[10px]">
|
||||
{{ partial "icon.html" "gitlab" }}
|
||||
</span>
|
||||
<div
|
||||
id="{{ $id }}-name_with_namespace"
|
||||
class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral">
|
||||
{{ .name_with_namespace | markdownify }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .description | markdownify }}
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "star" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-star_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .star_count }}
|
||||
</div>
|
||||
|
||||
<span class="text-md mr-1 text-neutral-800 dark:text-neutral">
|
||||
{{ partial "icon.html" "fork" }}
|
||||
</span>
|
||||
<div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ .forks_count }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ $fetchRepo := resources.Get "js/fetch-repo.js" }}
|
||||
{{ $fetchRepo = $fetchRepo | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script
|
||||
async
|
||||
type="text/javascript"
|
||||
src="{{ $fetchRepo.RelPermalink }}"
|
||||
integrity="{{ $fetchRepo.Data.Integrity }}"
|
||||
data-repo-url="{{ $gitlabURL }}"
|
||||
data-repo-id="{{ $id }}"></script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
8
themes/blowfish/layouts/shortcodes/icon.html
Normal file
8
themes/blowfish/layouts/shortcodes/icon.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ $icon := resources.Get (printf "icons/%s.svg" ($.Get 0)) }}
|
||||
{{ if $icon }}
|
||||
<span class="relative inline-block align-text-bottom icon">
|
||||
{{ $icon.Content | safeHTML }}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{ errorf `[BLOWFISH] Shortcode "icon" error in "%s": Resource "%s" not found. Check the path is correct or remove the shortcode.` .Page.Path (printf "icons/%s.svg" ($.Get 0)) }}
|
||||
{{ end }}
|
||||
1
themes/blowfish/layouts/shortcodes/katex.html
Normal file
1
themes/blowfish/layouts/shortcodes/katex.html
Normal file
@@ -0,0 +1 @@
|
||||
{{/* Nothing to see here */}}
|
||||
12
themes/blowfish/layouts/shortcodes/keyword.html
Normal file
12
themes/blowfish/layouts/shortcodes/keyword.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ $icon := .Get "icon" }}
|
||||
<div class="flex mt-2">
|
||||
<span
|
||||
class="rounded-full bg-primary-500 dark:bg-primary-400 text-neutral-50 dark:text-neutral-800 px-1.5 py-[1px] text-xs font-normal">
|
||||
<span class="flex flex-row items-center">
|
||||
{{ if $icon }}
|
||||
<span class="mr-1">{{ partial "icon" $icon }}</span>
|
||||
{{ end }}
|
||||
<span> {{- .Inner | markdownify -}} </span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
1
themes/blowfish/layouts/shortcodes/keywordList.html
Normal file
1
themes/blowfish/layouts/shortcodes/keywordList.html
Normal file
@@ -0,0 +1 @@
|
||||
<div class="flex flex-row flex-wrap items-center space-x-2">{{- .Inner -}}</div>
|
||||
3
themes/blowfish/layouts/shortcodes/lead.html
Normal file
3
themes/blowfish/layouts/shortcodes/lead.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="lead text-neutral-500 dark:text-neutral-400 !mb-9 text-xl">
|
||||
{{ .Inner | markdownify }}
|
||||
</div>
|
||||
42
themes/blowfish/layouts/shortcodes/list.html
Normal file
42
themes/blowfish/layouts/shortcodes/list.html
Normal file
@@ -0,0 +1,42 @@
|
||||
{{ $limit := .Get "limit" | default 1 }}
|
||||
{{ $title := .Get "title" | default (i18n "shortcode.recent_articles" | emojify) }}
|
||||
{{ $parent := .Page.RelPermalink }}
|
||||
{{ $cardView := .Get "cardView" }}
|
||||
{{ $where := .Get "where" }}
|
||||
{{ $value := .Get "value" }}
|
||||
<h2 class="mt-20 text-2xl font-extrabold mb-10">{{ $title }}</h2>
|
||||
|
||||
{{ if $cardView | default false }}
|
||||
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
||||
{{ if $where }}
|
||||
{{ range ( where .Site.RegularPages $where $value | first $limit ) }}
|
||||
{{ if not (eq .RelPermalink $parent) }}
|
||||
{{ partial "article-link/card.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ range .Site.RegularPages | first $limit }}
|
||||
{{ if not (eq .RelPermalink $parent) }}
|
||||
{{ partial "article-link/card.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ else }}
|
||||
|
||||
<section class="space-y-10 w-full mt-10 mb-10">
|
||||
{{ if $where }}
|
||||
{{ range ( where .Site.RegularPages $where $value | first $limit ) }}
|
||||
{{ if not (eq .RelPermalink $parent) }}
|
||||
{{ partial "article-link/simple.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ range .Site.RegularPages | first $limit }}
|
||||
{{ if not (eq .RelPermalink $parent) }}
|
||||
{{ partial "article-link/simple.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
3
themes/blowfish/layouts/shortcodes/ltr.html
Normal file
3
themes/blowfish/layouts/shortcodes/ltr.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div dir="ltr" class="text-left">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
6
themes/blowfish/layouts/shortcodes/mdimporter.html
Normal file
6
themes/blowfish/layouts/shortcodes/mdimporter.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{ $url := .Get "url" }}
|
||||
{{ with resources.GetRemote (urls.Parse $url) }}
|
||||
{{ .Content | markdownify }}
|
||||
{{ else }}
|
||||
{{ errorf "Mardown Importer Shortcode - Unable to get remote resource" . }}
|
||||
{{ end }}
|
||||
3
themes/blowfish/layouts/shortcodes/mermaid.html
Normal file
3
themes/blowfish/layouts/shortcodes/mermaid.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="mermaid" align="center">
|
||||
<pre>{{ .Inner | safeHTML }}</pre>
|
||||
</div>
|
||||
3
themes/blowfish/layouts/shortcodes/rtl.html
Normal file
3
themes/blowfish/layouts/shortcodes/rtl.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div dir="rtl" class="text-right">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
22
themes/blowfish/layouts/shortcodes/screenshot.html
Normal file
22
themes/blowfish/layouts/shortcodes/screenshot.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ if .Get "src" }}
|
||||
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
|
||||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "href" -}}
|
||||
<a href="{{ .Get "href" }}">
|
||||
{{- end -}}
|
||||
<img src="{{ $image.RelPermalink }}"
|
||||
{{- if or (.Get "alt") (.Get "caption") }}
|
||||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
|
||||
{{- end -}}
|
||||
width="100%"
|
||||
height="auto"
|
||||
style="max-width:{{ div $image.Width 2 }}px; max-height:{{ div $image.Height 2 }}px;"
|
||||
/>
|
||||
{{- if .Get "href" }}</a>{{ end -}}
|
||||
{{- if .Get "caption" -}}
|
||||
<figcaption>
|
||||
{{- .Get "caption" | markdownify -}}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
{{ end }}
|
||||
11
themes/blowfish/layouts/shortcodes/swatches.html
Normal file
11
themes/blowfish/layouts/shortcodes/swatches.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="flex justify-between">
|
||||
<span
|
||||
class="w-full py-6 mr-3 rounded-md"
|
||||
{{ with .Get 0 }}style="background-color: {{ . }}"{{ end }}></span>
|
||||
<span
|
||||
class="w-full py-6 mr-3 rounded-md"
|
||||
{{ with .Get 1 }}style="background-color: {{ . }}"{{ end }}></span>
|
||||
<span
|
||||
class="w-full py-6 mr-3 rounded-md"
|
||||
{{ with .Get 2 }}style="background-color: {{ . }}"{{ end }}></span>
|
||||
</div>
|
||||
3
themes/blowfish/layouts/shortcodes/timeline.html
Normal file
3
themes/blowfish/layouts/shortcodes/timeline.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<ol class="border-l-2 border-primary-500 dark:border-primary-300 list-none">
|
||||
{{- .Inner -}}
|
||||
</ol>
|
||||
32
themes/blowfish/layouts/shortcodes/timelineItem.html
Normal file
32
themes/blowfish/layouts/shortcodes/timelineItem.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{{ $icon := .Get "icon" | default "check" }}
|
||||
{{ $header := .Get "header" }}
|
||||
{{ $badge := .Get "badge" }}
|
||||
{{ $subheader := .Get "subheader" }}
|
||||
<li>
|
||||
<div class="flex flex-start">
|
||||
<div
|
||||
class="bg-primary-500 dark:bg-primary-300 text-neutral-50 dark:text-neutral-700 min-w-[30px] h-8 text-2xl flex items-center justify-center rounded-full -ml-12 mt-5">
|
||||
{{ partial "icon" $icon }}
|
||||
</div>
|
||||
<div class="block p-6 rounded-lg shadow-2xl min-w-full ml-6 mb-10 break-words">
|
||||
<div class="flex justify-between">
|
||||
{{ if $header }}
|
||||
<h2 class="mt-0">{{ $header }}</h2>
|
||||
{{ end }}
|
||||
{{ if $badge }}
|
||||
<h3 class="">
|
||||
{{ partial "badge" $badge }}
|
||||
</h3>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if $subheader }}
|
||||
<h4 class="mt-0">
|
||||
{{ $subheader }}
|
||||
</h4>
|
||||
{{ end }}
|
||||
<div class="mb-6">
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
36
themes/blowfish/layouts/shortcodes/typeit.html
Normal file
36
themes/blowfish/layouts/shortcodes/typeit.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{{- $content := split .Inner "\n" -}}
|
||||
{{- $initialString := .Get "initialString" | default "" -}}
|
||||
{{- $speed := .Get "speed" | default 100 -}}
|
||||
{{- $lifeLike := .Get "lifeLike" | default false -}}
|
||||
{{- $startDelay := .Get "startDelay" | default 0 -}}
|
||||
{{- $breakLines := .Get "breakLines" | default true -}}
|
||||
{{- $waitUntilVisible := .Get "waitUntilVisible" | default true -}}
|
||||
{{- $loop := .Get "loop" | default false -}}
|
||||
{{- $classList := slice -}}
|
||||
{{- with .Get "class" -}}
|
||||
{{- $classList = $classList | append . -}}
|
||||
{{- end -}}
|
||||
{{- $tag := .Get "tag" | default "div" -}}
|
||||
|
||||
{{ $id := delimit (slice "typeit" (partial "functions/uid.html" .)) "-" }}
|
||||
|
||||
{{- $attrs := printf `id="%v"` $id -}}
|
||||
{{- with $classList -}}
|
||||
{{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ printf `<%v %v>%s</%v>` $tag $attrs $initialString $tag | safeHTML }}
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
new TypeIt("#{{ $id }}", {
|
||||
strings: {{ $content }},
|
||||
speed: {{ $speed }},
|
||||
lifeLike: {{ $lifeLike }},
|
||||
startDelay: {{ $startDelay }},
|
||||
breakLines: {{ $breakLines }},
|
||||
waitUntilVisible: {{ $waitUntilVisible }},
|
||||
loop: {{ $loop }}
|
||||
}).go();
|
||||
});
|
||||
</script>
|
||||
6
themes/blowfish/layouts/shortcodes/youtubeLite.html
Normal file
6
themes/blowfish/layouts/shortcodes/youtubeLite.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{- $id := .Get "id" | default "SgXhGb-7QbU" -}}
|
||||
{{- $label := .Get "id" | default "Blowfish" -}}
|
||||
{{- $params := .Get "params" -}}
|
||||
|
||||
|
||||
<lite-youtube videoid="{{ $id }}" playlabel="{{ $label }}" params="{{ $params }}"></lite-youtube>
|
||||
Reference in New Issue
Block a user