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

Abierto
#1,407 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
54/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
lua, rust
Área
api, backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Rust
Estrellas
316
Forks
23
Merge medio
11 h 49 min
PR fusionados (30 d)
245

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quarto-dev/q2

Todos los issues de quarto-dev/q2

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.