summaryrefslogtreecommitdiffstats
path: root/cmd/gobtex/test.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gobtex/test.tmpl')
-rw-r--r--cmd/gobtex/test.tmpl175
1 files changed, 175 insertions, 0 deletions
diff --git a/cmd/gobtex/test.tmpl b/cmd/gobtex/test.tmpl
new file mode 100644
index 0000000..5a5bc83
--- /dev/null
+++ b/cmd/gobtex/test.tmpl
@@ -0,0 +1,175 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>title</title>
+ <link rel="stylesheet" href="style.css">
+ </head>
+ <body>
+ <ul>
+ {{- range $key := .EKeys -}}
+ {{- if not (index $.CrossRefs $key) -}}
+ {{- with index $.Entries $key }}
+ <li id="{{ .Key }}">
+ <span class="title">{{.Fields.title}}</span> {{template "links" .Fields}}<br/>
+ by {{template "authors" .Fields.author}}<br/>
+ {{if eq .Type "phdthesis" -}}
+ {{template "phdthesis" .Fields}}.
+ {{- else if eq .Type "mastersthesis" -}}
+ {{template "mastersthesis" .Fields}}.
+ {{- else if eq .Type "article" -}}
+ {{template "article" .Fields}}.
+ {{- else if eq .Type "incollection" -}}
+ {{template "incollection" .Fields}}.
+ {{- else if eq .Type "misc" -}}
+ {{template "misc" .Fields}}.
+ {{- else if eq .Type "book" -}}
+ {{template "book" .Fields}}.
+ {{- else if eq .Type "inproceedings" -}}
+ {{template "inproceedings" .Fields}}.
+ {{- else if eq .Type "techreport" -}}
+ {{template "techreport" .Fields}}.
+ {{- end}} <a class="entrylink" href="#{{ .Key}}">¶</a>
+ <pre>{{ .Marshal}}</pre>
+ </li>
+ {{- end -}}
+ {{- end -}}
+ {{- end}}
+ </ul>
+ </body>
+ <script src="main.js"></script>
+</html>
+
+{{- define "article" -}}
+In <span class="journal">{{.journal}}</span>{{template "vnp" .}}{{template "date" .}}
+{{- end -}}
+
+{{- define "book" -}}
+{{template "Volume" .}}{{template "nseries" .}}{{.publisher | ne ". %s"}}{{.address | ne ", %s" -}}
+{{.edition | ne ", %s"}}{{template "date" .}}
+{{- end -}}
+
+{{- define "incollection" -}}
+{{template "edtitle" .}}{{template "volume" .}}{{template "nseries" .}}{{template "chapterpages" . -}}
+{{.publisher | ne ". %s"}}{{.address | ne ", %s"}}{{template "date" .}}
+{{- end -}}
+
+{{- define "inproceedings" -}}
+{{template "edtitle" .}}{{template "volume" .}}{{ template "nseries" .}}{{template "page" .}}
+{{- if not .address -}}
+ {{- if or .organization .publisher -}}
+ . {{.organization | ne "%s"}}{{.publisher | ne ", %s"}}
+ {{- end -}}
+ {{template "date" .}}
+{{- else -}}
+{{.address | ne ", %s"}}{{template "date" .}}{{.organization | ne ". %s"}}{{.publisher | ne ", %s"}}
+{{- end -}}
+{{- end -}}
+
+{{- define "mastersthesis" -}}
+{{or .type "Master's thesis"}}{{.school | ne ", %s"}}{{.address | ne ", %s"}}{{template "date" .}}
+{{- end -}}
+
+{{- define "misc" -}}
+{{if .title}}{{.title}}{{.howpublished | ne ", %s"}}{{else}}{{.howpublished}}{{end}}{{template "date" .}}
+{{- end -}}
+
+{{- define "phdthesis" -}}
+{{or .type "PhD thesis"}}{{.school | ne ", %s"}}{{.address | ne ", %s"}}{{template "date" .}}
+{{- end -}}
+
+{{- define "techreport" -}}
+{{or .type "Technical Report"}}{{.institution | ne ", %s"}}{{template "date" .}}
+{{- end -}}
+
+{{- define "edtitle" -}}
+{{- if .booktitle -}}
+{{- if .editor -}}
+In {{template "authors" .editor}}, {{if gt (len .editor) 1}}editors{{else}}editor{{end}}, <span class="journal">{{.booktitle}}</span>
+{{- else -}}
+In <span class="journal">{{.booktitle}}</span>
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{- define "volume" -}}
+{{- if .volume -}}
+{{.volume | ne ", volume %s"}}
+{{- if .series}} of <span class="series">{{.series}}</span>{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{- define "Volume" -}}
+{{- if .volume -}}
+{{.volume | ne "Volume %s"}}
+{{- if .series}} of <span class="series">{{.series}}</span>{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{- define "chapterpages" -}}
+{{- if .chapter -}}
+{{or .type "chapter" | ne ", %s"}} {{.chapter}}{{template "page" .}}
+{{- end -}}
+{{- end -}}
+
+{{- define "nseries" -}}
+{{- if not .volume -}}
+ {{- if not .number -}}
+ {{.series | ne ", %s"}}
+ {{- else -}}
+ , number {{.number}} in {{.series}}
+ {{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{- define "vnp" -}}
+{{- if .volume -}}
+ {{.volume | ne ", %s"}}{{.number | ne "(%s)"}}
+ {{- .pages.String | print | dashify | ne ":%s"}}
+{{- else -}}
+ {{template "page" .}}
+{{- end -}}
+{{- end -}}
+
+{{- define "page" -}}
+{{if .pages }}{{if contains .pages.String "-–,+"}}, pages {{else}}, page {{end}}{{.pages.String | dashify | printf "%s"}}{{end}}
+{{- end -}}
+
+{{- define "date" -}}
+{{if .year }}, <span class="date">{{.month | ne "%s "}}{{.year}}</span>{{end}}
+{{- end -}}
+
+{{- define "links" -}}
+{{- if .www_pdf_url -}}
+ [<a href="{{ .www_pdf_url}}">pdf</a>]
+{{- end -}}
+{{- if .www_ps_url -}}
+ [<a href="{{.www_ps_url}}">ps</a>]
+{{- end -}}
+{{- if .www_html_url -}}
+ [<a href="{{ .www_html_url}}">html</a>]
+{{- end -}}
+[<a class="biblink" href="#">bib</a>]
+{{- end -}}
+
+{{- define "authors" -}}
+{{$len := len .}}
+{{- if eq $len 1 -}}
+ {{template "author" index . 0}}
+{{- else if eq $len 2 -}}
+ {{template "author" index . 0}}{{" and "}} {{template "author" index . 1}}
+{{- else -}}
+ {{range $index, $name := . -}}
+ {{template "author" .}}
+ {{- if eq $index (add $len -2) -}}
+ {{", and "}}
+ {{- else if lt $index (add $len -2) -}}
+ {{", "}}
+ {{- end -}}
+ {{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{- define "author" -}}
+<span class="author">{{.Format "{f.~}{vv~}{ll}{, jj}" | untex}}</span>
+{{- end -}}