Lua API to list the references of a document, like pandoc.utils.references

Aperta
#1,407 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
lua, rust
Ambito
api, backend

Direzione di ricerca

Start by reading crates/pampa/src/lua/utils.rs, where the issue says Lua utilities are registered, and trace how q2's citeproc reads document references. The goal is a Lua-accessible function returning those same references with at least their id; verify that a filter can distinguish reference IDs from other @ syntax. The issue does not name tests, so find the relevant Lua API or citation tests before implementing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

Quarto 1 filters can call pandoc.utils.references(doc) to get the references that a document defines, from its references metadata and its bibliography files.
q2 resolves citations in its own citeproc, but no Lua function gives that list: pandoc.utils.references is nil in q2 0.48.0-nightly.20261126, and crates/pampa/src/lua/utils.rs does not register it.

Filters use this list to tell a real citation from other @ syntax.
For example, quarto-gitlink turns @user into a link to a GitHub profile, but leaves @key alone when key is a reference id.
Without the list, a filter cannot know which Cite elements q2 will resolve.
It has to keep every citation as is, or risk turning a reference into a user link.

function Pandoc(doc)
  -- Quarto 1: a list of references with an `id` field.
  -- q2: attempt to call a nil value (field 'references').
  for _, ref in ipairs(pandoc.utils.references(doc)) do
    quarto.log.output(ref.id)
  end
end

It would help to have pandoc.utils.references, or a function in the quarto namespace, that returns the same references q2's citeproc reads, with at least their id.
Parsing the bibliography files from Lua is the only alternative, and that means support for BibTeX, CSL JSON and CSL YAML in each filter.

Related: https://github.com/quarto-dev/q2/discussions/1112

Lingua principale
Rust
Stelle
316
Fork
23
Merge medio
11h 49m
PR unite (30g)
245

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quarto-dev/q2

Tutte le issue di quarto-dev/q2

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.