Skip to content

Commit 2c1e765

Browse files
Merge pull request #39 from NullHypothesis/add-net4people-links
Add net4people discussion links to papers.
2 parents 0a756fa + f5978aa commit 2c1e765

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

assets/discussion-icon.svg

Lines changed: 1 addition & 0 deletions
Loading

references.bib

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ @inproceedings{Bocovich2024a
2525
publisher = {USENIX},
2626
year = {2024},
2727
url = {https://www.usenix.org/system/files/sec24fall-prepub-1998-bocovich.pdf},
28+
discussion_url = {https://github.com/net4people/bbs/issues/366},
2829
}
2930

3031
@inproceedings{Moon2024a,
@@ -90,6 +91,7 @@ @inproceedings{Sakamoto2024a
9091
publisher = {},
9192
year = {2024},
9293
url = {https://www.petsymposium.org/foci/2024/foci-2024-0002.pdf},
94+
discussion_url = {https://github.com/net4people/bbs/issues/367},
9395
}
9496

9597
@inproceedings{Chi2024a,

src/html.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,24 @@ func makeBibEntryTitle(entry *bibEntry) string {
6868
`</span>`,
6969
}
7070
// Icons are on the right side.
71-
icons := []string{
72-
`<span class="icons">`,
71+
icons := makeIcons(entry)
72+
return strings.Join(append(title, icons...), "\n")
73+
}
74+
75+
func makeIcons(entry *bibEntry) []string {
76+
var icons = []string{`<span class="icons">`}
77+
78+
// Not all references have a corresponding discussion (e.g., on net4people)
79+
// but if they do, add an icon.
80+
if field, ok := entry.Fields["discussion_url"]; ok {
81+
s := fmt.Sprintf("<a href='%s'>", field.String()) +
82+
`<img class="icon" title="Online discussion" src="assets/discussion-icon.svg" alt="Discussion icon">` +
83+
`</a>`
84+
icons = append(icons, s)
85+
}
86+
87+
// Add icons that are always present.
88+
icons = append(icons, []string{
7389
fmt.Sprintf("<a href='%s'>", entry.Fields["url"].String()),
7490
`<img class="icon" title="Download paper" src="assets/pdf-icon.svg" alt="Download icon">`,
7591
`</a>`,
@@ -82,9 +98,9 @@ func makeBibEntryTitle(entry *bibEntry) string {
8298
fmt.Sprintf("<a href='#%s'>", entry.CiteName),
8399
`<img class="icon" title="Link to paper" src="assets/link-icon.svg" alt="Paper link icon">`,
84100
`</a>`,
85-
`</span>`,
86-
}
87-
return strings.Join(append(title, icons...), "\n")
101+
}...)
102+
103+
return append(icons, `</span>`)
88104
}
89105

90106
func makeBibEntryAuthors(entry *bibEntry) string {

0 commit comments

Comments
 (0)