Skip to content

Add formatting attribute to support more bibliography styles - #344

Open
pluto-han wants to merge 1 commit into
michel-kraemer:masterfrom
pluto-han:fix-bibliography-style
Open

Add formatting attribute to support more bibliography styles#344
pluto-han wants to merge 1 commit into
michel-kraemer:masterfrom
pluto-han:fix-bibliography-style

Conversation

@pluto-han

@pluto-han pluto-han commented Aug 13, 2026

Copy link
Copy Markdown

Hi @michel-kraemer, I am a GSoC student in @JabRef working on my project Improved LibreOffice-JabRef integration.

Thank you very much for your work!

Follow up #338
Refs JabRef/jabref#16555 (comment)

Issue

Formatting attributes on cs:date and cs:date-part elements are currently not preserved in rendered output.

For example, Advanced Functional Materials marks a date as bold:

<date variable="issued" font-weight="bold">
  <date-part name="year"/>
</date>

But citeproc-java produces the following HTML output:

<div class="csl-entry">
  <div class="csl-left-margin">[1] </div><div class="csl-right-inline">M. Macht, J. Mueller, <span style="font-style: italic">Appetite</span> 2007, <span style="font-style: italic">49</span>, 667.</div>
</div>

Rendered output:
[1] M. Macht, J. Mueller, Appetite 2007, 49, 667.
As seen in JabRef -
image

Expected:
[1] M. Macht, J. Mueller, Appetite 2007, 49, 667.
As seen in Zotero -
image

(The following part was generated by gpt 5.5 and reviewed & edited by me)

Cause/Analysis

SDate and SDatePart parse affixes and other date-specific behavior, but they do not read or apply FormattingAttributes.

This means formatting attributes such as font-weight, font-style, vertical-align, etc. are ignored when they are placed directly on cs:date or cs:date-part.

Fix

This change adds FormattingAttributes support to both date rendering classes:

  • SDate now reads formatting attributes from the cs:date node and emits the rendered date content with those attributes.
  • SDatePart now reads formatting attributes from the cs:date-part node and emits the rendered date part value with those attributes.

Affix handling remains unchanged, so this does not widen the special cs:layout affix behavior fixed in #338 to other rendering elements.

Tests

Added a regression test covering both cases:

  • formatting attributes on cs:date
  • formatting attributes on cs:date-part

The test verifies that HTML output preserves the expected formatting, e.g.:

<span style="font-weight: bold">2007</span>

I ran:

JAVA_HOME=$(/usr/libexec/java_home -v 17) ./gradlew :citeproc-java:test

and all tests pass.

@pluto-han

Copy link
Copy Markdown
Author

cc @subhramit @Siedlerchr

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant