mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
Merge branch 'dev' into feat/gist
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
{{ $parent := .Page.RelPermalink }}
|
||||
<section class="space-y-10 w-full">
|
||||
{{ $RelPermalink := .Get "link" }}
|
||||
{{ range ( where .Site.RegularPages "RelPermalink" $RelPermalink | first 1 ) }}
|
||||
{{ if not (eq .RelPermalink $parent) }}
|
||||
{{ partial "article-link/simple.html" . }}
|
||||
{{ end }}
|
||||
{{end}}
|
||||
</section>
|
||||
{{ $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 }}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
{{- $codebergColors := .Site.Data.codebergColors -}}
|
||||
{{- 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">
|
||||
@@ -64,4 +65,5 @@
|
||||
.catch(error => console.error(error))
|
||||
</script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
{{- $forgejoColors := .Site.Data.forgejoColors -}}
|
||||
{{- 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">
|
||||
@@ -64,4 +65,5 @@
|
||||
.catch(error => console.error(error))
|
||||
</script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,31 +1,40 @@
|
||||
{{ $id := delimit (slice "gallery" (partial "functions/uid.html" .)) "-" }}
|
||||
{{ $id := delimit (slice "gallery" (partial "functions/uid.html" .)) "-" -}}
|
||||
|
||||
<div id="{{ $id }}" class="gallery">
|
||||
{{ $page := .Page }}
|
||||
|
||||
{{/* find all img tags */}}
|
||||
{{ $imgTagRegex := `<img\s+[^>]*>` }}
|
||||
{{ $imgTags := findRE $imgTagRegex .Inner }}
|
||||
{{ $newContent := .Inner }}
|
||||
|
||||
{{ range $imgTags }}
|
||||
{{ $imgTag := . }}
|
||||
{{/* extract src attribute */}}
|
||||
{{ $srcRegex := `src=['"]([^'"]+)['"]` }}
|
||||
{{ $srcMatches := findRESubmatch $srcRegex $imgTag }}
|
||||
|
||||
{{ if $srcMatches }}
|
||||
{{ $srcFull := index (index $srcMatches 0) 0 }}
|
||||
{{ $src := index (index $srcMatches 0) 1 }}
|
||||
|
||||
{{ $resource := $page.Resources.GetMatch $src }}
|
||||
{{ if $resource }}
|
||||
{{ $newSrc := printf `src="%s"` $resource.RelPermalink }}
|
||||
{{ $newImg := replace $imgTag $srcFull $newSrc }}
|
||||
{{ $newContent = replace $newContent $imgTag $newImg }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $newContent | safeHTML }}
|
||||
<div id="{{- $id -}}" class="gallery">
|
||||
{{ $page := .Page -}}
|
||||
|
||||
<!-- find all img tags -->
|
||||
{{ $imgTagRegex := `<img\s+[^>]*>` -}}
|
||||
{{ $imgTags := findRE $imgTagRegex .Inner -}}
|
||||
{{ $newContent := .Inner -}}
|
||||
|
||||
{{ range $imgTags -}}
|
||||
{{ $imgTag := . -}}
|
||||
<!-- extract src attribute -->
|
||||
{{ $srcRegex := `src=['"]([^'"]+)['"]` -}}
|
||||
{{ $srcMatches := findRESubmatch $srcRegex $imgTag -}}
|
||||
|
||||
{{ if $srcMatches -}}
|
||||
{{ $srcFull := index (index $srcMatches 0) 0 -}}
|
||||
{{ $src := index (index $srcMatches 0) 1 -}}
|
||||
|
||||
{{ $finalSrc := $src -}}
|
||||
{{ $isExternalURL := or (hasPrefix $src "http://") (hasPrefix $src "https://") -}}
|
||||
|
||||
{{ if $isExternalURL -}}
|
||||
{{ with resources.GetRemote $src -}}{{ $finalSrc = .RelPermalink -}}{{ end -}}
|
||||
{{ else -}}
|
||||
{{ with $page.Resources.GetMatch $src -}}{{ $finalSrc = .RelPermalink -}}
|
||||
{{ else -}}
|
||||
{{ with resources.GetMatch $src -}}{{ $finalSrc = .RelPermalink }}{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ $newSrc := printf `src="%s"` $finalSrc -}}
|
||||
{{ $newImg := replace $imgTag $srcFull $newSrc -}}
|
||||
{{ $newContent = replace $newContent $imgTag $newImg -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ $newContent | safeHTML -}}
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
{{- $giteaColors := .Site.Data.giteaColors -}}
|
||||
{{- 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">
|
||||
@@ -64,4 +65,5 @@
|
||||
.catch(error => console.error(error))
|
||||
</script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}}
|
||||
{{- $githubData := resources.GetRemote $githubURL | transform.Unmarshal -}}
|
||||
{{- $githubColors := .Site.Data.githubColors -}}
|
||||
{{- with $githubData -}}
|
||||
{{- $githubThumbnailURL := print "https://opengraph.githubassets.com/0/" (.Get "repo") -}}
|
||||
|
||||
<div class="github-card-wrapper">
|
||||
|
||||
{{- if (.Get "showThumbnail") -}}
|
||||
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ $githubThumbnailURL }});"></div>
|
||||
{{- end -}}
|
||||
|
||||
{{- with $githubData -}}
|
||||
<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" "github" }}
|
||||
@@ -65,5 +72,6 @@
|
||||
.catch(error => console.error(error))
|
||||
</script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
{{- $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">
|
||||
|
||||
@@ -54,4 +55,5 @@
|
||||
.catch(error => console.error(error))
|
||||
</script>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user