From 2be19b1b6e31451e7ac56fd80d60b6eb02c6c6c1 Mon Sep 17 00:00:00 2001 From: Philipp Winter Date: Sat, 25 May 2024 08:48:25 -0500 Subject: [PATCH 1/3] Add support for net4people links. We're going to use the `net4people_url` BibTeX key to link to a paper's net4people discussion. BibTeX parsers don't know about this key and should therefore ignore it. --- assets/discussion-icon.svg | 1 + src/html.go | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 assets/discussion-icon.svg 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 { From eb4ffd73fd096d0751fa9577b8fdd7688a6d2857 Mon Sep 17 00:00:00 2001 From: Philipp Winter Date: Sat, 25 May 2024 08:50:41 -0500 Subject: [PATCH 2/3] Add two recent net4people discussions. --- references.bib | 2 ++ 1 file changed, 2 insertions(+) diff --git a/references.bib b/references.bib index 0f1a690..c4eb61d 100644 --- a/references.bib +++ b/references.bib @@ -25,6 +25,7 @@ publisher = {USENIX}, year = {2024}, url = {https://www.usenix.org/system/files/sec24fall-prepub-1998-bocovich.pdf}, + net4people_url = {https://github.com/net4people/bbs/issues/366}, } @inproceedings{Moon2024a, @@ -90,6 +91,7 @@ publisher = {}, year = {2024}, url = {https://www.petsymposium.org/foci/2024/foci-2024-0002.pdf}, + net4people_url = {https://github.com/net4people/bbs/issues/367}, } @inproceedings{Chi2024a, From f5978aa24c7e409fbfd9db276ba7cedfd46ec22d Mon Sep 17 00:00:00 2001 From: Philipp Winter Date: Sat, 25 May 2024 09:27:19 -0500 Subject: [PATCH 3/3] Rename `net4people_url` to `discussion_url`. While most discussion URLs will be on net4people, some won't. --- references.bib | 4 ++-- src/html.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/references.bib b/references.bib index c4eb61d..1895a38 100644 --- a/references.bib +++ b/references.bib @@ -25,7 +25,7 @@ publisher = {USENIX}, year = {2024}, url = {https://www.usenix.org/system/files/sec24fall-prepub-1998-bocovich.pdf}, - net4people_url = {https://github.com/net4people/bbs/issues/366}, + discussion_url = {https://github.com/net4people/bbs/issues/366}, } @inproceedings{Moon2024a, @@ -91,7 +91,7 @@ publisher = {}, year = {2024}, url = {https://www.petsymposium.org/foci/2024/foci-2024-0002.pdf}, - net4people_url = {https://github.com/net4people/bbs/issues/367}, + discussion_url = {https://github.com/net4people/bbs/issues/367}, } @inproceedings{Chi2024a, diff --git a/src/html.go b/src/html.go index ed6e581..7353de5 100644 --- a/src/html.go +++ b/src/html.go @@ -75,11 +75,11 @@ func makeBibEntryTitle(entry *bibEntry) string { 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 { + // Not all references have a corresponding discussion (e.g., on net4people) + // but if they do, add an icon. + if field, ok := entry.Fields["discussion_url"]; ok { s := fmt.Sprintf("", field.String()) + - `Discussion icon` + + `Discussion icon` + `` icons = append(icons, s) }