diff --git a/assets/discussion-icon.svg b/assets/discussion-icon.svg new file mode 100644 index 0000000..62bdd3a --- /dev/null +++ b/assets/discussion-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/html.go b/src/html.go index 623d484..ed6e581 100644 --- a/src/html.go +++ b/src/html.go @@ -68,8 +68,24 @@ func makeBibEntryTitle(entry *bibEntry) string { ``, } // Icons are on the right side. - icons := []string{ - ``, + icons := makeIcons(entry) + return strings.Join(append(title, icons...), "\n") +} + +func makeIcons(entry *bibEntry) []string { + var icons = []string{``} + + // Not all references have a corresponding net4people discussion but if they + // do, add an icon. + if field, ok := entry.Fields["net4people_url"]; ok { + s := fmt.Sprintf("", field.String()) + + `Discussion icon` + + `` + icons = append(icons, s) + } + + // Add icons that are always present. + icons = append(icons, []string{ fmt.Sprintf("", entry.Fields["url"].String()), `Download icon`, ``, @@ -82,9 +98,9 @@ func makeBibEntryTitle(entry *bibEntry) string { fmt.Sprintf("", entry.CiteName), `Paper link icon`, ``, - ``, - } - return strings.Join(append(title, icons...), "\n") + }...) + + return append(icons, ``) } func makeBibEntryAuthors(entry *bibEntry) string {