@@ -32,6 +32,9 @@ <h1 class="bib-title">{{ or .Params.heading .Title }}</h1>
3232 ul .pub-list > li : last-child { border-bottom : none; }
3333</ style >
3434
35+ {{- $previewWordLimit := 24 -}}
36+
37+ {{- /* Get all regular pages in this section */ -}}
3538 {{ $pages := .RegularPages }}
3639 {{- /* Sort by date descending, then title ascending */ -}}
3740 {{- $pages = sort $pages "Date" "desc" -}}
@@ -54,37 +57,70 @@ <h1 class="bib-title">{{ or .Params.heading .Title }}</h1>
5457 < li class ="pub-item " data-type ="{{ $types }} ">
5558 {{- $rawTitle := or .Params.title .Title -}}
5659 {{- $rendered := replaceRE "^< p > (.*)</ p > $" "$1" $rawTitle -}}
57- {{- $rendered = $rendered | plainify | htmlEscape -}}
60+ {{- /* The plainify corrupts values that look like HTML but aren't: "Special files on < Test > ARs> " */ -}}
61+ {{- /* $rendered = $rendered | plainify | htmlEscape */ -}}
62+ {{- $rendered = $rendered | htmlEscape -}}
5863 < a href ="{{ .RelPermalink }} "> < span > < strong > {{- $rendered | safeHTML -}}</ strong > </ span > </ a > < br >
5964
6065 {{- /* Safe date: use front matter date only if non-empty & matches basic pattern */ -}}
66+ {{- $authors := .Params.authors -}}
67+ {{- $editors := .Params.editors -}}
68+ {{- $isPatent := eq .Params.item_type "patent" -}}
69+ {{- /* warnf "authors: %v" $authors */ -}}
70+ {{- if or $authors $editors -}}
71+ {{- if $authors -}}
72+ {{- if reflect.IsSlice $authors -}}
73+ {{- if $isPatent }}
74+ Inventors:
75+ {{ end }}
76+ {{ delimit $authors "; " "; and " }}
77+ {{- else -}}
78+ {{- if $isPatent }}
79+ Inventor:
80+ {{ end }}
81+ {{ $authors }}
82+ {{- end -}}
83+ {{- else -}}
84+ Edited by:
85+ {{ if reflect.IsSlice $editors -}}
86+ {{ delimit $editors "; " "; and " }}
87+ {{- else -}}
88+ {{ $editors }}
89+ {{- end -}}
90+ {{- end -}}
91+ < br >
92+ {{- end -}}
93+
6194 {{- $d := .Date -}}
6295 {{- with .Params.date -}}
6396 {{- $datestr := trim . " " -}}
6497 {{- if and (ne $datestr "") (findRE `^\d{4}-\d{2}-\d{2}` $datestr) -}}
6598 {{- $d = time $datestr -}}
6699 {{- end -}}
67100 {{- end -}}
68- < time datetime ="{{ $d.Format "2006-01-02 " }}"> {{ $d.Format "2006-01-02" }}</ time > < br >
101+ {{- $d = $d.Format "2006-01-02" -}}
102+ {{- /* Don't display bogus date */ -}}
103+ {{- if (ne $d "0001-01-01") }}
104+ < time datetime ="{{ $d }} "> {{ $d }}</ time > < br >
105+ {{ end -}}
69106
70107 {{ with .Params.abstract -}}
71- {{- $plain := . | plainify | htmlEscape | replaceRE `\s+` " " -}}
72- {{- $words := split $plain " " -}}
73- {{- $previewWords := cond (gt (len $words) 24) (first 24 $words) $words -}}
74- {{- $preview := delimit $previewWords " " -}}
108+ {{- /* can't plainify, as above */ -}}
109+ {{- /* $plain := . | plainify | htmlEscape | replaceRE `\s+` " " */ -}}
110+ {{- $plain := . | htmlEscape | replaceRE `\s+` " " -}}
111+ {{- $previewing := gt (countwords $plain) $previewWordLimit -}}
112+ {{- $preview := "" -}}
113+ {{- if $previewing -}}
114+ {{- $previewWords := split $plain " " | first $previewWordLimit -}}
115+ {{- $preview = delimit $previewWords " " -}}
116+ {{- else -}}
117+ {{- $preview = replace . "\n" "< br > " -}}
118+ {{- end -}}
75119 < br >
76- < div > {{ $preview | safeHTML }}{{ if gt (len $words) 24 }}…{{ end }}</ div >
120+ < div > {{ $preview | safeHTML }}{{ if $previewing }}…{{ end }}</ div >
77121 < br >
78122 {{- end -}}
79123
80- {{- $authors := .Params.authors -}}
81- {{- if $authors -}}
82- {{- if reflect.IsSlice $authors -}}
83- {{ delimit $authors "; " " and " }}< br >
84- {{- else -}}
85- {{ $authors }}< br >
86- {{- end -}}
87- {{- end -}}
88124 </ li >
89125 {{ end }}
90126</ ul >
0 commit comments