diff --git a/lib/template.go b/lib/template.go index bdd83af..448a3c6 100644 --- a/lib/template.go +++ b/lib/template.go @@ -90,8 +90,8 @@ func InitTemplate(assetsPath string) *Template { return &t } -func stringsJoin(strs []string) string { - return strings.Join(strs, ", ") +func stringsJoin(strs []string, sep string) string { + return strings.Join(strs, sep) } func bookFileName(book database.Book) string { diff --git a/templates/book.html b/templates/book.html index 05d9fc4..f2d47c3 100644 --- a/templates/book.html +++ b/templates/book.html @@ -47,7 +47,12 @@ function closeAlert() {
{{range .Authors}}{{.}}, {{end}}
++ {{range $i, $author := .Authors}} + {{if $i}}&{{end}} + {{$author}} + {{end}} +
{{range .Authors}}{{.}}, {{end}}
+{{strings_join .Authors "& "}}
- {{if .Authors}}Authors: {{range .Authors}}{{.}}, {{end}}
{{end}}
+ {{if .Authors}}Authors:
+
+ {{range $i, $author := .Authors}}
+ {{if $i}}&{{end}}
+ {{$author}}
+ {{end}}
+
{{end}}
{{if .Publisher}}Publisher: {{.Publisher}}
{{end}}
- {{if .Tags}}Tags: {{range .Tags}}{{.}}, {{end}}
{{end}}
+ {{if .Tags}}Tags:
+ {{range $i, $tag := .Tags}}
+ {{if $i}},{{end}}
+ {{$tag}}
+ {{end}}
+
{{end}}
{{if .Isbn}}ISBN: {{.Isbn}}
{{end}}
{{if .Date}}Date: {{.Date}}
{{end}}
{{if .Lang}}Lang: {{.Lang}}
{{end}}
diff --git a/templates/submission_moderate.html b/templates/submission_moderate.html
index 7095787..b6c1782 100644
--- a/templates/submission_moderate.html
+++ b/templates/submission_moderate.html
@@ -57,9 +57,20 @@
- {{if .Authors}}Authors: {{range .Authors}}{{.}}, {{end}}
{{end}}
+ {{if .Authors}}Authors:
+
+ {{range $i, $author := .Authors}}
+ {{if $i}}&{{end}}
+ {{$author}}
+ {{end}}
+
{{end}}
{{if .Publisher}}Publisher: {{.Publisher}}
{{end}}
- {{if .Tags}}Tags: {{range .Tags}}{{.}}, {{end}}
{{end}}
+ {{if .Tags}}Tags:
+ {{range $i, $tag := .Tags}}
+ {{if $i}},{{end}}
+ {{$tag}}
+ {{end}}
+
{{end}}
{{if .Isbn}}ISBN: {{.Isbn}}
{{end}}
{{if .Date}}Date: {{.Date}}
{{end}}
{{if .Lang}}Lang: {{.Lang}}
{{end}}
diff --git a/templates/submissions.html b/templates/submissions.html
index 94352c1..b59aab8 100644
--- a/templates/submissions.html
+++ b/templates/submissions.html
@@ -38,9 +38,20 @@
- {{if .Authors}}Authors: {{range .Authors}}{{.}}, {{end}}
{{end}}
+ {{if .Authors}}Authors:
+
+ {{range $i, $author := .Authors}}
+ {{if $i}}&{{end}}
+ {{$author}}
+ {{end}}
+
{{end}}
{{if .Publisher}}Publisher: {{.Publisher}}
{{end}}
- {{if .Tags}}Tags: {{range .Tags}}{{.}}, {{end}}
{{end}}
+ {{if .Tags}}Tags:
+ {{range $i, $tag := .Tags}}
+ {{if $i}},{{end}}
+ {{$tag}}
+ {{end}}
+
{{end}}
{{if .Isbn}}ISBN: {{.Isbn}}
{{end}}
{{if .Date}}Date: {{.Date}}
{{end}}
{{if .Lang}}Lang: {{.Lang}}
{{end}}