refactor: publication types as TOML at data/publication_types.toml

This commit is contained in:
George Cushen committed 2019-05-08 20:13:18 +01:00
1 parent 507523aeb9
commit ced350c547
8 files changed
+22 -7

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{{- $scr := .Scratch -}}
{{- $site := $scr.Get "site" -}}
{{- partial "css/parse_theme.css" . -}}
{{- partial "functions/parse_theme" . -}}
$sta-font-size: {{ $scr.Get "font_size" }};
$sta-font-size-small: {{ $scr.Get "font_size_small" }};
+12
View File
@@ -0,0 +1,12 @@
# Publication types.
# Each item in the list corresponds to an item in the language packs.
types = [ "pub_uncat",
"pub_conf",
"pub_journal",
"pub_preprint",
"pub_report",
"pub_book",
"pub_book_section",
"pub_thesis",
"pub_patent"
]
@@ -0,0 +1,6 @@
{{/* Get Publication Types */}}
{{ $pub_types := slice }}
{{ range site.Data.publication_types.types }}
{{ $pub_types = $pub_types | append (i18n . | default "Uncategorized") }}
{{ end }}
{{ return $pub_types }}
+1 -1
View File
@@ -42,7 +42,7 @@
{{ end }}
<link rel="alternate" hreflang="{{ site.LanguageCode | default "en-us" }}" href="{{ .Permalink }}">
{{ partial "css/parse_theme.css" . }}
{{ partial "functions/parse_theme" . }}
{{ $css := site.Data.assets.css }}
{{ $js := site.Data.assets.js }}
{{ if ne ($scr.Get "primary") "#fff" }}
-1
View File
@@ -1 +0,0 @@
{{ $.Scratch.Set "pub_types" (slice (i18n "pub_uncat" | default "Uncategorized") (i18n "pub_conf" | default "Conference paper") (i18n "pub_journal" | default "Journal article") (i18n "pub_preprint" | default "Preprint") (i18n "pub_report" | default "Report") (i18n "pub_book" | default "Book") (i18n "pub_book_section" | default "Book section") (i18n "pub_thesis" | default "Thesis") (i18n "pub_patent" | default "Patent") ) }}
+1 -2
View File
@@ -18,8 +18,7 @@
<div class="row">
<div class="col-12 col-md-3 pub-row-heading">{{ i18n "publication_type" }}</div>
<div class="col-12 col-md-9">
{{ partial "pub_types.html" $ }}
{{ $pub_types := $.Scratch.Get "pub_types" }}
{{ $pub_types := partial "functions/get_pub_types" $ }}
{{ range $index, $pubtype := .Params.publication_types }}
<a href="{{ (site.GetPage "section" "publication").RelPermalink }}#{{ . | urlize }}">
{{ index $pub_types (int .) }}
+1 -2
View File
@@ -25,10 +25,9 @@
<div class="col-auto">
<select class="pub-filters pubtype-select form-control form-control-sm" data-filter-group="pubtype">
<option value="*">{{ i18n "publication_type" }}</option>
{{ partial "pub_types.html" $ }}
{{ $pub_types := partial "functions/get_pub_types" $ }}
{{ range $index, $taxonomy := site.Taxonomies.publication_types }}
<option value=".pubtype-{{ (int $index) }}">
{{ $pub_types := $.Scratch.Get "pub_types" }}
{{ index $pub_types (int $index) }}
</option>
{{ end }}