Skip to content

CSL4LibreOffice - A [GSoC '24]#11477

Merged
koppor merged 59 commits into
JabRef:mainfrom
subhramit:oo-csl
Jul 15, 2024
Merged

CSL4LibreOffice - A [GSoC '24]#11477
koppor merged 59 commits into
JabRef:mainfrom
subhramit:oo-csl

Conversation

@subhramit

@subhramit subhramit commented Jul 10, 2024

Copy link
Copy Markdown
Member

Functionality to use CSL Style citations in OO/LO

Closes #8893
Closes #2146

[PR-A of the GSoC '24 CSL4LibreOffice Project]

Summary:

  • Added functionality to select a CSL style from the "Select style" dialog
  • Added functionality to preview the selected CSL style (in bibliography form on a test entry) in the dialog
  • Added functionality to insert citations and bibliographic entries into a running LibreOffice document with the selected CSL style [by transforming HTML generated by citeproc-java into a format that can be parsed by OOTextIntoOO#write].

To insert a CSL Style Citation into the document:

  1. Open a library in JabRef
  2. Connect it to a running LibreOffice document instance (https://docs.jabref.org/cite/openofficeintegration)
  3. Press the "Select Style" button on the OpenOffice panel
  4. You will see the following window with two tabs, representing CSL Styles and JStyles. By default, the "CSL Styles" tab will be active. Select a CSL Style:
    image
  5. In the library, select an entry or a group of entries to cite
  6. Press "Cite" in the OO Panel to insert bibliography, or press "Cite in-text" to insert in-text citation

Follow-up: #11521

Mandatory checks

  • 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 developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • 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.

subhramit added 30 commits May 31, 2024 20:24
@subhramit

subhramit commented Jul 11, 2024

Copy link
Copy Markdown
Member Author
  • When I reopen the dialog "Style selection", the previously selected style should be selected.

This one seems slightly more complex. Planning on a separate PR for this.
Could @koppor or @LoayGhreeb outline some steps?
A slightly easier approach seems to be to render the title and preview of the last selected style in the Preview section below in the Style Select dialog, and then letting the user select it again. Would this suffice?

@LoayGhreeb

Copy link
Copy Markdown
Member
  • When I reopen the dialog "Style selection", the previously selected style should be selected.

This one seems slightly more complex. Planning on a separate PR for this.

You can use the "Global Search window" as an example for this. Instead of creating a new dialog every time, you can create one dialog show and hide it. This approach will prevent losing the selection state.

checkout:

openGlobalSearchButton.setOnAction(evt -> {
globalSearchActive.setValue(true);
if (globalSearchResultDialog == null) {
globalSearchResultDialog = new GlobalSearchResultDialog(undoManager, tabContainer);
}
stateManager.activeGlobalSearchQueryProperty().setValue(searchQueryProperty.get());
updateSearchQuery();
dialogService.showCustomDialogAndWait(globalSearchResultDialog);
globalSearchActive.setValue(false);
});

@koppor

koppor commented Jul 11, 2024

Copy link
Copy Markdown
Member

You can use the "Global Search window" as an example for this. Instead of creating a new dialog every time, you can create one dialog show and hide it. This approach will prevent losing the selection state.

Nice. After restart of JabRef, the style should also be selected. I assume that that style to be used is stored in the preferences? Is it stored in LibreOffice only? I would put it into the preferences and based on that lookup it the table.

(Haven't looked into the code itself. Just assumptions. If I looked in the code I would search for: Where is the reference of the current style held. Where does the dialog put it? Can the dialog also read it from there? If not, where can it be persisted?)

@Siedlerchr

Copy link
Copy Markdown
Member

Current selected style should be stored in Open Office Preferences

@koppor koppor added this to the 6.0-alpha milestone Jul 15, 2024
@koppor

koppor commented Jul 15, 2024

Copy link
Copy Markdown
Member

Follow-up PR: subhramit#7

@koppor koppor enabled auto-merge July 15, 2024 19:24

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DevCall: This is OK to go through, JavaDoc for the OO thing is very optional (it was existing before). Let's focus on

a) the architecture (subhramit#7) and
b) preferences (should be done in the next days)

@koppor koppor added this pull request to the merge queue Jul 15, 2024
Merged via the queue into JabRef:main with commit 003587c Jul 15, 2024
@koppor koppor mentioned this pull request Jul 15, 2024
6 tasks
@subhramit

subhramit commented Jul 15, 2024

Copy link
Copy Markdown
Member Author

DevCall: This is OK to go through, JavaDoc for the OO thing is very optional (it was existing before). Let's focus on

a) the architecture (subhramit#7) and b) preferences (should be done in the next days)

Refinement for future reference: OO thing refers to possible tests of XTextDocument doc and XTextCursor cursor.
These tests would be dependent on description of these parameters, which would be added soon. However, since these parameters were existing already since OOBibStyle existed (pipeline to push JStyle bibliography into OO) and being used, the tests were deemed optional for our present purposes.

@subhramit

subhramit commented Jul 15, 2024

Copy link
Copy Markdown
Member Author

DevCall: This is OK to go through, JavaDoc for the OO thing is very optional (it was existing before). Let's focus on

a) the architecture (subhramit#7) and b) preferences (should be done in the next days)

More context: The preferences storage feature subhramit#6 (b) is currently dependent on the architecture (a), so both of the above are coupled, hence we'll try to finish them both together [PR - B of the project].
c) A preliminary blog post to be written giving a walkthrough regarding how to use the current CSL Bibliography features.
d) Pending JavDoc documentation.

Siedlerchr added a commit to subhramit/jabref that referenced this pull request Jul 19, 2024
* upstream/main:
  Fix NPE when saving preferences (JabRef#11509)
  Switch to stream-based loading (JabRef#11479)
  Save unlinked local files dialog prefs (JabRef#11493)
  Add minimal support for biblatex data annotations (JabRef#11506)
  Fix handling of relative-file storage and auto linking (JabRef#11492)
  New Crowdin updates (JabRef#11504)
  Add missing issue numbers
  CSL4LibreOffice - A [GSoC '24] (JabRef#11477)
  Bump src/main/resources/csl-styles from `b2be5ae` to `fd6cb3e` (JabRef#11501)
  Bump gittools/actions from 1.1.1 to 1.2.0 (JabRef#11500)
  Bump com.kohlschutter.junixsocket:junixsocket-core from 2.9.1 to 2.10.0 (JabRef#11498)
  Bump commons-logging:commons-logging from 1.3.2 to 1.3.3 (JabRef#11499)
  Bump org.jsoup:jsoup from 1.17.2 to 1.18.1 (JabRef#11497)
  Bump com.kohlschutter.junixsocket:junixsocket-mysql from 2.9.1 to 2.10.0 (JabRef#11496)
  Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.14.0 to 2.15.0 (JabRef#11495)
  FAQ updates (JabRef#11486)
  Update Gradle Wrapper from 8.8 to 8.9.
  Fix Chocolate.bib (JabRef#11491)

# Conflicts:
#	src/main/java/org/jabref/gui/openoffice/OOBibBase.java
#	src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
#	src/main/java/org/jabref/gui/openoffice/StyleSelectDialogView.java
#	src/main/java/org/jabref/gui/openoffice/StyleSelectDialogViewModel.java
#	src/main/java/org/jabref/preferences/JabRefPreferences.java
@subhramit subhramit mentioned this pull request Jul 21, 2024
6 tasks
@subhramit

Copy link
Copy Markdown
Member Author

Follow-up PR: #11521

@subhramit subhramit mentioned this pull request Aug 16, 2024
6 tasks
@subhramit subhramit mentioned this pull request Sep 2, 2024
6 tasks
@subhramit

subhramit commented Mar 26, 2025

Copy link
Copy Markdown
Member Author

Pending ADR based on comment #12784 (comment), behind the introduction of CSLCItationOOAdapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Citation Style Language (CSL) Styles in LibreOffice/OpenOffice - University Project Support Citation Style Language (CSL) Styles in LO/OO

4 participants