Skip to content

Commit

Permalink
refactor: Rename $Deliver into $ for clarity (#177)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `Deliver` parameter to various templates is now called `$`
  • Loading branch information
palant authored May 26, 2020
1 parent f160158 commit 81a773d
Show file tree
Hide file tree
Showing 37 changed files with 164 additions and 170 deletions.
2 changes: 1 addition & 1 deletion assets/js/lunr-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ window.addEventListener("DOMContentLoaded", event => {

function initIndex() {
let request = new XMLHttpRequest();
request.open("GET", "{{ partial "utils/relative-url.html" (dict "Deliver" . "filename" (((.Site.GetPage "").OutputFormats.Get "SearchIndex").RelPermalink | strings.TrimPrefix "/")) }}");
request.open("GET", "{{ partial "utils/relative-url.html" (dict "$" . "filename" (((.Site.GetPage "").OutputFormats.Get "SearchIndex").RelPermalink | strings.TrimPrefix "/")) }}");
request.responseType = "json";
request.addEventListener("load", function(event) {
let documents = request.response;
Expand Down
6 changes: 3 additions & 3 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h1 class="list-title">{{ .Title | default .Data.Term | default (delimit (last 1
{{ $.Scratch.Set "year" .Key }}
{{ end }}
{{ $year := $.Scratch.Get "year" }}
<h2 class="list-year">{{ $year }}{{ if $.Site.Params.chineseZodiac }}{{ partial "utils/icon.html" (dict "Deliver" $ "name" $zodiacName "class" "chinese-zodiac") }}{{ end }}</h2>
<h2 class="list-year">{{ $year }}{{ if $.Site.Params.chineseZodiac }}{{ partial "utils/icon.html" (dict "$" $ "name" $zodiacName "class" "chinese-zodiac") }}{{ end }}</h2>
{{ if $.Site.Params.groupByMonth }}
{{ range .Pages.GroupByDate "January" }}
{{ $.Scratch.Delete "month" }}
Expand All @@ -82,10 +82,10 @@ <h2 class="list-year">{{ $year }}{{ if $.Site.Params.chineseZodiac }}{{ partial
{{ end }}
{{ $month := $.Scratch.Get "month" }}
<h3 class="list-month">{{ $month }}</h3>
{{ partial "utils/list-item.html" (dict "Deliver" .) }}
{{ partial "utils/list-item.html" (dict "$" .) }}
{{ end }}
{{ else }}
{{ partial "utils/list-item.html" (dict "Deliver" .) }}
{{ partial "utils/list-item.html" (dict "$" .) }}
{{ end }}
{{ end }}
</div>
Expand Down
4 changes: 2 additions & 2 deletions layouts/index.searchindex.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
{{- end -}}
{{- $entry := dict "uri" $page.RelPermalink "title" $page.Title "content" ($page.Plain | htmlUnescape) -}}
{{- if $page.Params.subtitle -}}
{{- $subtitle := partial "utils/markdownify.html" (dict "Deliver" $page "raw" $page.Params.subtitle "isContent" false) -}}
{{- $subtitle := partial "utils/markdownify.html" (dict "$" $page "raw" $page.Params.subtitle "isContent" false) -}}
{{- $entry = merge $entry (dict "subtitle" ($subtitle | plainify)) -}}
{{- end -}}
{{- if .Site.Params.displayPostDescription -}}
{{- $description := partial "utils/markdownify.html" (dict "Deliver" $page "raw" $page.Description "isContent" false) -}}
{{- $description := partial "utils/markdownify.html" (dict "$" $page "raw" $page.Description "isContent" false) -}}
{{- $entry = merge $entry (dict "description" ($description | plainify)) -}}
{{- end -}}
{{- if .Site.Params.displayCategory -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/index.sectionsatom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
<rights>{{ . | plainify }}</rights>
{{- end }}
{{- $summary := .Description | default (partial "utils/summary.html" $page) -}}
<summary type="html">{{ partial "utils/make-links-absolute.html" (dict "Deliver" . "content" $summary) | html }}</summary>
<summary type="html">{{ partial "utils/make-links-absolute.html" (dict "$" . "content" $summary) | html }}</summary>
{{ if $.Site.Params.includeContent }}
<content type="html">{{ partial "utils/make-links-absolute.html" (dict "Deliver" . "content" .Content) | html }}</content>
<content type="html">{{ partial "utils/make-links-absolute.html" (dict "$" . "content" .Content) | html }}</content>
{{ end }}
<!-- Sections -->
{{ if eq $.Site.Params.categoryBy "sections" }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/index.sectionsrss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
<copyright>{{ . | plainify }}</copyright>
{{- end }}
{{ if $.Site.Params.includeContent }}
<description>{{ partial "utils/make-links-absolute.html" (dict "Deliver" . "content" .Content) | html }}</description>
<description>{{ partial "utils/make-links-absolute.html" (dict "$" . "content" .Content) | html }}</description>
{{ else }}
{{- $summary := .Description | default (partial "utils/summary.html" $page) -}}
<description>{{ partial "utils/make-links-absolute.html" (dict "Deliver" . "content" $summary) | html }}</description>
<description>{{ partial "utils/make-links-absolute.html" (dict "$" . "content" $summary) | html }}</description>
{{ end }}
<!-- Sections -->
{{ if eq $.Site.Params.categoryBy "sections" }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/components/back-to-top.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ if or (and .IsHome .Site.Params.displayBackToTopInHome) (and (not .IsHome) .Site.Params.enableBackToTop) }}
<div id="back-to-top" class="back-to-top">
<a href="#">{{ partial "utils/icon.html" (dict "Deliver" . "name" .Site.Params.backToTopIcon) }}</a>
<a href="#">{{ partial "utils/icon.html" (dict "$" . "name" .Site.Params.backToTopIcon) }}</a>
</div>
{{ end }}
4 changes: 2 additions & 2 deletions layouts/partials/components/dark-mode.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{{- $hide := or (and $.IsHome $.Site.Params.hideThemeToggleInHome) (and (not $.IsHome) $.Site.Params.hideThemeToggle) -}}
{{- if not $hide -}}
<a id="theme-switcher" href="#">
{{- partial "utils/icon.html" (dict "Deliver" $ "name" "sun" "class" "theme-icon-light") -}}
{{- partial "utils/icon.html" (dict "Deliver" $ "name" "moon" "class" "theme-icon-dark") -}}
{{- partial "utils/icon.html" (dict "$" $ "name" "sun" "class" "theme-icon-light") -}}
{{- partial "utils/icon.html" (dict "$" $ "name" "moon" "class" "theme-icon-dark") -}}
</a>
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions layouts/partials/components/minimal-footer-about.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{- $linkType := (string .Pre) -}}
{{- $iconName := (string .Post) -}}
{{- $icon := (index $.Site.Data.SVG $iconName) -}}
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>{{ partial "utils/icon.html" (dict "Deliver" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
{{ end }}
</div>
{{ end }}
Expand All @@ -17,7 +17,7 @@
{{- $linkType := (string .Pre) -}}
{{- $iconName := (string .Post) -}}
{{- $icon := (index $.Site.Data.SVG $iconName) -}}
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>{{ partial "utils/icon.html" (dict "Deliver" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
{{ end }}
</div>
{{ end }}
Expand Down
3 changes: 1 addition & 2 deletions layouts/partials/components/post-copyright.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- $Deliver := . -}}
{{ if and .Site.Params.enablePostCopyright (.Params.displayCopyright | default .Site.Params.displayPostCopyright) }}
{{ $author := partial "utils/author.html" . }}
{{ with $author.name }}
Expand All @@ -23,7 +22,7 @@
{{ end }}
{{ with $author.copyright }}
{{- $raw := . -}}
<li class="copyright-item license"><span class="copyright-item-text">{{ i18n "copyrightLicense" }}</span>{{ i18n "colon" }}{{ partial "utils/markdownify.html" (dict "Deliver" $Deliver "raw" $raw "isContent" false) }}</li>
<li class="copyright-item license"><span class="copyright-item-text">{{ i18n "copyrightLicense" }}</span>{{ i18n "colon" }}{{ partial "utils/markdownify.html" (dict "$" $ "raw" $raw "isContent" false) }}</li>
{{ end }}
</ul>
{{ end }}
Expand Down
10 changes: 5 additions & 5 deletions layouts/partials/components/post-gitinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
<div class="gitinfo-item commit">
{{- with .Site.Params.repoURL -}}
<a href="{{ . }}/commit/{{ $.GitInfo.Hash }}" target="_blank" rel="noopener">
{{- partial "utils/icon.html" (dict "Deliver" $ "name" $.Site.Params.gitIcon "class" "git-icon") -}}
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.gitIcon "class" "git-icon") -}}
{{- $.GitInfo.AbbreviatedHash -}}
</a>
{{- else -}}
{{- partial "utils/icon.html" (dict "Deliver" $ "name" $.Site.Params.gitIcon "class" "git-icon") -}}
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.gitIcon "class" "git-icon") -}}
{{- $.GitInfo.AbbreviatedHash -}}
{{- end -}}
</div>
{{ end }}
{{ if .Site.Params.displayCommitMessage }}
{{ with .GitInfo.Subject }}
<div class="gitinfo-item commit-msg">
{{- partial "utils/icon.html" (dict "Deliver" $ "name" $.Site.Params.msgIcon "class" "msg-icon") -}}
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.msgIcon "class" "msg-icon") -}}
{{- . -}}
</div>
{{ end }}
Expand All @@ -32,7 +32,7 @@
{{ with .Site.Params.repoURL }}
<div class="gitinfo-item feedback">
<a href="{{ . }}/issues" target="_blank" rel="noopener">
{{- partial "utils/icon.html" (dict "Deliver" $ "name" $.Site.Params.feedbackIcon "class" "feedback-icon") -}}
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.feedbackIcon "class" "feedback-icon") -}}
{{- $.Site.Params.feedbackText -}}
</a>
</div>
Expand All @@ -43,7 +43,7 @@
{{ $contentDir := (cond $.Site.IsMultiLingual (printf `/%s/` $.Site.Params.contentDir) "/content/") }}
<div class="gitinfo-item edit">
<a href="{{ . }}{{ $contentDir }}{{ $.Path }}" target="_blank" rel="noopener">
{{- partial "utils/icon.html" (dict "Deliver" $ "name" $.Site.Params.editIcon "class" "edit-icon") -}}
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.editIcon "class" "edit-icon") -}}
{{- $.Site.Params.editText -}}
</a>
</div>
Expand Down
Loading

0 comments on commit 81a773d

Please sign in to comment.