Skip to content

CSL4LibreOffice - C [GSoC '24]#11577

Merged
Siedlerchr merged 105 commits into
JabRef:mainfrom
subhramit:make-bibliography
Aug 12, 2024
Merged

CSL4LibreOffice - C [GSoC '24]#11577
Siedlerchr merged 105 commits into
JabRef:mainfrom
subhramit:make-bibliography

Conversation

@subhramit

@subhramit subhramit commented Aug 4, 2024

Copy link
Copy Markdown
Member

New features for CSL-OO/LO integration

[PR - C of the GSoC '24 CSL4LibreOffice Project]
Follow-up to #11521

Summary:

  • Implemented "reference marks" to fix resetting index issue for numeric CSL styles
  • Added feature to auto-generate and sync a bibliography section (list of references) in the LibreOffice document based on existing citations
  • Added support for in-text citations and empty citations for CSL styles
  • Added support for underlined CSL styles
  • Added support for alphanumeric CSL styles
  • Implemented "smart spaces" feature for CSL citation insertion
  • Miscellaneous refinement and additions (e.g. new icon for "add bibliography", fixed extra newlines in case of numeric styles, disabled irrelevant buttons when CSL style is selected, upgraded to StAX parsing for information from .csl files etc.)

Background:

  • Problem 1: The behavior of in-text citations was independent of bibliographic citations, even if they corresponded to the same entry. For example, they could have different numbering (for numeric styles).
  • Problem 2: As mentioned by @Siedlerchr in CSL4LibreOffice - B [GSoC '24] #11521 (comment), a major inconvenience while citing entries independently was that the numbering index (for numeric citation styles) would get reset to 1 every time.
  • Problem 3: We first tried ways to persist consistent numbering within an OO session, the numbering would get reset again on restarting JabRef or reconnecting/restarting the LibreOffice document instance.
  • Problem 4: There was no availability of a "make bibliography" feature that would automatically read the in-text citations in the document and generate a bibliography consisting of corresponding bibliographic citations.

This PR addresses these problems by introducing two new features to JabRef's OO/LO integration - (A) Reference Marks and (B) Auto-generation of bibliography.

Demos:

  • We can now seamlessly insert citation entries (both independently or in a grouped fashion) without having to worry about maintaining the numbering across citations of any type. The numbers are maintained consistently using Reference Marks attached to citation entries.
  • We can now auto-insert bibliography into the document based on our in-text citations by pressing the loop arrow ("Make bibliography") button in the OpenOffice panel.
testVideo.mp4
  • The citation numbers are now maintained consistently across JabRef and OO/LO sessions by reading existing Reference Marks in the document.
test2.mp4
  • The implementation of the internal format of Reference Marks is very similar to that of Zotero, which consists of "JABREF_{citationKey} CID_{citationNumebr} {UID}".

Special thanks to @antalk2, who had worked on similar problem statements for JStyles for JabRef's OO/LO integration, for his help in guiding and making this PR possible.

Follow-up: #11636, #11712

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.

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2024
@subhramit subhramit enabled auto-merge August 12, 2024 20:10
Siedlerchr
Siedlerchr previously approved these changes Aug 12, 2024
@Siedlerchr Siedlerchr disabled auto-merge August 12, 2024 20:29
@Siedlerchr Siedlerchr merged commit 8bf6f05 into JabRef:main Aug 12, 2024
@Siedlerchr Siedlerchr deleted the make-bibliography branch August 12, 2024 20:29
@koppor

koppor commented Aug 12, 2024

Copy link
Copy Markdown
Member

Next time, please do look into the small red crosses on GitHub!

image

Fixed by @Siedlerchr #11616 (needed to hurry up, because our tests on main branch were red after the merge)

@subhramit

subhramit commented Aug 12, 2024

Copy link
Copy Markdown
Member Author

Next time, please do look into the small red crosses on GitHub!

image

Fixed by @Siedlerchr #11616 (needed to hurry up, because our tests on main branch were red after the merge)

For some reason:

  1. Initially, for the last 30 commits at least, only fetcher tests were failing
  2. First time the merge failed, only fetcher and checkstyle were red.
  3. Second time the merge failed, only fetcher test was red (even though architecture and checkstyle error still existed).
  4. At no point previously the unit tests were red. Only fetcher and JDK deployment tests started failing the last time.
  5. Finally unit tests panicked after merge.

@subhramit

Copy link
Copy Markdown
Member Author

Look at this:
image
(from cc36acc or any commit above).

@subhramit

subhramit commented Aug 12, 2024

Copy link
Copy Markdown
Member Author

Look at this:
image
(from cc36acc or any commit above).

Delayed panic of tests fixed in #11615

@koppor

koppor commented Aug 13, 2024

Copy link
Copy Markdown
Member
  1. At no point previously the unit tests were red. Only fetcher and JDK deployment tests started failing the last time.

My screenshot is from this PR and shows the red cross.

It was the last merge queue attempt.

Fortunately, triggered by this, we fixed our CI and itwill.be more easy to see the errors. 🎉

  1. Finally unit tests panicked after merge.

The PR was merged without using the merge queue. Thus, the (failing) tests by the merge queue were skipped.

@koppor

koppor commented Aug 13, 2024

Copy link
Copy Markdown
Member

Now, we all learned about the difference of "pull_request" and "pull_request_target" the long way 😅

@subhramit

Copy link
Copy Markdown
Member Author

Major follow-up PR (apart from PR-D): #11712
[Adds number re-distribution for citations].

@koppor

koppor commented Mar 25, 2025

Copy link
Copy Markdown
Member

Decision to leave the bibliography title format

@subhramit I hope that when a user changes the text / formatting manually, this change is NOT overwritten, but kept?

Typically, paper templates provide formatting guidelines and names to headings.

@subhramit

subhramit commented Mar 25, 2025

Copy link
Copy Markdown
Member Author

I hope that when a user changes the text / formatting manually, this change is NOT overwritten, but kept?

If by manually, you mean without JabRef, then unfortunately the entire section is detected and re-generated, and that I don't know if it is possible to detect and avoid.

If you are referring to PR #12784:
This gives the user flexibility to set the text (any) and formatting (as per popular formats) if it coincides with the templates you are talking about. If the formatting is not in the list, they can always overwrite it manually at the end of their work - which is very doable. Point of the PR was to enable JabRef reduce the user's effort a bit more - earlier it was more disadvantageous as both the text and the format were hardcoded, and the user would have to manually change both of them at the end anyway (if other text/formats were needed).

@koppor

koppor commented Mar 25, 2025

Copy link
Copy Markdown
Member

If by manually, you mean without JabRef, then unfortunately the entire section is detected and re-generated, and that I don't know if it is possible to detect and avoid.

Yes.

  1. Before regeneration: Search for heading, store attributes (style, text)
  2. Regenerate
  3. Restore style from step 1.

But the solution of #12784 also seems to be OK.

@subhramit

subhramit commented Mar 25, 2025

Copy link
Copy Markdown
Member Author
  • Before regeneration: Search for heading, store attributes (style, text)
  • Regenerate
  • Restore style from step 1.

Difficult task development-wise using UNO (and would add more lag in auto-refresh mode), compared to tiny effort by user if they just change at the end...
Can of worms:
If in future we have unified style-switching across style families, this will get even more complicated (e.g. CSL -> JStyle: Respect what's specified in the .jstyle file or prioritize user's manual changes and conditionally disable those properties in the jstyle, and so on - style-dependent implementations would be needed for a tiny thing).

@subhramit

subhramit commented Mar 25, 2025

Copy link
Copy Markdown
Member Author

If in future we have unified type-switching across style families, this will get even more complicated (e.g. CSL -> JStyle: Respect what's specified in the .jstyle file or prioritize user's manual changes and conditionally disable those properties in the jstyle, and so on - style-dependent implementations would be needed for a tiny thing).

I think I just invited an additional ADR for whoever works on this. 😄

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.

5 participants