mirror of
https://github.com/NullHypothesis/censorbib.git
synced 2025-07-21 21:59:04 -04:00
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.
This commit is contained in:
parent
2fe526c0c0
commit
2be19b1b6e
2 changed files with 22 additions and 5 deletions
1
assets/discussion-icon.svg
Normal file
1
assets/discussion-icon.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M208 352c114.9 0 208-78.8 208-176S322.9 0 208 0S0 78.8 0 176c0 38.6 14.7 74.3 39.6 103.4c-3.5 9.4-8.7 17.7-14.2 24.7c-4.8 6.2-9.7 11-13.3 14.3c-1.8 1.6-3.3 2.9-4.3 3.7c-.5 .4-.9 .7-1.1 .8l-.2 .2 0 0 0 0C1 327.2-1.4 334.4 .8 340.9S9.1 352 16 352c21.8 0 43.8-5.6 62.1-12.5c9.2-3.5 17.8-7.4 25.3-11.4C134.1 343.3 169.8 352 208 352zM448 176c0 112.3-99.1 196.9-216.5 207C255.8 457.4 336.4 512 432 512c38.2 0 73.9-8.7 104.7-23.9c7.5 4 16 7.9 25.2 11.4c18.3 6.9 40.3 12.5 62.1 12.5c6.9 0 13.1-4.5 15.2-11.1c2.1-6.6-.2-13.8-5.8-17.9l0 0 0 0-.2-.2c-.2-.2-.6-.4-1.1-.8c-1-.8-2.5-2-4.3-3.7c-3.6-3.3-8.5-8.1-13.3-14.3c-5.5-7-10.7-15.4-14.2-24.7c24.9-29 39.6-64.7 39.6-103.4c0-92.8-84.9-168.9-192.6-175.5c.4 5.1 .6 10.3 .6 15.5z"/></svg>
|
After Width: | Height: | Size: 946 B |
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 net4people discussion but if they
|
||||
// do, add an icon.
|
||||
if field, ok := entry.Fields["net4people_url"]; ok {
|
||||
s := fmt.Sprintf("<a href='%s'>", field.String()) +
|
||||
`<img class="icon" title="net4people 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