mirror of
https://github.com/NullHypothesis/censorbib.git
synced 2025-07-22 22:21:15 -04:00
Merge pull request #39 from NullHypothesis/add-net4people-links
Add net4people discussion links to papers.
This commit is contained in:
commit
2c1e7652ba
3 changed files with 24 additions and 5 deletions
26
src/html.go
26
src/html.go
|
@ -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>`,
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue