Skip to content

Commit

Permalink
Merge pull request #39 from NullHypothesis/add-net4people-links
Browse files Browse the repository at this point in the history
Add net4people discussion links to papers.
  • Loading branch information
NullHypothesis authored May 25, 2024
2 parents 0a756fa + f5978aa commit 2c1e765
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions assets/discussion-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ @inproceedings{Bocovich2024a
publisher = {USENIX},
year = {2024},
url = {https://www.usenix.org/system/files/sec24fall-prepub-1998-bocovich.pdf},
discussion_url = {https://github.com/net4people/bbs/issues/366},
}

@inproceedings{Moon2024a,
Expand Down Expand Up @@ -90,6 +91,7 @@ @inproceedings{Sakamoto2024a
publisher = {},
year = {2024},
url = {https://www.petsymposium.org/foci/2024/foci-2024-0002.pdf},
discussion_url = {https://github.com/net4people/bbs/issues/367},
}

@inproceedings{Chi2024a,
Expand Down
26 changes: 21 additions & 5 deletions src/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,24 @@ func makeBibEntryTitle(entry *bibEntry) string {
`</span>`,
}
// Icons are on the right side.
icons := []string{
`<span class="icons">`,
icons := makeIcons(entry)
return strings.Join(append(title, icons...), "\n")
}

func makeIcons(entry *bibEntry) []string {
var icons = []string{`<span class="icons">`}

// 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("<a href='%s'>", field.String()) +
`<img class="icon" title="Online discussion" src="assets/discussion-icon.svg" alt="Discussion icon">` +
`</a>`
icons = append(icons, s)
}

// Add icons that are always present.
icons = append(icons, []string{
fmt.Sprintf("<a href='%s'>", entry.Fields["url"].String()),
`<img class="icon" title="Download paper" src="assets/pdf-icon.svg" alt="Download icon">`,
`</a>`,
Expand All @@ -82,9 +98,9 @@ func makeBibEntryTitle(entry *bibEntry) string {
fmt.Sprintf("<a href='#%s'>", entry.CiteName),
`<img class="icon" title="Link to paper" src="assets/link-icon.svg" alt="Paper link icon">`,
`</a>`,
`</span>`,
}
return strings.Join(append(title, icons...), "\n")
}...)

return append(icons, `</span>`)
}

func makeBibEntryAuthors(entry *bibEntry) string {
Expand Down

0 comments on commit 2c1e765

Please sign in to comment.