Thanks to visit codestin.com
Credit goes to github.com

Skip to content

false Citeproc warning about missing citation #12136

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

Open
ThierryO opened this issue Feb 21, 2025 · 12 comments
Open

false Citeproc warning about missing citation #12136

ThierryO opened this issue Feb 21, 2025 · 12 comments
Assignees
Labels
books bug Something isn't working
Milestone

Comments

@ThierryO
Copy link
Contributor

Bug description

URLs containing an @ like https://mastodon.online/@inbo result in a false citeproc warning

[WARNING] Citeproc: citation inbo not found

Steps to reproduce

No response

Actual behavior

No response

Expected behavior

No response

Your environment

No response

Quarto check output

Quarto 99.9.9
[✓] Checking environment information...
Quarto cache location: /home/thierry/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 99.9.9
commit: 3aec7d3
Path: /home/thierry/quarto-cli/package/dist/bin

[✓] Checking tools....................OK
TinyTeX: v2024.12
Chromium: (not installed)

[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /home/thierry/.TinyTeX/bin/x86_64-linux
Version: 2024

[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /usr/bin/google-chrome
Source: PATH

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
Version: 3.12.3
Path: /usr/bin/python3
Jupyter: 5.3.2
Kernels: python3

(|) Checking Jupyter engine render....Traceback (most recent call last):
File "/home/thierry/quarto-cli/src/resources/jupyter/jupyter.py", line 21, in
from notebook import notebook_execute, RestartKernel
File "/home/thierry/quarto-cli/src/resources/jupyter/notebook.py", line 20, in
from nbclient import NotebookClient
ModuleNotFoundError: No module named 'nbclient'
[✓] Checking Jupyter engine render....OK

@ThierryO ThierryO added the bug Something isn't working label Feb 21, 2025
@mcanouil

This comment has been minimized.

@mcanouil mcanouil added the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Feb 21, 2025
@cderv
Copy link
Collaborator

cderv commented Feb 24, 2025

Thanks @mcanouil !

To be clear @ThierryO we fixed a similar issue while ago (2d3a5f9) and we may have missed some use case, but we need to know where this URL was provided in Quarto configuration, otherwise we don't know where to look.

@ThierryO
Copy link
Contributor Author

We use it in the navbar of a html book. The link provides a link to the relevant line in _quarto.yml. The file is part of a working example of a quarto extension.

@cderv
Copy link
Collaborator

cderv commented Feb 25, 2025

It seems exactly same usage as initial problem

Would it mean this is a regression 🤔 ?

We need to come up with a simple example to reproduce and add as a test project

@mcanouil
Copy link
Collaborator

I can't reproduce on a website.

Note that the project is far from a default project.
A book cannot have a navbar but here it has one.
My guess is that the issue comes from the extension rather than Quarto itself.

@ThierryO
Copy link
Contributor Author

Note that the project is far from a default project.

Yes. This is an extension providing our corporate identity.

A book cannot have a navbar but here it has one.

The documentation says otherwise

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 25, 2025

Indeed, sorry, I missed that, but now I confirm the issue is not Quarto (I mean it produces the right result, but with [WARNING] Citeproc: citation MickaelCanouil not found warning).

  1. quarto create project book
  2. _quarto.ml
project:
  type: book

book:
  title: "demo"
  author: "Norah Jones"
  date: "2/25/2025"
  navbar:
    pinned: true
    right:
      - text: Mastodon
        href: https://fosstodon.org/@MickaelCanouil
  chapters:
    - index.qmd
    - intro.qmd
    - summary.qmd
    - references.qmd

bibliography: references.bib

format:
  html:
    theme:
      - cosmo
      - brand
  pdf:
    documentclass: scrreprt
Image

@mcanouil
Copy link
Collaborator

The warning still not appear in website project, so it might be a Book project oversight from the last fix.

@ThierryO
Copy link
Contributor Author

I've created a minimal examples without extensions.

_quarto.yml

project:
  type: book

bibliography: references.bib

format:
  html: default

book:
  chapters:
    - index.md
  navbar:
    left:
      - text: Cover
        file: index.md
    right:
      - icon: mastodon
        href: https://mastodon.online/@inbo

index.md

# Abstract {-}

Excerpt on ecology taken from [Wikipedia](https://en.wikipedia.org/wiki/Ecology)

references.bib

@Misc{R-3.0.1,
  Title                    = {{R: A language and environment for statistical computing. Version 3.0.1}},

  Author                   = {{R Core Team}},
  Year                     = {2013},

  Address                  = {Vienna, Austria},
  Publisher                = {R Foundation for Statistical Computing},
  Url                      = {http://www.r-project.org/}
}

Console output of quarto render

pandoc 
  to: html
  output-file: index.html
  standalone: true
  toc: true
  number-sections: false
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  variables: {}
  
metadata
  crossref:
    chapters: true
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  bibliography:
    - references.bib
  
[WARNING] Citeproc: citation inbo not found
Output created: _book/index.html

@cderv cderv removed the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Feb 25, 2025
@cderv cderv self-assigned this Feb 25, 2025
@cderv cderv added the books label Feb 25, 2025
@cderv cderv added this to the v1.8 milestone May 6, 2025
@cderv
Copy link
Collaborator

cderv commented May 6, 2025

This still happen in this case because we do pass the book metadata (we do not for website nor for about which previous #3493 was about.

// Pass metadata to Pandoc. This metadata reflects all of our merged project and format
// metadata + the user's original metadata from the top of the document. Note that we
// used to append this to the end of the file (so it would always 'win' over the front-matter
// at the top) however we ran into problems w/ the pandoc parser seeing an hr (------)
// followed by text on the next line as the beginning of a table that was terminated
// with our yaml block! Note that subsequent to the original implementation we started
// stripping the yaml from the top, see:
// https://github.com/quarto-dev/quarto-cli/commit/35f4729defb20ceb8b45e08d0a97c079e7a3bab6
// The way this yaml is now processed relative to other yaml sources is described in
// the docs for --metadata-file:
// Values in files specified later on the command line will be preferred over those
// specified in earlier files. Metadata values specified inside the document, or by
// using -M, overwrite values specified with this option.
// This gives the semantics we want, as our metadata is 'logically' at the top of the
// file and subsequent blocks within the file should indeed override it (as should
// user invocations of --metadata-file or -M, which are included below in pandocArgs)
const metadataTemp = options.services.temp.createFile({
prefix: "quarto-metadata",
suffix: ".yml",
});
const pandocPassedMetadata = ld.cloneDeep(pandocMetadata);
delete pandocPassedMetadata.format;
delete pandocPassedMetadata.project;
delete pandocPassedMetadata.website;
delete pandocPassedMetadata.about;
// these shouldn't be visible because they are emitted on markdown output
// and it breaks ensureFileRegexMatches
cleanQuartoTestsMetadata(pandocPassedMetadata);
Deno.writeTextFileSync(
metadataTemp,
stringify(pandocPassedMetadata, {
indent: 2,
lineWidth: -1,
sortKeys: false,
skipInvalid: true,
}),
);
cmd.push("--metadata-file", metadataTemp);

Pandoc parses Metadata string as Mardown, and so it will resolve citation syntax in there unless escaped.

Unfortunately, escaping like

href: https://mastodon.online/\@inbo

does not work either because of #3493 fix as it will escape again

href: https://mastodon.online/\\@inbo

which modify the intent.

So this could be fixed in a scoped manner by also escaping in the pandoc metadata.

Or we could also see why book metadata is not deleted. But I think now it is too late to remove it as users expect meta shortcode to work on book meta.

For reference, this is the intermediate metadata file we pass to pandoc

crossref:
  chapters: true
document-css: false
link-citations: true
quarto-template-params:
  title-block-categories: 'true'
date-format: long
lang: en
fig-responsive: true
quarto-version: 99.9.9
bibliography:
  - references.bib
book:
  chapters:
    - index.md
  navbar:
    left:
      - text: Cover
        file: index.md
      - icon: mastodon
        href: https://mastodon.online/@inbo
    tools: []
  render:
    - type: chapter
      file: index.md
      depth: 0
toc-title: Table of contents

and why @inbo is parsed.

We could try escape, or use pandoc-native too maybe.

@ThierryO
Copy link
Contributor Author

ThierryO commented May 7, 2025

A workaround is to replace @inbo with @inbo.

@cderv
Copy link
Collaborator

cderv commented May 7, 2025

Thanks - this could be a better escape than replacing @ by \@ in our existing process 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
books bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants