Skip to content

Enrich CSL Reference mark format with citation type information #15370

@subhramit

Description

@subhramit

Pre-requisites

  1. Context about JabRef's LibreOffice integration
  2. Refer to this blog article for an introduction to how CSL styles are used with JabRef's LibreOffice integration.
  3. Go through LO/OO: Retain in-text nature when re-rendering CSL citations #15369

Problem Statement

Quoting from #15369 (comment)

A more robust solution would be to embed the in-text nature in the CSL reference mark itself (like we do in JStyles), and when parsing the existing reference marks from the doc, use that piece of data to set whether inTextUsed is true, as otherwise there would be no way to retain the correct information if JabRef is restarted after using in-text citations - and thus generating bibliography would still refresh and overwrite them to normal citations.
Current workaround to that (if in-text citations were used and JabRef was restarted and now bibliography is to be generated without inserting another citation) is to insert another in-text citation and remove it to refresh the internal state. Similarly, if in-text citations were used and JabRef is restarted, and now the user wants to change the citation type to normal citations, they have to manually refresh the nature (to in-text and back to normal by inserting citations of respective styles once, and removing them).

This would involve two parts -

  1. Redesigning and re-implementing the reference mark format
  2. Re-implementing the parsing logic and wiring the in-text related data with the existing related boolean variables (See changes in LO/OO: Retain in-text nature when re-rendering CSL citations #15369 for more information).

This refs the GSoC project of cross compatible reference marks (https://github.com/JabRef/GSoC/blob/main/_posts/2025-12-26-libreoffice.md)
This can be solved within the project, or independently.

Additional context
See how JStyle embeds style type information:
https://devdocs.jabref.org/code-howtos/openoffice/overview.html#what-is-stored-in-a-document-jabref52

Format: "JR_cite{number}{type}{citationKeys}", where
{number} is either empty or an unsigned integer (it can be zero) to make the name unique
{type} is 1, 2, or 3 for parenthesized, in-text and invisible
{citationKeys} contains the comma-separated list of citation keys
Examples:
JR_cite_1_Smith2000 (empty number part, parenthesized, single citation)
JR_cite0_2_Smith2000,Jones2001 (number part is 0, in-text, two citations)
JR_cite1_3_Smith2000,Jones2001 (number part is 1, invisible, two citations)

Metadata

Metadata

Assignees

No fields configured for feature.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions