JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.58k stars 2.49k forks source link

Support Citation Style Language (CSL) Styles in LibreOffice/OpenOffice - University Project #8893

Closed ThiloteE closed 2 months ago

ThiloteE commented 2 years ago

This issue here is supposed to be for students and tries to explain the issue more clearly and broader as is done in the original issue (#2146). It also aims at preventing external CSL maintainers from being spammed with too many unnecessary JabRef related messages and requests.

Background info:

For the OpenOffice (OO) and LibreOffice (LO) integration, JabRef offers to format citations in various Styles. These styles are also referred to as JStyles. They are used by importing OO/LO Style files into JabRef. Please check out JabRef's LO/OO documentation for further information.

grafik

Problems:

  1. The amount of JStyles offered by JabRef is very low.
  2. Important and popular ones like APA, IEEE and others are missing.
  3. Users having to create or adjust JStyle files is undesirable for various reasons:
    • Users may not have the expertise
    • Users may not have the time

Solution:

Support Citation Style Language (CSL) Styles in the LO/OO integration as originally proposed in #2146. That means, users should be able to select CSL styles somewhere in the "select styles" dialogue of the OO/LO integration.

There could potentially be two tabs: One for CSL styles, a separate tab for Jstyles.

ThiloteE commented 2 years ago

Additional Info: Documentation of the current OpenOffice integration code:

Additional Info: How JabRef currently uses CSL:

Siedlerchr commented 2 years ago

Some hints on the code: JabRef calls the UNO API of LibreOffice to insert formatted text into the Writer Document. Roughly the approach is as follows for this here as well:

  1. get the CSL->HTML for the bibliography (See Preview classes)
  2. convert the HTML to OO-Text (these methods already exist, see for example formatFullReferenceOfBibEntry )

A difference: JabRef's jstyle format also controls the formatting of the in text citation and if it should be author year or numeric This needs to be considered as well. Therefore, I would suggest starting with the formatting of the list of references.

iandol commented 2 years ago

The documentation «Documentation of the current OpenOffice integration code» link is a 404, is this the current location?

https://devdocs.jabref.org/code-howtos/openoffice/

ThiloteE commented 2 years ago

The documentation «Documentation of the current OpenOffice integration code» link is a 404 [...]

@iandol thx, I fixed it.

ThiloteE commented 9 months ago

This seems to be the main function that needs to be called to insert html formated text: https://github.com/JabRef/jabref/blob/cbf99ec7e6eb1c627dae6af44931998eefbca59c/src/main/java/org/jabref/model/openoffice/ootext/OOTextIntoOO.java#L100-L131

This is the class the currently generates our custom JStyle format export layout: https://github.com/JabRef/jabref/blob/27a22af6eb400d4e2fe2b7c49c3baf05c9e3e221/src/main/java/org/jabref/logic/openoffice/style/OOBibStyle.java#L58

Siedlerchr commented 4 months ago

Some additional stuff. Citeproc-java can render both the citation and the bibliography (list of references)

Current state: JabRef only renders the bibliography JabRef's CSLAdapter class needs to be extended to support making the citation as well, but that is simple: cslInstance.makeCitation( id ) where id would be the citation key