mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-22 22:45:42 -06:00
New way to generate UIDs.
This commit is contained in:
parent
08305fe2f7
commit
9cfc07565c
7 changed files with 19 additions and 7 deletions
13
layouts/partials/functions/uid.html
Normal file
13
layouts/partials/functions/uid.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{{ $uid := .Page.RelPermalink }}
|
||||||
|
{{ $ctx := . }}
|
||||||
|
|
||||||
|
{{ range seq 16 }}
|
||||||
|
{{ with $ctx }}
|
||||||
|
{{ $uid = printf "%s-%d" $uid .Ordinal }}
|
||||||
|
{{ $ctx = .Parent }}
|
||||||
|
{{ else }}
|
||||||
|
{{ break }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ return md5 $uid }}
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $id := delimit (slice "carousel" .Ordinal now.UnixNano) "-" }}
|
{{ $id := delimit (slice "carousel" (partial "functions/uid.html" .)) "-" }}
|
||||||
{{ $aspect := default "16-9" (.Get "aspectRatio") }}
|
{{ $aspect := default "16-9" (.Get "aspectRatio") }}
|
||||||
{{ $images := .Page.Resources.Match (.Get "images") }}
|
{{ $images := .Page.Resources.Match (.Get "images") }}
|
||||||
{{ $interval := default "2000" (.Get "interval") }}
|
{{ $interval := default "2000" (.Get "interval") }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $id := delimit (slice "chart" .Ordinal now.UnixNano) "-" }}
|
{{ $id := delimit (slice "chart" (partial "functions/uid.html" .)) "-" }}
|
||||||
<div class="chart">
|
<div class="chart">
|
||||||
<canvas id="{{ $id }}"></canvas>
|
<canvas id="{{ $id }}"></canvas>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{{ $random := delimit (shuffle (seq 1 9)) "" }}
|
{{ $id := delimit (slice "gallery" (partial "functions/uid.html" .)) "-" }}
|
||||||
{{ $id := delimit (slice "gallery" $random now.UnixNano) "-" }}
|
|
||||||
|
|
||||||
<div id="{{ $id }}" class="gallery">
|
<div id="{{ $id }}" class="gallery">
|
||||||
{{ .Inner }}
|
{{ .Inner }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $id := delimit (slice "github" .Ordinal now.UnixNano) "-" }}
|
{{ $id := delimit (slice "github" (partial "functions/uid.html" .)) "-" }}
|
||||||
{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}}
|
{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}}
|
||||||
{{- $githubData := getJSON ($githubURL) -}}
|
{{- $githubData := getJSON ($githubURL) -}}
|
||||||
{{- $githubColors := .Site.Data.githubColors -}}
|
{{- $githubColors := .Site.Data.githubColors -}}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $id := delimit (slice "gitlab" .Ordinal now.UnixNano) "-" }}
|
{{ $id := delimit (slice "gitlab" (partial "functions/uid.html" .)) "-" }}
|
||||||
{{- $gitlabURL := print (default "https://gitlab.com/" (.Get "baseURL")) "api/v4/projects/" (.Get "projectID") -}}
|
{{- $gitlabURL := print (default "https://gitlab.com/" (.Get "baseURL")) "api/v4/projects/" (.Get "projectID") -}}
|
||||||
|
|
||||||
{{- $gitLabData := getJSON ($gitlabURL) -}}
|
{{- $gitLabData := getJSON ($gitlabURL) -}}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $tag := .Get "tag" | default "div" -}}
|
{{- $tag := .Get "tag" | default "div" -}}
|
||||||
|
|
||||||
{{ $id := delimit (slice "typeit" .Ordinal now.UnixNano) "-" }}
|
{{ $id := delimit (slice "typeit" (partial "functions/uid.html" .)) "-" }}
|
||||||
|
|
||||||
{{- $attrs := printf `id="%v"` $id -}}
|
{{- $attrs := printf `id="%v"` $id -}}
|
||||||
{{- with $classList -}}
|
{{- with $classList -}}
|
||||||
|
|
Loading…
Reference in a new issue