diff options
Diffstat (limited to 'themes/blowfish/layouts/shortcodes')
-rw-r--r-- | themes/blowfish/layouts/shortcodes/codeberg.html | 67 | ||||
-rw-r--r-- | themes/blowfish/layouts/shortcodes/codeimporter.html | 8 | ||||
-rw-r--r-- | themes/blowfish/layouts/shortcodes/figure.html | 97 | ||||
-rw-r--r-- | themes/blowfish/layouts/shortcodes/github.html | 6 | ||||
-rw-r--r-- | themes/blowfish/layouts/shortcodes/gitlab.html | 4 | ||||
-rw-r--r-- | themes/blowfish/layouts/shortcodes/mdimporter.html | 4 | ||||
-rw-r--r-- | themes/blowfish/layouts/shortcodes/timeline.html | 2 | ||||
-rw-r--r-- | themes/blowfish/layouts/shortcodes/timelineItem.html | 6 |
8 files changed, 133 insertions, 61 deletions
diff --git a/themes/blowfish/layouts/shortcodes/codeberg.html b/themes/blowfish/layouts/shortcodes/codeberg.html new file mode 100644 index 0000000..bd52323 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/codeberg.html @@ -0,0 +1,67 @@ +{{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }} +{{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}} +{{- $codebergData := getJSON ($codebergURL) -}} +{{- $codebergColors := .Site.Data.codebergColors -}} +{{- with $codebergData -}} + +<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" style="margin-right: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"> + + <span class="mr-1 inline-block h-3 w-3 rounded-full" + style="background-color: {{ if .language }} {{- index $codebergColors .language -}} {{ else }} #0077b6 {{ end }}"></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"> + {{ .stars_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_count }} + </div> + + </div> + + </div> + <script> + fetch({{ $codebergURL }}, { + headers: new Headers({ + 'User-agent': 'Mozilla/4.0 Custom User Agent' + }) + }) + .then(response => response.json()) + .then(data => { + document.getElementById('{{ $id }}-full_name').innerHTML = data.full_name; + document.getElementById('{{ $id }}-description').innerHTML = data.description; + document.getElementById('{{ $id }}-stars_count').innerHTML = data.starts_count; + document.getElementById('{{ $id }}-forks_count').innerHTML = data.forks_count; + }) + .catch(error => console.error(error)) + </script> +</a> +{{- end -}} diff --git a/themes/blowfish/layouts/shortcodes/codeimporter.html b/themes/blowfish/layouts/shortcodes/codeimporter.html new file mode 100644 index 0000000..493f444 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/codeimporter.html @@ -0,0 +1,8 @@ +{{ $url := .Get "url" }} +{{ $type := .Get "type" }} +{{ with resources.GetRemote (urls.Parse $url) }} +{{ $codeBlock := printf "```%s\n%s\n```" $type .Content }} +{{ $codeBlock | markdownify }} +{{ else }} +{{ errorf "Code Importer Shortcode - Unable to get remote resource" . }} +{{ end }} diff --git a/themes/blowfish/layouts/shortcodes/figure.html b/themes/blowfish/layouts/shortcodes/figure.html index 4f641f3..fb7293c 100644 --- a/themes/blowfish/layouts/shortcodes/figure.html +++ b/themes/blowfish/layouts/shortcodes/figure.html @@ -2,54 +2,49 @@ {{ if .Get "default" }} {{ template "_internal/shortcodes/figure.html" . }} {{ else }} - {{ $url := urls.Parse (.Get "src") }} - {{ $altText := .Get "alt" }} - {{ $caption := .Get "caption" }} - {{ $href := .Get "href" }} - {{ $class := .Get "class" }} - {{ $target := .Get "target" }} - {{ $nozoom := .Get "nozoom" | default false }} - {{ if findRE "^https?" $url.Scheme }} - <figure> - <img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" /> - {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} - </figure> - {{ 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 }} - <figure {{ with $class }}class="{{ . }}"{{ end }}> - {{ with $href }}<a href="{{ . }}" {{ with $target }}target="{{ . }}"{{ end }}>{{ end }} - {{ if $disableImageOptimization }} - <img - class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" - src="{{ .RelPermalink }}" - alt="{{ $altText }}" - /> - {{ else }} - <img - class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" - srcset=" - {{ (.Resize "330x").RelPermalink }} 330w, - {{ (.Resize "660x").RelPermalink }} 660w, - {{ (.Resize "1024x").RelPermalink }} 1024w, - {{ (.Resize "1320x").RelPermalink }} 2x" - src="{{ (.Resize "660x").RelPermalink }}" - alt="{{ $altText }}" - /> - {{ end }} - {{ if $href }}</a>{{ end }} - {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} - </figure> - {{ else }} - <figure> - <img class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" /> - {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} - </figure> - {{ end }} - {{ end }} -{{ end }} + {{- $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 }}" + 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 -}} diff --git a/themes/blowfish/layouts/shortcodes/github.html b/themes/blowfish/layouts/shortcodes/github.html index fc0c571..2daecd6 100644 --- a/themes/blowfish/layouts/shortcodes/github.html +++ b/themes/blowfish/layouts/shortcodes/github.html @@ -15,12 +15,12 @@ <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 | emojify }} + {{ .full_name | markdownify }} </div> </div> <p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral"> - {{ .description | markdownify | emojify }} + {{ .description | markdownify }} </p> <div class="m-0 mt-2 flex items-center"> @@ -64,4 +64,4 @@ .catch(error => console.error(error)) </script> </a> -{{- end -}}
\ No newline at end of file +{{- end -}} diff --git a/themes/blowfish/layouts/shortcodes/gitlab.html b/themes/blowfish/layouts/shortcodes/gitlab.html index 1fbe70e..5b6153c 100644 --- a/themes/blowfish/layouts/shortcodes/gitlab.html +++ b/themes/blowfish/layouts/shortcodes/gitlab.html @@ -12,12 +12,12 @@ {{ 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 | emojify }} + {{ .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 | emojify }} + {{ .description | markdownify }} </p> <div class="m-0 mt-2 flex items-center"> diff --git a/themes/blowfish/layouts/shortcodes/mdimporter.html b/themes/blowfish/layouts/shortcodes/mdimporter.html index 28b24fe..18b87bd 100644 --- a/themes/blowfish/layouts/shortcodes/mdimporter.html +++ b/themes/blowfish/layouts/shortcodes/mdimporter.html @@ -1,6 +1,6 @@ {{ $url := .Get "url"}} -{{ with resources.GetRemote (printf $url) }} +{{ with resources.GetRemote (urls.Parse $url) }} {{ .Content | markdownify }} {{ else }} {{ errorf "Mardown Importer Shortcode - Unable to get remote resource" . }} -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/themes/blowfish/layouts/shortcodes/timeline.html b/themes/blowfish/layouts/shortcodes/timeline.html index 27ee729..c97673d 100644 --- a/themes/blowfish/layouts/shortcodes/timeline.html +++ b/themes/blowfish/layouts/shortcodes/timeline.html @@ -1,3 +1,3 @@ -<ol class="border-l-2 list-none border-primary-500 dark:border-primary-300"> +<ol class="border-l-2 border-primary-500 dark:border-primary-300 list-none"> {{- .Inner -}} </ol>
\ No newline at end of file diff --git a/themes/blowfish/layouts/shortcodes/timelineItem.html b/themes/blowfish/layouts/shortcodes/timelineItem.html index 8297b6c..294b411 100644 --- a/themes/blowfish/layouts/shortcodes/timelineItem.html +++ b/themes/blowfish/layouts/shortcodes/timelineItem.html @@ -3,7 +3,7 @@ {{ $badge := .Get "badge" }} {{ $subheader := .Get "subheader" }} {{ $text := .Get "text" }} -<li class="list-none"> +<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 }} @@ -26,7 +26,9 @@ {{ $subheader }} </h4> {{ end }} - <p class="text-gray-700 mb-6">{{- .Inner -}}</p> + <div class="mb-6"> + {{- .Inner -}} + </div> </div> </div> </li> |