Skip to content

Commit

Permalink
fix: detect lang
Browse files Browse the repository at this point in the history
  • Loading branch information
atsuyaw committed Oct 23, 2024
1 parent 578fd3a commit af57011
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
25 changes: 12 additions & 13 deletions layouts/partials/papers.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
<div>
{{ with index . "paper_title" }}
{{ if .ja }}
<h5 class="pubTitle">{{ .ja }}</h5>
{{ else }}
<h5 class="pubTitle">{{ .en }}</h5>
{{ end }}
{{ if .ja }}<h5 class="pubTitle">{{ .ja }}</h5>
{{ else }}<h5 class="pubTitle">{{ .en }}</h5>{{ end }}
{{ end }}
{{ with .authors }}
<p class="authors">
{{ if .ja }}
{{ if and (eq (page.Language.Lang) "ja") (.ja) }}
{{ range $k, $v := .ja }}{{ if $k }}, {{ end }}{{ .name }}{{ end }}
{{ else }}
{{ range $k, $v := .en }}{{ if $k }}, {{ end }}{{ .name }}{{ end }}
{{ end }}
</p>
{{ end }}
<p class="pubDetail">
<p class="pubDetail">
{{ with index . "publication_name" }}
<span class="pubName">
{{ if .ja }}{{ .ja }}
{{ if and (eq (page.Language.Lang) "ja") (.ja) }}{{ .ja }}
{{ else }}{{ .en }}{{ end }}
</span>
{{ end }}
{{ with .volume }}<span class="vol">{{ . }}</span>,{{ end }}
{{ index . "starting_page" }}{{ with index . "ending_page" }}&ndash;{{ . }}{{ end }}.
</p>
{{ index . "starting_page" }}{{ with index . "ending_page" }}&ndash;{{ . }}{{ end }}
</p>
<p class="pubDate">{{ index . "publication_date" }}</p>

{{ range .identifiers.doi }}
<p class="doi">doi: <a href="https://doi.org/{{ . }}"><span class="doiID">{{ . }}</span></a></p>
{{ end }}
{{ with index . "see_also" }}
{{ range where . "is_downloadable" true }}{{ if ne .label "doi" }}
<p><a href="{{ index . "@id" }}">{{ .label }}</a></p>
{{ end }}{{ end }}
{{ range $k, $v := where (where . "label" "ne" "doi") "is_downloadable" true }}
<p>{{ .label }} <a href="{{ $k := index . "@id" }}">{{ $k }}</a></p>
{{ end }}
{{ end }}
</div>

18 changes: 10 additions & 8 deletions layouts/shortcodes/researchmapApi.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
{{ with $data := .Content | transform.Unmarshal }}
{{ with index . "items" }}
{{ with where . "published_paper_type" "scientific_journal" }}
{{ range sort . "publication_date" "desc" }}
{{ partial "papers" . }}
{{ end }}
<ol reversed>
{{ range sort . "publication_date" "desc" }}
<li>{{ partial "papers" . }}</li>
{{ end }}
</ol>
{{ end }}
{{ with where . "published_paper_type" "ne" "scientific_journal" }}
{{ range sort . "publication_date" "desc" }}
{{ partial "papers" . }}
{{ end }}
<ol>
{{ range sort . "publication_date" "desc" }}
<li>{{ partial "papers" . }}</li>
{{ end }}
</ol>
{{ end }}

{{ end }}
{{ end }}
<!-- range where . $atype "published_papers" -->
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
Expand Down

0 comments on commit af57011

Please sign in to comment.