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() {
{{if .Authors}}
Authors
-
{{range .Authors}}{{.}}, {{end}}
+
+ {{range $i, $author := .Authors}} + {{if $i}}&{{end}} + {{$author}} + {{end}} +
{{end}} {{if .Publisher}}
Publisher
@@ -55,7 +60,12 @@ function closeAlert() { {{end}} {{if .Tags}}
Tags
-
{{range .Tags}}{{.}}, {{end}}
+
+ {{range $i, $tag := .Tags}} + {{if $i}},{{end}} + {{$tag}} + {{end}} +
{{end}} {{if .Isbn}}
ISBN
diff --git a/templates/book_list.html b/templates/book_list.html index dfee381..5f464f7 100644 --- a/templates/book_list.html +++ b/templates/book_list.html @@ -14,7 +14,12 @@ {{if .Publisher}}{{.Publisher}}{{end}}

-

{{range .Authors}}{{.}}, {{end}}

+

+ {{range $i, $author := .Authors}} + {{if $i}}&{{end}} + {{$author}} + {{end}} +


diff --git a/templates/list_edit.html b/templates/list_edit.html index aae3832..b5c780a 100644 --- a/templates/list_edit.html +++ b/templates/list_edit.html @@ -36,7 +36,7 @@ {{if .Publisher}}{{.Publisher}}{{end}}

-

{{range .Authors}}{{.}}, {{end}}

+

{{strings_join .Authors "& "}}

diff --git a/templates/submission.html b/templates/submission.html index cc2b4d2..b872618 100644 --- a/templates/submission.html +++ b/templates/submission.html @@ -44,9 +44,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/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}}