monperrus / bibtexbrowser

Beautiful publication lists with bibtex and PHP (standalone or in Wordpress)
http://www.monperrus.net/martin/bibtexbrowser/
84 stars 54 forks source link

only display [pdf] if it is really a pdf, else use field name #96

Closed jenskober closed 5 years ago

jenskober commented 5 years ago

BIBTEXBROWSER_PDF_LINKS adds a [pdf] link no matter whether the field pdf/url/file really points to a PDF or not. My new option BIBTEXBROWSER_DOCUMENT_LINKS does a sanity check based on the file extension and if this is not .pdf uses the field name instead. This version display all of the fields it finds (which I use if there is a publisher website but no DOI additionally to the PDF link)

monperrus commented 5 years ago

Instead of adding a new configuration option, I would propose to slightly change the logic of BIBTEXBROWSER_PDF_LINKS and clearly document it. Could you add a test case?

jenskober commented 5 years ago

Yes, I'll add a test case (hopefully tonight). I'll remove the new option so that it's effectively only a slight change of BIBTEXBROWSER_PDF_LINKS

jenskober commented 5 years ago

@monperrus Is this (roughly) what you had in mind?

monperrus commented 5 years ago

Changed it a little bit. OK for you?

jenskober commented 5 years ago

Fine for me.

I changed one comment to conform with the new function names and modified the test to a truly unknown extension.

If we display a link to a .html as [pdf], I'd suggest you add another line to display a link to .htm also as [pdf]

monperrus commented 5 years ago

Many thanks Jens.