Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSL support #2082

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

Omikhleia
Copy link
Member

@Omikhleia Omikhleia commented Jun 29, 2024

Work in-progress (currently based on the branch for #2071 -- leveraging some of the code introduced there)

Closes #2074

Saving my code as a "checkpoint" since it already does nice things (see screenshots in the referred issue).

In order to support CSL (Citation Style Language), we need to:

  • Convert the BibTeX entries to CSL format.
  • Use a CSL engine to format the citations and bibliography references. It boils down to:
    • Support CSL locales
    • Support CSL styles
    • Implement the CSL processor/renderer

Regarding the conversion of BibTeX entries, the mappings are not straightforward, but there is some prior art that we can check... None of the implementations I checked did the exact same things, so it's likely a bit messy...

Regarding the CSL engine, there are various existing implementations.
Yet, I had a look at them, and I am not really convinced by their code quality, so I went implementing the CSL 1.0.2 specifications from scratch. Because it's fun, and SILE has the guts to do it. And because I think I can.

Additionally, this would also close several other items.

Closes #2024 = The CSL locales takes care of it.

Closes #2022 = The CSL styles have appropriate fallbacks (substitutes, conditionals, etc.)

Closes #2027 = The CSL styles and locales define how to format localized dates in the selected citation or bibliography style.

@Omikhleia Omikhleia requested a review from alerque as a code owner June 29, 2024 06:40
@Omikhleia Omikhleia marked this pull request as draft June 29, 2024 06:40
csl/core/engine.lua Outdated Show resolved Hide resolved
csl/core/engine.lua Outdated Show resolved Hide resolved
csl/core/engine.lua Outdated Show resolved Hide resolved
csl/core/engine.lua Outdated Show resolved Hide resolved
@Omikhleia Omikhleia force-pushed the bibliography-csl branch 3 times, most recently from 0f5d659 to 330cd9d Compare July 14, 2024 18:57
@Omikhleia
Copy link
Member Author

2024/07/14 "Stage 0" milestone: Successfully processed 1355 references

  • with en-US locale and styles chicago-author-date, chicago-fullnote-bibliography and apa.
  • with fr-FR locale and styles chicago-author-date, chicago-author-date-fr, chicago-fullnote-bibliography-fr and apa

@Omikhleia
Copy link
Member Author

2024/07/20 "Stage 1" milestone: Successfully processed 1508 references,

  • with entry sorting according to the CSL style.
  • tested with fr-FR locale and styles chicago-author-date-fr, chicago-fullnote-bibliography-fr
  • Some entries have belong to numbered "series" (a.k.a. collection-title and collection-number in CSL)

@Omikhleia
Copy link
Member Author

Soon leaving for vacations, so here are just some advancement notes to myself, in order to remember:

  • Stage 2 = implement subsequent-author-substitute (I had it done more or less this week-end on an experimental ground, but I'm unhappy with the code so I didn't push it... I prioritized working on my bib files, now over 2000 references, and couldn't finish that code properly today...)
  • Stage 3 = implement page-range-delimiter so page ranges would look decent...
  • Stage 4 = Understand how to handle properly demoting/non-demoting particles in names (I've some of these in my bibliography files, so I guess it's time to dig into the topic...)
  • Stage 5 = review package commands for multiple citations, and implement "locators".

That's a minimal set. There would still be a few missing features from the CSL spec, but at least all Chicago-styles would be covered fairly decently, and a first milestone would be passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
3 participants