@thegetty/quire-cli 0.20.1 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/bin/.DS_Store +0 -0
  3. package/bin/go-iiif/.DS_Store +0 -0
  4. package/bin/index.js +1 -1
  5. package/bin/starters/.DS_Store +0 -0
  6. package/bin/starters/default/.gitignore +14 -0
  7. package/bin/starters/default/config/_default/config.yml +53 -0
  8. package/bin/starters/default/config/development/config.yml +14 -0
  9. package/bin/themes/default/.gitignore +13 -0
  10. package/bin/themes/default/layouts/contents/single.html +2 -2
  11. package/bin/themes/default/layouts/data/search-index.html +1 -1
  12. package/bin/themes/default/layouts/partials/cite-this.html +2 -2
  13. package/bin/themes/default/layouts/partials/contents-list/closing-tags.html +10 -3
  14. package/bin/themes/default/layouts/partials/contents-list/contents-list.html +24 -9
  15. package/bin/themes/default/layouts/partials/contents-list/file-dir.html +7 -0
  16. package/bin/themes/default/layouts/partials/contents-list/file-path.html +10 -0
  17. package/bin/themes/default/layouts/partials/contents-list.html +207 -0
  18. package/bin/themes/default/layouts/partials/figure-caption.html +1 -0
  19. package/bin/themes/default/layouts/partials/figure-fallback.html +31 -0
  20. package/bin/themes/default/layouts/partials/figure-image.html +44 -0
  21. package/bin/themes/default/layouts/partials/figure-label.html +15 -0
  22. package/bin/themes/default/layouts/partials/figure-soundcloud.html +25 -0
  23. package/bin/themes/default/layouts/partials/figure-table.html +44 -0
  24. package/bin/themes/default/layouts/partials/figure-vimeo.html +24 -0
  25. package/bin/themes/default/layouts/partials/figure-website.html +21 -0
  26. package/bin/themes/default/layouts/partials/figure-youtube.html +23 -0
  27. package/bin/themes/default/layouts/partials/figures/media-types/vimeo.html +3 -1
  28. package/bin/themes/default/layouts/partials/menu.html +1 -1
  29. package/bin/themes/default/layouts/partials/page-bibliography.html +1 -1
  30. package/bin/themes/default/layouts/shortcodes/q-bibliography.html +8 -8
  31. package/bin/themes/default/layouts/shortcodes/q-figure-new.html +70 -0
  32. package/bin/themes/default/package-lock.json +13198 -0
  33. package/bin/themes/default/source/css/components/quire-contents-list.scss +22 -18
  34. package/bin/themes/default/source/css/print.scss +1 -1
  35. package/bin/themes/default/source/js/popup.js +14 -10
  36. package/bin/themes/default/static/img/icons/baseline-headset-24px.png +0 -0
  37. package/bin/themes/default/static/img/icons/baseline-videocam-24px.png +0 -0
  38. package/bin/themes/default/static/img/icons/baseline-website-24px.png +0 -0
  39. package/bin/themes/default/tests/.gitkeep +0 -0
  40. package/bin/themes/default/tests/e2e/.eslintrc.js +9 -0
  41. package/bin/themes/default/tests/e2e/fixtures/blns.json +483 -0
  42. package/bin/themes/default/tests/e2e/plugins/index.js +22 -0
  43. package/bin/themes/default/tests/e2e/specs/quire-contents.spec.js +52 -0
  44. package/bin/themes/default/tests/e2e/specs/quire-contributors.spec.js +66 -0
  45. package/bin/themes/default/tests/e2e/specs/quire-entry.spec.js +104 -0
  46. package/bin/themes/default/tests/e2e/specs/quire-essay.spec.js +105 -0
  47. package/bin/themes/default/tests/e2e/specs/quire-menu.spec.js +38 -0
  48. package/bin/themes/default/tests/e2e/specs/quire-modal.spec.js +69 -0
  49. package/bin/themes/default/tests/e2e/specs/quire-next-back-buttons.spec.js +27 -0
  50. package/bin/themes/default/tests/e2e/specs/quire-page.spec.js +28 -0
  51. package/bin/themes/default/tests/e2e/specs/quire-search.spec.js +48 -0
  52. package/bin/themes/default/tests/e2e/specs/quire-splash.spec.js +38 -0
  53. package/bin/themes/default/tests/e2e/support/commands.js +25 -0
  54. package/bin/themes/default/tests/e2e/support/index.js +20 -0
  55. package/package.json +1 -1
  56. package/bin/themes/default/static/css/application.css +0 -12072
  57. package/bin/themes/default/static/js/application.js +0 -92
Binary file
@@ -0,0 +1,14 @@
1
+ # Quire starter project ignored files
2
+ .DS_Store
3
+ .bundle
4
+ .cache
5
+ .sass-cache
6
+ .tmp
7
+ build
8
+ node_modules
9
+ public
10
+ site
11
+ themes/default/static/css/application.css
12
+ themes/default/static/js/application.js
13
+ themes/default/test-results/
14
+ themes/default/tests/e2e/
@@ -0,0 +1,53 @@
1
+ # ==============================================================================
2
+ # Config.yml
3
+ # ------------------------------------------------------------------------------
4
+ #
5
+ # This is the main configuration file for the website. The 'theme' value should
6
+ # match the name of the folder in /themes that contains your theme files; if
7
+ # you've copied the default theme and given it a different name make sure to
8
+ # update the value here too.
9
+
10
+ baseURL: ""
11
+
12
+ title: "Quire Starter"
13
+ languageCode: "en-us"
14
+ theme: "default"
15
+ publishDir: site
16
+
17
+ footnoteReturnLinkContents: "↩"
18
+ metaDataFormat: "yaml"
19
+ GoogleAnalytics: ""
20
+
21
+ pluralizeListTitles: true
22
+ disableKinds:
23
+ - "home"
24
+ - "section"
25
+ - "taxonomy"
26
+ - "taxonomyTerm"
27
+
28
+ markup:
29
+ goldmark:
30
+ renderer:
31
+ unsafe: true # allows HTML tags within Markdown file
32
+
33
+ # These values can be accessed in templates via .Site.Params
34
+ params:
35
+ searchEnabled: true
36
+ licenseIcons: true
37
+ pageLabelDivider: ". "
38
+ citationPageLocationDivider: ", "
39
+ contributorByline: name-title # name | name-title | false
40
+ displayBiblioShort: true
41
+ biblioHeading: "Bibliography"
42
+ imageDir: "img"
43
+ tocType: full
44
+ menuType: full
45
+ prevPageButtonText: "Back"
46
+ nextPageButtonText: "Next"
47
+ entryPageSideBySideLayout: false
48
+ entryPageObjectLinkText: "View in Collection"
49
+ figureLabelLocation: on-top # below | on-top
50
+ figureModal: true
51
+ figureModalIcons: true
52
+ figureZoom: true
53
+ citationPopupStyle: text # text | icon
@@ -0,0 +1,14 @@
1
+ # ==============================================================================
2
+ # development environment config.yml
3
+ # ------------------------------------------------------------------------------
4
+ #
5
+ # Development-specific values. Hugo supports multiple config files with the
6
+ # following syntax:
7
+ #
8
+ # hugo --config=base.toml,child1.toml,child2.toml
9
+ #
10
+ # If you are using the Quire commands, this will happen automatically.
11
+
12
+ baseURL: ""
13
+ relativeURLs: true
14
+ buildDrafts: true
@@ -0,0 +1,13 @@
1
+ .DS_Store
2
+ .bundle
3
+ .cache
4
+ .sass-cache
5
+ build
6
+ static/css/application.css
7
+ static/js/application.js
8
+ Gemfile.lock
9
+ node_modules
10
+ .tmp
11
+ tests/e2e/videos/
12
+ tests/e2e/screenshots/
13
+ test-results/
@@ -23,10 +23,10 @@
23
23
  <div class="container {{ if in $class "grid" }}is-fullhd{{ end }}">
24
24
  <div class="quire-contents-list {{ if in $class "grid" }} grid{{ else if in $class "abstract" }} abstract{{ else if in $class "brief" }} brief{{ else }} list{{ end }}">
25
25
  {{ if .Section }}
26
- {{ $scope := where .Site.Pages "Section" .Section }}
26
+ {{ $scope := .File.Dir }}
27
27
  {{- partial "contents-list/contents-list.html" (dict "site" .Site "contentsScope" $scope "contentsLocation" ".Params.toc" "contentsPage" . ) -}}
28
28
  {{ else }}
29
- {{ $scope := .Site.Pages }}
29
+ {{ $scope := "" }}
30
30
  {{- partial "contents-list/contents-list.html" (dict "site" .Site "contentsScope" $scope "contentsLocation" ".Params.toc" "contentsPage" . ) -}}
31
31
  {{ end }}
32
32
  </div>
@@ -38,7 +38,7 @@ block-scoped .Scratch inside the `range` loop.
38
38
  {{- .Scratch.Set "pageType" "" -}}
39
39
  {{- .Scratch.Set "pageLength" "" -}}
40
40
 
41
- {{- if gt (len $page.Content) 0 -}}
41
+ {{- if $page.Content -}}
42
42
  {{- .Scratch.Set "searchContent" $page.Plain -}}
43
43
  {{- .Scratch.Set "pageURL" $page.Permalink -}}
44
44
  {{- .Scratch.Set "pageType" $page.Type -}}
@@ -36,7 +36,7 @@
36
36
 
37
37
  {{- if eq $citationRange "page" -}}
38
38
 
39
- {{ if .page.Params.contributor }}{{ template "page-contributors-chicago" .page }}. {{ end }}{{ if .page.Title }}“{{ partial "page-title.html" .page }}.” {{ else if .page.Params.label }}“{{ .page.Params.label }}.” {{ else }}Untitled. {{ end }}In <em>{{ partial "site-title.html" .page }}</em>{{ if gt $siteAuthorCount 0 }}, {{ if gt $siteEditorCount 0 }}edited {{ end }}by {{ template "publication-contributors-chicago" .page }}{{ end }}. {{ template "publishers-chicago" (dict "site" .site)}}{{ with .site.Data.publication.pub_date }}, {{ dateFormat "2006" . }}{{ end }}. <span class="url-string">{{ if .site.Data.publication.identifier.url }}{{ .site.Data.publication.identifier.url }}{{ .page.RelPermalink }}{{ else }}{{ .page.Permalink }}{{ end }}</span>.
39
+ {{ if .page.Params.contributor }}{{ template "page-contributors-chicago" .page }}. {{ end }}{{ if .page.Title }}“{{ partial "page-title.html" .page | markdownify }}.” {{ else if .page.Params.label }}“{{ .page.Params.label }}.” {{ else }}Untitled. {{ end }}In <em>{{ partial "site-title.html" .page }}</em>{{ if gt $siteAuthorCount 0 }}, {{ if gt $siteEditorCount 0 }}edited {{ end }}by {{ template "publication-contributors-chicago" .page }}{{ end }}. {{ template "publishers-chicago" (dict "site" .site)}}{{ with .site.Data.publication.pub_date }}, {{ dateFormat "2006" . }}{{ end }}. <span class="url-string">{{ if .site.Data.publication.identifier.url }}{{ .site.Data.publication.identifier.url }}{{ .page.RelPermalink }}{{ else }}{{ .page.Permalink }}{{ end }}</span>.
40
40
 
41
41
  {{- else if eq $citationRange "site" -}}
42
42
 
@@ -49,7 +49,7 @@
49
49
 
50
50
  {{- if eq $citationRange "page" -}}
51
51
 
52
- {{ if .page.Params.contributor }}{{ template "page-contributors-mla" .page }}. {{ end }}{{ if .page.Title }}“{{ partial "page-title.html" .page }}.” {{ else if .page.Params.label }}“{{ .page.Params.label }}.” {{ else }}Untitled. {{ end }}<em>{{ partial "site-title.html" .page }}</em>{{ if gt $siteAuthorCount 0 }}, {{ if gt $siteEditorCount 0 }}edited {{ end }}by {{ template "publication-contributors-mla" .page }}{{ end }}. {{ template "publishers-mla" (dict "site" .site)}}{{ with .site.Data.publication.pub_date }}, {{ dateFormat "2006" . }}{{ end }}. <span class="url-string">{{ if .site.Data.publication.identifier.url }}{{ .site.Data.publication.identifier.url }}{{ .page.RelPermalink }}{{ else }}{{ .page.Permalink }}{{ end }}</span>. Accessed <span class="cite-current-date">DD Mon. YYYY</span>.
52
+ {{ if .page.Params.contributor }}{{ template "page-contributors-mla" .page }}. {{ end }}{{ if .page.Title }}“{{ partial "page-title.html" .page | markdownify }}.” {{ else if .page.Params.label }}“{{ .page.Params.label }}.” {{ else }}Untitled. {{ end }}<em>{{ partial "site-title.html" .page }}</em>{{ if gt $siteAuthorCount 0 }}, {{ if gt $siteEditorCount 0 }}edited {{ end }}by {{ template "publication-contributors-mla" .page }}{{ end }}. {{ template "publishers-mla" (dict "site" .site)}}{{ with .site.Data.publication.pub_date }}, {{ dateFormat "2006" . }}{{ end }}. <span class="url-string">{{ if .site.Data.publication.identifier.url }}{{ .site.Data.publication.identifier.url }}{{ .page.RelPermalink }}{{ else }}{{ .page.Permalink }}{{ end }}</span>. Accessed <span class="cite-current-date">DD Mon. YYYY</span>.
53
53
 
54
54
  {{- else if eq $citationRange "site" -}}
55
55
 
@@ -1,7 +1,14 @@
1
1
  {{/* If the .File.Dir of the current page matches the START of the .File.Dir of the next page, we’re still in the same section, so do nothing. Otherwise proceed to next section to add the appropriate number of closing /ul/li tags to close section(s)
2
2
  --------------------------------------------------------------------------- */}}
3
- {{- $currentPageDirectory := (index .AllPages .PageIndex).File.Dir -}}
4
- {{- $nextPageDirectory := (index .AllPages (add .PageIndex 1)).File.Dir -}}
3
+ {{- $currentPage := (index .AllPages .PageIndex).File.Dir -}}
4
+ {{- $currentPageDirectory := partial "contents-list/file-dir.html" $currentPage -}}
5
+
6
+ {{- $nextPage := (index .AllPages (add .PageIndex 1)).File.Dir -}}
7
+ {{- $nextPageDirectory := "" -}}
8
+ {{- if $nextPage }}
9
+ {{- $nextPageDirectory = partial "contents-list/file-dir.html" $nextPage -}}
10
+ {{- end -}}
11
+
5
12
  {{- $findPattern := printf "%s%s" "^" $currentPageDirectory -}}
6
13
 
7
14
  {{- if (findRE $findPattern $nextPageDirectory) -}}
@@ -13,7 +20,7 @@
13
20
  {{/* Find the last page within the same .File.Dir as the current page, if the current page IS the last page, we need to add at least one set of closing /ul/li tags. to determine how many sets of tags are needed, check the sub-section level difference between the current page and the next page. For example, a page with a file directory of `section/sub-section/sub-sub-section/` is at sub-section level of 3. If the next page is at `section/`, with sub-section level of 1, there are 2 levels of difference between them and so we need 2 sets of closing tags. (We use a findRE pattern to count the number of instances of one or more characters followed by a slash in the .File.Dir to determine the sub-section level.)
14
21
  ------------------------------------------------------------------------- */}}
15
22
  {{- $currentPageID := .Page.File.UniqueID -}}
16
- {{- $pagesInSection := where .AllPages "File.Dir" "eq" $currentPageDirectory -}}
23
+ {{- $pagesInSection := where .AllPages "File.Dir" "eq" $currentPage -}}
17
24
  {{- $openSections := .openSections -}}
18
25
 
19
26
  {{- range last 1 $pagesInSection -}}
@@ -45,7 +45,7 @@
45
45
  {{/* List pages, but remove data pages, those hidden from toc/menu, and those hidden from specific output formats as needed
46
46
  --------------------------------------------------------------------------- */}}
47
47
  {{- $pages := "" -}}
48
- {{- $pages = where .contentsScope ".Kind" "page" -}}
48
+ {{- $pages = where .site.Pages ".Kind" "page" -}}
49
49
  {{- $pages = where $pages ".Type" "!=" "data" -}}
50
50
  {{- $pages = where $pages .contentsLocation "!=" "false" -}}
51
51
  {{- if eq .site.Params.pdf true -}}
@@ -63,11 +63,14 @@
63
63
  {{- $pageOne = .Weight -}}
64
64
  {{- end -}}
65
65
 
66
- {{- $class := "" -}}
66
+ {{- $contentsPageClass := "" -}}
67
+ {{- $contentsPageID := "" -}}
67
68
  {{- if eq .contentsLocation ".Params.toc" -}}
68
- {{- $class = .contentsPage.Params.class -}}
69
+ {{- $contentsPageClass = .contentsPage.Params.class -}}
70
+ {{- $contentsPageID = .contentsPage.File.UniqueID -}}
69
71
  {{- else -}}
70
- {{- $class = .site.Params.menuClass -}}
72
+ {{- $contentsPageClass = .site.Params.menuClass -}}
73
+ {{- $contentsPageID = "" -}}
71
74
  {{- end -}}
72
75
 
73
76
  {{/* This contents list is built based on the number of section levels any given page is at, which is determined by looking at its File.Dir.
@@ -82,12 +85,17 @@ In order to properly close the /ul/li elements and nest sub-sections, the logic
82
85
 
83
86
  {{- $lastSection := "/" -}}
84
87
  {{- $openSections := dict -}}
85
- {{- $renderedSections := "/" -}}
88
+ {{- $renderedSections := "" -}}
89
+ {{- if .contentsScope -}}
90
+ {{- $renderedSections = partial "contents-list/file-dir.html" .contentsScope -}}
91
+ {{- end -}}
92
+ {{- $contentsScopePattern := printf "%s%s" "^" $renderedSections -}}
93
+ {{- $contentsPageID := .contentsPage.File.UniqueID -}}
86
94
 
87
95
  <ul>
88
96
  {{- range $index, $page := $pages -}}
89
97
 
90
- {{- $section := .File.Dir -}}
98
+ {{- $section := partial "contents-list/file-dir.html" .File.Dir -}}
91
99
  {{- $sectionLevel := len (findRE "(.+?)/" $section) -}}
92
100
  {{- $sameAsOpenSection := false -}}
93
101
 
@@ -101,6 +109,11 @@ In order to properly close the /ul/li elements and nest sub-sections, the logic
101
109
  {{- end -}}
102
110
  {{- $openSections = merge $openSections (dict $sectionLevelKey $section) -}}
103
111
 
112
+ {{/* Check to make sure the page is within the section that the contents list is being rendederd in (the "contents scope"). If it is, and it’s not also the contents page itself, render the list item for it.
113
+ ------------------------------------------------------------------------- */}}
114
+ {{- $pageWithinThisScope := findRE $contentsScopePattern $section -}}
115
+ {{- if and $pageWithinThisScope (or (eq $contentsLocation ".Params.menu") (and (eq $contentsLocation ".Params.toc") (ne $contentsPageID .File.UniqueID))) -}}
116
+
104
117
  {{- if and (ne $lastSection $section) (eq $sameAsOpenSection false) -}}
105
118
 
106
119
  {{/* This checks all of the parent sections/directories of the current page to see if they've already been rendered in the contents list, if they haven’t a heading is added for each. This is needed in the case where sections don’t have their own child pages and so would have been be skipped over and not rendered without this specific check. Based on the number of levels deep the page is, parent sections are checked one at a time, from the top-most, to the most direct: xxxx/..../..../page
@@ -142,17 +155,17 @@ In order to properly close the /ul/li elements and nest sub-sections, the logic
142
155
  ------------------------------------------------------------------- */}}
143
156
  {{- partial "contents-list/section-heading" (dict "Section" $section "Level" (sub $sectionLevel 1) ) -}}
144
157
 
145
- <li class="page-item level-{{ $sectionLevel }}{{ if lt .Page.Weight $pageOne }} frontmatter-page{{ end }}">{{ partial "contents-list/list-item-type" (dict "Page" . "Class" $class) }}</li>
158
+ <li class="page-item level-{{ $sectionLevel }}{{ if lt .Page.Weight $pageOne }} frontmatter-page{{ end }}">{{ partial "contents-list/list-item-type" (dict "Page" . "Class" $contentsPageClass) }}</li>
146
159
  {{ partial "contents-list/closing-tags" (dict "Page" . "AllPages" $pages "PageIndex" $index "openSections" $openSections) -}}
147
160
 
148
161
  {{- else -}}
149
- <li class="section-item level-{{ if eq .Slug "." }}{{ sub $sectionLevel 1 }}{{ else }}{{ $sectionLevel }}{{ end }}{{ if lt .Page.Weight $pageOne }} frontmatter-page{{ end }}">{{ partial "contents-list/list-item-type" (dict "Page" . "Class" $class) }}
162
+ <li class="section-item level-{{ if eq .Slug "." }}{{ sub $sectionLevel 1 }}{{ else }}{{ $sectionLevel }}{{ end }}{{ if lt .Page.Weight $pageOne }} frontmatter-page{{ end }}">{{ partial "contents-list/list-item-type" (dict "Page" . "Class" $contentsPageClass) }}
150
163
  <ul>
151
164
  {{- end -}}
152
165
 
153
166
  {{- else -}}
154
167
 
155
- <li class="page-item level-{{ $sectionLevel }}{{ if lt .Page.Weight $pageOne }} frontmatter-page{{ end }}">{{ partial "contents-list/list-item-type" (dict "Page" . "Class" $class) }}</li>
168
+ <li class="page-item level-{{ $sectionLevel }}{{ if lt .Page.Weight $pageOne }} frontmatter-page{{ end }}">{{ partial "contents-list/list-item-type" (dict "Page" . "Class" $contentsPageClass) }}</li>
156
169
  {{ partial "contents-list/closing-tags" (dict "Page" . "AllPages" $pages "PageIndex" $index "openSections" $openSections) -}}
157
170
 
158
171
  {{- end -}}
@@ -160,5 +173,7 @@ In order to properly close the /ul/li elements and nest sub-sections, the logic
160
173
  {{- $lastSection = $section -}}
161
174
  {{- $renderedSections = delimit (uniq (slice $renderedSections $section)) ", " -}}
162
175
 
176
+ {{- end -}}
177
+
163
178
  {{- end -}}
164
179
  </ul>
@@ -0,0 +1,7 @@
1
+ {{/* Uses the Hugo `path.Dir` function to return the given path's directory and normalize it, making it consistent for both Windows and macOS/Linux/Unix users
2
+ --------------------------------------------------------------------------- */}}
3
+ {{- $fileDir := path.Dir . -}}
4
+ {{- if ne $fileDir "/" -}}
5
+ {{- $fileDir = printf "%s%s" $fileDir "/" -}}
6
+ {{- end -}}
7
+ {{- return $fileDir -}}
@@ -0,0 +1,10 @@
1
+ {{/* Converts the given .File.Dir to a path that uses forward slashes to make it consistent for both Windows and macOS/Linux/Unix users
2
+ --------------------------------------------------------------------------- */}}
3
+ {{- $filePath := path.Dir . -}}
4
+ {{- $foo := printf "%s%s" "Foo: " $filePath -}}
5
+ {{ $foo }}
6
+ {{- $filePath = printf "%s%s" $filePath "/" -}}
7
+ {{- $gradoo := printf "%s%s" "Gradoo: " $filePath -}}
8
+ {{ $gradoo }}
9
+ {{- $filePath = replaceRE "//" "/" $filePath -}}
10
+ {{- return $filePath -}}
@@ -0,0 +1,207 @@
1
+ {{/*
2
+ This partial generates a contents list. It is used in the publication menu
3
+ and in the "contents" page type, but could be extended for further use. It
4
+ expects five specific variables to be passed:
5
+
6
+ site .Site
7
+ contentsScope Typically .Site.Pages or narrowed down to pages within a
8
+ specific section.
9
+ contentsType Must be either "short" or "full". Often defined in
10
+ config.yml. Short doesn't display any sub-section pages.
11
+ contentsLocation Must be either ".Params.menu" or ".Params.toc". Determines
12
+ in what context the partial is being shown so that
13
+ individual pages can be hidden as called for. For example,
14
+ if contentsLocation is "toc" any pages in the publication
15
+ with "toc: false" will be omitted from the generated
16
+ contents list. The "menu" option also shows a shorter
17
+ version of each page in the list, with no subtitle or
18
+ contributors.
19
+ contentsPage Typically . This just passes the page context through to
20
+ allow a Scratch variable to be set when creating sections.
21
+
22
+ Content can either be in top-level files in the `content` directory, or
23
+ in sub-directories to create sections. Currently, nested sections are not
24
+ supported.
25
+
26
+ For users to cstomize their publiction, this partial response to `class` values in the page YAML as well.
27
+
28
+ `grid` A grid of cards, using images defined in indivudal page
29
+ yaml when avaialble
30
+
31
+ `abstract` Title and contributor headings, and a page abstract
32
+ if one is provided, or the page Summary. If `abstract` is
33
+ an empty value `""`, no abstract or summary will be shown
34
+ in the contents list.
35
+
36
+ `list` Lists the title, subtitle and contributors as included. The
37
+ default value, if no `class` is specified.
38
+
39
+ `brief` Lists only the title, or short_title when available.
40
+
41
+ EXAMPLE PARTIAL USE:
42
+ partial "contents-list.html" (dict "site" .Site "contentsScope" .Site.Pages
43
+ "contentsType" .Site.Params.tocType "contentsLocation" ".Params.toc"
44
+ "contentsPage" . )
45
+
46
+ */}}
47
+
48
+ {{- $contentsType := .contentsType }}
49
+ {{ $contentsLocation := .contentsLocation }}
50
+ {{ $imageDir := .imageDir -}}
51
+
52
+ {{- .contentsPage.Scratch.Set "renderedSection" "" -}}
53
+
54
+ {{/* Start a list of pages, but remove data & those hidden from toc/menu */}}
55
+ {{/* ---------------------------------------------------------------------- */}}
56
+ {{ $pages := where .contentsScope ".Kind" "page" }}
57
+ {{ $pages := where $pages ".Type" "!=" "data" }}
58
+ {{ $pages := where $pages .contentsLocation "!=" "false" }}
59
+
60
+ {{/* Remove pages based on output type */}}
61
+ {{/* ---------------------------------------------------------------------- */}}
62
+ {{- if eq .site.Params.pdf true -}}
63
+ {{ $pages := where $pages "Params.pdf" "!=" "false" }}
64
+ {{ $.contentsPage.Scratch.Set "pages" $pages }}
65
+ {{- else if eq .site.Params.epub true -}}
66
+ {{ $pages := where $pages "Params.epub" "!=" "false" }}
67
+ {{ $.contentsPage.Scratch.Set "pages" $pages }}
68
+ {{- else -}}
69
+ {{ $pages := where $pages "Params.online" "!=" "false" }}
70
+ {{ $.contentsPage.Scratch.Set "pages" $pages }}
71
+ {{- end -}}
72
+ {{ $pages := $.contentsPage.Scratch.Get "pages" }}
73
+ {{ $.contentsPage.Scratch.Delete "pages" }}
74
+
75
+ {{- range first 1 (where $pages "Params.class" "in" "page-one") -}}
76
+ {{- $.contentsPage.Scratch.Set "pageOneWeight" .Weight -}}
77
+ {{- end -}}
78
+
79
+ <ul>
80
+ {{- range $pages -}}
81
+ {{- if or (eq .Section "") (and (ne $.contentsPage.Section "") (ne $.contentsLocation ".Params.menu" )) -}}
82
+
83
+ {{- if eq $.contentsLocation ".Params.menu" }}
84
+ <li class="page-item">{{ template "contents-item-menu" . -}}</li>
85
+ {{ end -}}
86
+
87
+ {{- if and (eq $.contentsLocation ".Params.toc") (ne $.contentsPage.File.UniqueID .File.UniqueID) }}
88
+ <li class="page-item">{{ template "contents-item-toc" (dict "class" $.contentsPage.Params.class "Page" . "Site" .Site "pageOne" ($.contentsPage.Scratch.Get "pageOneWeight") ) -}}</li>
89
+ {{ end -}}
90
+
91
+ {{- else if and .Section (ne .Section ($.contentsPage.Scratch.Get "renderedSection")) -}}
92
+
93
+ {{- $.contentsPage.Scratch.Set "renderedSection" .Section -}}
94
+
95
+ {{- if eq .Params.slug "." -}}
96
+ {{- if eq $.contentsLocation ".Params.menu" }}
97
+ <li class="section-item">{{ template "contents-item-menu" . -}}
98
+ {{- end -}}
99
+ {{- if and (eq $.contentsLocation ".Params.toc") (ne $.contentsPage.File.UniqueID .File.UniqueID) }}
100
+ <li class="section-item">{{ template "contents-item-toc" (dict "class" $.contentsPage.Params.class "Page" . "Site" .Site "pageOne" ($.contentsPage.Scratch.Get "pageOneWeight") ) -}}
101
+ {{- end -}}
102
+ {{- else -}}
103
+
104
+ {{- range first 1 (where $pages "Section" .Section) }}
105
+ <li class="section-item no-landing">{{ if and (eq $.contentsLocation ".Params.menu") (eq $contentsType "short") }}<a href="{{ .Permalink | relURL }}"{{- if lt .Weight ($.contentsPage.Scratch.Get "pageOneWeight") }} class="frontmatter-page"{{ end }}>{{ .Section | title }}</a>{{ else }}<div class="list-header">{{ .Section | humanize | title }}</div>{{ end -}}
106
+ {{- end -}}
107
+
108
+ {{- end -}}
109
+
110
+ {{- if eq $contentsType "full" -}}
111
+ <ul>
112
+ {{- range where $pages "Section" .Section -}}
113
+ {{ if ne .Params.slug "." -}}
114
+ {{ if eq $.contentsLocation ".Params.menu" }}
115
+ <li class="page-item">{{ template "contents-item-menu" . -}}</li>
116
+ {{ else }}
117
+ <li class="page-item">{{ template "contents-item-toc" (dict "class" $.contentsPage.Params.class "Page" . "Site" .Site "pageOne" ($.contentsPage.Scratch.Get "pageOneWeight") ) -}}</li>
118
+ {{ end -}}
119
+ {{ end -}}
120
+ {{- end -}}
121
+ </ul>
122
+ {{- end -}}
123
+
124
+ </li>
125
+
126
+ {{- end -}}
127
+ {{- end -}}
128
+ </ul>
129
+
130
+ {{- define "contents-item-toc" }}
131
+ {{ if isset $.Site.Params "imagedir" }}
132
+ {{ $.Page.Scratch.Set "imageDir" $.Site.Params.imageDir }}
133
+ {{ else }}
134
+ {{ $.Page.Scratch.Set "imagedir" "" }}
135
+ {{- end -}}
136
+ {{- if in .class "grid" -}}
137
+ <a href="{{ .Page.Permalink | relURL }}"{{- if lt .Page.Weight .pageOne }} class="frontmatter-page"{{ end }}><div class="card {{ if or .Page.Params.image .Page.Params.object }}image{{ else }}no-image{{ end }}{{ if and (ne .Page.Section "") (eq .Page.Slug ".") }} slug-page{{ end }}">
138
+ {{ if .Page.Params.image }}
139
+ {{ $imgPath := printf "%s/%s" ($.Page.Scratch.Get "imageDir") .Page.Params.image }}
140
+ <div class="card-image">
141
+ <figure class="image">
142
+ <img src="{{ $imgPath | relURL }}" alt="" />
143
+ </figure>
144
+ </div>
145
+ {{ else if .Page.Params.object -}}
146
+ {{ range .Page.Params.object -}}
147
+ {{ if .id -}}
148
+ {{ range where $.Site.Data.objects.object_list "id" "eq" .id -}}
149
+ {{ range first 1 .figure -}}
150
+ {{ if .id -}}
151
+ {{ range where $.Site.Data.figures.figure_list "id" "eq" .id -}}
152
+ {{ template "contents-image" (dict "imageDir" ($.Page.Scratch.Get "imageDir") "figure" . ) -}}
153
+ {{- end -}}
154
+ {{ else if .src -}}
155
+ {{ template "contents-image" (dict "imageDir" ($.Page.Scratch.Get "imageDir") "figure" . ) -}}
156
+ {{- end -}}
157
+ {{- end -}}
158
+ {{- end -}}
159
+ {{ else if .figure -}}
160
+ {{ range first 1 .figure -}}
161
+ {{ if .id -}}
162
+ {{ range where $.Site.Data.figures.figure_list "id" "eq" .id -}}
163
+ {{ template "contents-image" (dict "imageDir" ($.Page.Scratch.Get "imageDir") "figure" . ) -}}
164
+ {{- end -}}
165
+ {{ else if .src -}}
166
+ {{ template "contents-image" (dict "imageDir" ($.Page.Scratch.Get "imageDir") "figure" . ) -}}
167
+ {{- end -}}
168
+ {{- end -}}
169
+ {{- end -}}
170
+ {{- end -}}
171
+ {{- end -}}
172
+ <div class="card-content">
173
+ <div class="title">
174
+ {{- with .Page.Params.label }}{{ . }}{{ $.Site.Params.pageLabelDivider }}{{ end }}{{ if and .Page.Params.short_title (in .class "brief")}}{{ .Page.Params.short_title | markdownify }}{{ else if in .class "brief" }}{{ .Page.Title | markdownify }}{{ else }}{{ partial "page-title.html" . | markdownify }}{{ if .Page.Params.contributor }}<span class="contributor"> — {{ partial "contributor-list.html" (dict "range" .Page.Params.contributor "contributorType" "all" "listType" "string" "Site" .Site) }}</span>{{- end -}}{{- end -}}<span class="arrow remove-from-epub">&nbsp;{{- partial "icon.html" (dict "type" "arrow-forward" "description" "") -}}</span></div>
175
+ </div>
176
+ </div></a>
177
+
178
+ {{- else -}}
179
+
180
+ <div class="title"><a href="{{ .Page.Permalink | relURL }}"{{- if lt .Page.Weight .pageOne }} class="frontmatter-page"{{ end }}>{{ with .Page.Params.label }}{{ . }}{{ $.Site.Params.pageLabelDivider }}{{ end }}{{ if and .Page.Params.short_title (in .class "brief")}}{{ .Page.Params.short_title | markdownify }}{{ else if in .class "brief" }}{{ .Page.Title | markdownify }}{{ else }}{{ partial "page-title.html" . | markdownify }}{{ if .Page.Params.contributor }}<span class="contributor"> — {{ partial "contributor-list.html" (dict "range" .Page.Params.contributor "contributorType" "all" "listType" "string" "Site" .Site) }}</span>{{- end -}}{{- end -}}<span class="arrow remove-from-epub">&nbsp;{{- partial "icon.html" (dict "type" "arrow-forward" "description" "") -}}</span></a></div>
181
+
182
+ {{ if and (in .class "abstract") (ne .Page.Params.abstract "") }}
183
+ <div class="abstract-text">
184
+ {{ if .Page.Params.abstract }}
185
+ {{/* Returns abstract with any links stripped out ------ */}}
186
+ {{ .Page.Params.abstract | markdownify | replaceRE "</?a(|\\s*[^>]+)>" "" | htmlUnescape | safeHTML }}
187
+ {{ else }}
188
+ {{ .Page.Summary }}
189
+ {{- end -}}
190
+ </div>
191
+ {{ end -}}
192
+
193
+ {{ end -}}
194
+ {{ end -}}
195
+
196
+ {{- define "contents-item-menu" }}
197
+ <a href="{{ .Permalink | relURL }}">{{ with .Params.label }}{{ . }}{{ $.Site.Params.pageLabelDivider }}{{ end }}{{ if .Params.short_title }}{{ .Params.short_title | markdownify }}{{ else }}{{ .Title | markdownify }}{{- end -}}</a>
198
+ {{ end -}}
199
+
200
+ {{- define "contents-image" }}
201
+ {{ $imgPath := printf "%s/%s" .imageDir .figure.src }}
202
+ <div class="card-image">
203
+ <figure class="image">
204
+ <img src="{{ $imgPath | relURL }}" alt="" />
205
+ </figure>
206
+ </div>
207
+ {{ end -}}
@@ -0,0 +1 @@
1
+ <figcaption class="quire-figure__caption caption">{{ if eq .Site.Params.epub true }}<span class="quire-figure__label">{{ .label }}</span> {{ end }}{{ with .caption }}{{ markdownify . }}{{ end }}{{ with .credit }} <span class="quire-figure__credit">{{ markdownify . }}</span>{{ end }}</figcaption>
@@ -0,0 +1,31 @@
1
+ {{- $imageDir := "" -}}
2
+ {{- if .Site.Params.imageDir -}}
3
+ {{- $imageDir = .Site.Params.imageDir -}}
4
+ {{- else }}
5
+ {{- $imageDir = "img" -}}
6
+ {{- end }}
7
+
8
+ {{- if .src -}}
9
+
10
+ <img
11
+ id="{{ .id }}"
12
+ class="quire-figure__image"
13
+ src="{{ printf "%s/%s" $imageDir .src | relURL }}"
14
+ alt="{{ .alt }}" />
15
+
16
+ {{- else -}}
17
+
18
+ <div class="quire-figure__media-fallback">
19
+ <div class="placeholder">
20
+ <span class="fallback-image">
21
+ <img src='{{ $imageDir | relURL }}/icons/{{ .mediaType }}.png'/>
22
+ </span>
23
+ </div>
24
+ </div>
25
+
26
+ {{- end -}}
27
+
28
+ {{- if .label }}
29
+ {{- $labelDict := dict "Site" .Site "label" .label "icon" false -}}
30
+ {{- partial "figure-label.html" $labelDict -}}
31
+ {{- end -}}
@@ -0,0 +1,44 @@
1
+ {{- $imageDir := "" -}}
2
+ {{- if .Site.Params.imageDir -}}
3
+ {{- $imageDir = .Site.Params.imageDir -}}
4
+ {{- else }}
5
+ {{- $imageDir = "img" -}}
6
+ {{- end }}
7
+
8
+ {{- if eq .Site.Params.figureModal true -}}
9
+ {{- $now := now.UnixNano -}}
10
+ <figure
11
+ id="deepzoom-{{ $now }}"
12
+ title="{{ .caption | markdownify | safeHTML }}"
13
+ class="quire-figure leaflet-outer-wrapper mfp-hide notGet">
14
+ <div
15
+ id="js-deepzoom-{{ $now }}"
16
+ class="quire-deepzoom inset leaflet-inner-wrapper "
17
+ aria-live="polite"
18
+ role="application"
19
+ aria-label="Zoomable image"
20
+ src="{{ printf "%s/%s" $imageDir .src | relURL }}">
21
+ </div>
22
+ <span class="figure-caption visually-hidden">{{ with .caption }}{{ markdownify . }}{{ end }}{{ with .credit }} {{ markdownify . }}{{ end }}</span>
23
+ </figure>
24
+ <a
25
+ href="#deepzoom-{{ $now }}"
26
+ class="inline popup"
27
+ data-type="inline"
28
+ title="{{ .caption | markdownify | safeHTML }}" >
29
+ {{- end -}}
30
+
31
+ <img
32
+ class="quire-figure__image"
33
+ src="{{ printf "%s/%s" $imageDir .src | relURL }}"
34
+ alt="{{ .alt }}" />
35
+
36
+
37
+ {{- if or .label (eq .Site.Params.figureModal true ) }}
38
+ {{- $labelDict := dict "Site" .Site "label" .label -}}
39
+ {{- partial "figure-label.html" $labelDict -}}
40
+ {{- end -}}
41
+
42
+ {{- if eq .Site.Params.figureModal true -}}
43
+ </a>
44
+ {{- end -}}
@@ -0,0 +1,15 @@
1
+ <span class="quire-figure__label quire-figure__label--{{ if .Site.Params.figureLabelLocation }}{{ .Site.Params.figureLabelLocation }}{{ else }}on-top{{ end }}">
2
+
3
+ {{- if and (ne .icon false) (eq .Site.Params.figureModal true) -}}
4
+ <span class="quire-figure__label-icon">
5
+ {{- partial "icon.html" (dict "type" "fullscreen" "description" "Expand") -}}
6
+ </span>
7
+ {{- end -}}
8
+
9
+ {{- with .label -}}
10
+ <span class="quire-figure__label-text">
11
+ {{- markdownify . -}}
12
+ </span>
13
+ {{- end -}}
14
+
15
+ </span>
@@ -0,0 +1,25 @@
1
+ {{- if or (eq .Site.Params.epub true) (eq .Site.Params.pdf true) -}}
2
+
3
+ {{- $fallbackDict := dict "Site" .Site "alt" .alt "id" .id "mediaType" .mediaType "src" .src -}}
4
+ {{- partial "figure-fallback.html" $fallbackDict -}}
5
+
6
+ <figcaption class="quire-figure__caption caption"><a href="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/{{ .mediaId }}" target="_blank" >https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/{{ .mediaId }}</a></figcaption>
7
+
8
+ {{- else -}}
9
+
10
+ <div class="quire-figure__media-wrapper">
11
+ <iframe
12
+ width="100%"
13
+ height="166"
14
+ scrolling="no"
15
+ frameborder="no"
16
+ allow="autoplay"
17
+ src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/{{ .mediaId }}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=false&show_reposts=false&show_teaser=false"></iframe>
18
+ </div>
19
+
20
+ {{- end -}}
21
+
22
+ {{- if .label }}
23
+ {{- $labelDict := dict "Site" .Site "label" .label "icon" false -}}
24
+ {{- partial "figure-label.html" $labelDict -}}
25
+ {{- end -}}