jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Fix CSL rendering in case of article

Open koppor opened this issue 2 years ago • 7 comments

Fixes #8372 Fixes https://github.com/koppor/jabref/issues/514 Fixes https://discourse.jabref.org/t/unable-to-edit-my-bibtex-file-that-i-used-before-vers-5-1/2390/4 Fixes https://discourse.jabref.org/t/jabref-5-6-need-help-with-export-from-jabref-to-microsoft-word-entry-preview-of-apa-7-not-rendering-correctly/3462/6

Currently, only test cases showing the intended output are added. We still need to discuss where to put the translation logic. Since the CSL processor is not aware of bibtex/biblatex, we should do the translation based on the context. The translation logic is shown at https://github.com/JabRef/jabref/issues/8372#issuecomment-1014941935. The horizontal arrows mean: put at that place if not existant. A similar translationlogic (excel table style) is shown in https://github.com/JabRef/jabref/pull/8607#issuecomment-1210407418

Next steps:

  • [ ] Implement translation logic
  • [ ] Check if test cases match.
  • [ ] If tests do not match, think of the edge cases and fix them

  • [ ] Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • [ ] Tests created for changes (if applicable)
  • [ ] Manually tested changed features in running JabRef (always required)
  • [ ] Screenshots added in PR description (for UI changes)
  • [ ] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

koppor avatar Mar 26 '22 10:03 koppor

The logic for "translating" would be needed here: A while back I already passed down the bibdatabasecontext so we can get the mode.: https://github.com/JabRef/jabref/blob/b16160e5ab0fd9dc3aefc6824f55739b40d3a986/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java#L97-L126

Siedlerchr avatar Mar 26 '22 10:03 Siedlerchr

Current state: At test 13, we pass both issue and number to CSL Proc, but not a "page", it is not displayed.

grafik

We tried to put "777" in the pages, it works. "Article 777" in pages has maybe issues...

koppor avatar Mar 28 '22 22:03 koppor

I think this fixes also https://discourse.jabref.org/t/unable-to-edit-my-bibtex-file-that-i-used-before-vers-5-1/2390/4 and https://github.com/koppor/jabref/issues/514

ThiloteE avatar Apr 30 '22 15:04 ThiloteE

Let's create a spreadsheet /matrix with bibtex fields and their mappings and biblatex fields then we can better check the test cases. And a condition column

Siedlerchr avatar Aug 10 '22 08:08 Siedlerchr

BibTeX BibLaTeX EntryPreview/CSL proposed logic, conditions and info
volume volume volume
number issue issue For conversion to CSL or BibTeX: BibLaTeX number takes priority and supersedes BibLaTeX issue
number number issue For conversion to CSL or BibTeX: BibLaTeX number takes priority and supersedes BibLaTeX issue
pages eid number Some journals put the article-number (= eid) into the pages field. If BibLaTeX eid exists, provide csl number to the style. If pages exists, provide csl page. If eid WITHIN the pages field exists, detect the eid and provide csl number. If both eid and pages exists, ideally provide both csl number and csl page. Ideally the citationstyle should be able to flexibly choose the rendering. If this is not possible then map biblatex eid to CSL page, since this is sufficient to comply with APA 7th edition, but will break other citationstyles (e.g. IEEE)
pages pages page Some journals put the article-number (= eid) into the pages field. If BibLaTeX eid exists, provide csl number to the style. If pages exists, provide csl page. If eid WITHIN the pages field exists, detect the eid and provide csl number. If both eid and pages exists, ideally provide both csl number and csl page. Ideally the citationstyle should be able to flexibly choose the rendering. If this is not possible then map biblatex eid to CSL page, since this is sufficient to comply with APA 7th edition, but will break other citationstyles (e.g. IEEE)

ThiloteE avatar Aug 10 '22 09:08 ThiloteE

TIL: Apa CSL has no field number

Siedlerchr avatar Aug 10 '22 18:08 Siedlerchr

Known problems of this implementation (edited):

  1. A negative tradeoff between rendering IEEE or APA style correctly. The CSL APA citationstyle is not able to render "number" (even though it should. This is tracked in https://github.com/citation-style-language/styles/issues/5827) How to deal with this? - For JabRef, the first option would be to map eid to the page field, otherwise eid will not get rendered at all. Unfortunately this would mean that the IEEE citationstyle now renders article numbers in the pages field and in the eid field with p. prefixed. Since users have the option to move data from the eid field to the pages field with JabRef's new "automatic entry editor", they will be able to render article numbers even with APA style via workaround. Hence, I went with the second option, mapping Biblatex eid to CSL number, which is the correct thing to do if purely following the Biblatex and CSL standards documentation. Once CSL APA style supports the "number" field, JabRef will only have to update a few test cases, but not change its biblatex to csl translation logic.

  2. The biblatex issue field will only get rendered, if there is no number field present in the entry. If both are present, the biblatex number field takes priority.

Overall though, I would suggest this to be an improvement to the status quo.

ThiloteE avatar Aug 10 '22 23:08 ThiloteE

Waiting a little bit for CSL maintainers to potentially refactor the APA Styles. Tracked in https://github.com/citation-style-language/styles/issues/5827. We have time until JabRef 5.8 will be released anyway....

ThiloteE avatar Aug 12 '22 11:08 ThiloteE