quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.95k stars 326 forks source link

bug in YAML handling of double-quoted scalar strings #1838

Closed jooyoungseo closed 2 years ago

jooyoungseo commented 2 years ago

When bibliographies are imported directly via a csl yaml, I do see following error:

in JSON at position 60xpected token

However, if you save and render the same file content in Rmd with output: html_document, you don't see any errors.

Reprex

test.qmd


---
title: "Test"
format: html
references:
- author:
  - literal: R Core Team
  id: R-base
  issued: 2022
  publisher: R Foundation for Statistical Computing
  publisher-place: Vienna, Austria
  title: "R: A language and environment for statistical computing"
  title-short: R
  type: book
  url: "https://www.R-project.org/"
- author:
  - family: Godfrey
    given: A. Jonathan R.
  - family: Warren
    given: Debra
  - family: Murrell
    given: Paul
  - family: Bilton
    given: Timothy
  - family: Sorge
    given: Volker
  id: R-BrailleR
  issued: 2021
  note: R package version 0.32.1
  title: "BrailleR: Improved access for blind users"
  title-short: BrailleR
  type: book
  url: "https://github.com/ajrgodfrey/BrailleR"
- author:
  - family: McWhite
    given: Claire D.
  - family: Wilke
    given: Claus O.
  id: R-colorblindr
  issued: 2022
  note: R package version 0.1.0
  title: "Colorblindr: Simulate colorblindness in r figures"
  title-short: Colorblindr
  type: book
  url: "https://github.com/clauswilke/colorblindr"
- author:
  - family: Ihaka
    given: Ross
  - family: Murrell
    given: Paul
  - family: Hornik
    given: Kurt
  - family: Fisher
    given: Jason C.
  - family: Stauffer
    given: Reto
  - family: Wilke
    given: Claus O.
  - family: McWhite
    given: Claire D.
  - family: Zeileis
    given: Achim
  id: R-colorspace
  issued: 2022
  note: R package version 2.0-3
  title: "Colorspace: A toolbox for manipulating and assessing colors
    and palettes"
  title-short: Colorspace
  type: book
  url: "https://CRAN.R-project.org/package=colorspace"
- author:
  - family: Wickham
    given: Hadley
  - family: François
    given: Romain
  - family: Henry
    given: Lionel
  - family: Müller
    given: Kirill
  id: R-dplyr
  issued: 2022
  note: R package version 1.0.9
  title: "Dplyr: A grammar of data manipulation"
  title-short: Dplyr
  type: book
  url: "https://CRAN.R-project.org/package=dplyr"
- author:
  - family: Wickham
    given: Hadley
  id: R-forcats
  issued: 2021
  note: R package version 0.5.1
  title: "Forcats: Tools for working with categorical variables
    (factors)"
  title-short: Forcats
  type: book
  url: "https://CRAN.R-project.org/package=forcats"
- author:
  - family: Wickham
    given: Hadley
  - family: Chang
    given: Winston
  - family: Henry
    given: Lionel
  - family: Pedersen
    given: Thomas Lin
  - family: Takahashi
    given: Kohske
  - family: Wilke
    given: Claus
  - family: Woo
    given: Kara
  - family: Yutani
    given: Hiroaki
  - family: Dunnington
    given: Dewey
  id: R-ggplot2
  issued: 2022
  note: R package version 3.3.6
  title: "ggplot2: Create elegant data visualisations using the grammar
    of graphics"
  title-short: ggplot2
  type: book
  url: "https://CRAN.R-project.org/package=ggplot2"
- author:
  - family: Iannone
    given: Richard
  - family: Cheng
    given: Joe
  - family: Schloerke
    given: Barret
  id: R-gt
  issued: 2022
  note: R package version 0.6.0
  title: "Gt: Easily create presentation-ready display tables"
  title-short: Gt
  type: book
  url: "https://CRAN.R-project.org/package=gt"
- author:
  - family: Xie
    given: Yihui
  id: R-knitr
  issued: 2022
  note: R package version 1.39
  title: "Knitr: A general-purpose package for dynamic report generation
    in r"
  title-short: Knitr
  type: book
  url: "https://yihui.org/knitr/"
- author:
  - family: Horst
    given: Allison
  - family: Hill
    given: Alison
  - family: Gorman
    given: Kristen
  id: R-palmerpenguins
  issued: 2020
  note: R package version 0.1.0
  title: "Palmerpenguins: Palmer archipelago (antarctica) penguin data"
  title-short: Palmerpenguins
  type: book
  url: "https://CRAN.R-project.org/package=palmerpenguins"
- author:
  - family: Henry
    given: Lionel
  - family: Wickham
    given: Hadley
  id: R-purrr
  issued: 2020
  note: R package version 0.3.4
  title: "Purrr: Functional programming tools"
  title-short: Purrr
  type: book
  url: "https://CRAN.R-project.org/package=purrr"
- author:
  - family: Wickham
    given: Hadley
  - family: Hester
    given: Jim
  - family: Bryan
    given: Jennifer
  id: R-readr
  issued: 2022
  note: R package version 2.1.2
  title: "Readr: Read rectangular text data"
  title-short: Readr
  type: book
  url: "https://CRAN.R-project.org/package=readr"
- author:
  - family: Wickham
    given: Hadley
  - family: Seidel
    given: Dana
  id: R-scales
  issued: 2022
  note: R package version 1.2.0
  title: "Scales: Scale functions for visualization"
  title-short: Scales
  type: book
  url: "https://CRAN.R-project.org/package=scales"
- author:
  - family: Chang
    given: Winston
  - family: Cheng
    given: Joe
  - family: Allaire
    given: JJ
  - family: Sievert
    given: Carson
  - family: Schloerke
    given: Barret
  - family: Xie
    given: Yihui
  - family: Allen
    given: Jeff
  - family: McPherson
    given: Jonathan
  - family: Dipert
    given: Alan
  - family: Borges
    given: Barbara
  id: R-shiny
  issued: 2021
  note: R package version 1.7.1
  title: "Shiny: Web application framework for r"
  title-short: Shiny
  type: book
  url: "https://shiny.rstudio.com/"
- author:
  - family: Siegert
    given: Stefan
  - family: Williams
    given: Robin
  id: R-sonify
  issued: 2017
  note: R package version 0.0-1
  title: "Sonify: Data sonification - turning data into sound"
  title-short: Sonify
  type: book
  url: "https://CRAN.R-project.org/package=sonify"
- author:
  - family: Wickham
    given: Hadley
  id: R-stringr
  issued: 2019
  note: R package version 1.4.0
  title: "Stringr: Simple, consistent wrappers for common string
    operations"
  title-short: Stringr
  type: book
  url: "https://CRAN.R-project.org/package=stringr"
- author:
  - family: Seo
    given: JooYoung
  id: R-tactileR
  issued: 2022
  note: R package version 0.1.0
  title: "tactileR: Converting r graphics into a braille ready-to-print
    PDF"
  title-short: tactileR
  type: book
  url: "https://github.com/jooyoungseo/tactileR"
- author:
  - family: Müller
    given: Kirill
  - family: Wickham
    given: Hadley
  id: R-tibble
  issued: 2022
  note: R package version 3.1.7
  title: "Tibble: Simple data frames"
  title-short: Tibble
  type: book
  url: "https://CRAN.R-project.org/package=tibble"
- author:
  - family: Wickham
    given: Hadley
  - family: Girlich
    given: Maximilian
  id: R-tidyr
  issued: 2022
  note: R package version 1.2.0
  title: "Tidyr: Tidy messy data"
  title-short: Tidyr
  type: book
  url: "https://CRAN.R-project.org/package=tidyr"
- author:
  - family: Wickham
    given: Hadley
  id: R-tidyverse
  issued: 2021
  note: R package version 1.3.1
  title: "Tidyverse: Easily install and load the tidyverse"
  title-short: Tidyverse
  type: book
  url: "https://CRAN.R-project.org/package=tidyverse"
- author:
  - family: Ligges
    given: Uwe
  id: R-tuneR
  issued: 2022
  note: R package version 1.4.0
  title: "tuneR: Analysis of music and speech"
  title-short: tuneR
  type: book
  url: "https://CRAN.R-project.org/package=tuneR"
- author:
  - family: Zeileis
    given: Achim
  - family: Fisher
    given: Jason C.
  - family: Hornik
    given: Kurt
  - family: Ihaka
    given: Ross
  - family: McWhite
    given: Claire D.
  - family: Murrell
    given: Paul
  - family: Stauffer
    given: Reto
  - family: Wilke
    given: Claus O.
  container-title: Journal of Statistical Software
  doi: 10.18637/jss.v096.i01
  id: colorspace2020a
  issue: 1
  issued: 2020
  page: 1-49
  title: "[colorspace]{.nocase}: A toolbox for manipulating and
    assessing colors and palettes"
  title-short: "[colorspace]{.nocase}"
  type: article-journal
  volume: 96
- author:
  - family: Zeileis
    given: Achim
  - family: Hornik
    given: Kurt
  - family: Murrell
    given: Paul
  container-title: Computational Statistics & Data Analysis
  doi: 10.1016/j.csda.2008.11.033
  id: colorspace2009a
  issue: 9
  issued: 2009
  page: 3259-3270
  title: "Escaping RGBland: Selecting colors for statistical graphics"
  title-short: Escaping RGBland
  type: article-journal
  volume: 53
- author:
  - family: Stauffer
    given: Reto
  - family: Mayr
    given: Georg J.
  - family: Dabernig
    given: Markus
  - family: Zeileis
    given: Achim
  container-title: Bulletin of the American Meteorological Society
  doi: 10.1175/BAMS-D-13-00155.1
  id: colorspace2009b
  issue: 2
  issued: 2009
  page: 203-216
  title: "Somewhere over the rainbow: How to make effective use of
    colors in meteorological visualizations"
  title-short: Somewhere over the rainbow
  type: article-journal
  volume: 96
- author:
  - family: Wickham
    given: Hadley
  id: ggplot22016
  isbn: 978-3-319-24277-4
  issued: 2016
  publisher: Springer-Verlag New York
  title: "ggplot2: Elegant graphics for data analysis"
  title-short: ggplot2
  type: book
  url: "https://ggplot2.tidyverse.org"
- author:
  - family: Xie
    given: Yihui
  edition: 2nd
  id: knitr2015
  issued: 2015
  note: ISBN 978-1498716963
  publisher: Chapman; Hall/CRC
  publisher-place: Boca Raton, Florida
  title: Dynamic documents with R and knitr
  type: book
  url: "https://yihui.org/knitr/"
- author:
  - family: Xie
    given: Yihui
  container-title: Implementing reproducible computational research
  editor:
  - family: Stodden
    given: Victoria
  - family: Leisch
    given: Friedrich
  - family: Peng
    given: Roger D.
  id: knitr2014
  issued: 2014
  note: ISBN 978-1466561595
  publisher: Chapman; Hall/CRC
  title: "Knitr: A comprehensive tool for reproducible research in R"
  title-short: Knitr
  type: chapter
  url: "http://www.crcpress.com/product/isbn/9781466561595"
- author:
  - family: Wickham
    given: Hadley
  - family: Averick
    given: Mara
  - family: Bryan
    given: Jennifer
  - family: Chang
    given: Winston
  - family: McGowan
    given: Lucy D'Agostino
  - family: François
    given: Romain
  - family: Grolemund
    given: Garrett
  - family: Hayes
    given: Alex
  - family: Henry
    given: Lionel
  - family: Hester
    given: Jim
  - family: Kuhn
    given: Max
  - family: Pedersen
    given: Thomas Lin
  - family: Miller
    given: Evan
  - family: Bache
    given: Stephan Milton
  - family: Müller
    given: Kirill
  - family: Ooms
    given: Jeroen
  - family: Robinson
    given: David
  - family: Seidel
    given: Dana Paige
  - family: Spinu
    given: Vitalie
  - family: Takahashi
    given: Kohske
  - family: Vaughan
    given: Davis
  - family: Wilke
    given: Claus
  - family: Woo
    given: Kara
  - family: Yutani
    given: Hiroaki
  container-title: Journal of Open Source Software
  doi: 10.21105/joss.01686
  id: tidyverse2019
  issue: 43
  issued: 2019
  page: 1686
  title: Welcome to the [tidyverse]{.nocase}
  type: article-journal
  volume: 4
- author:
  - family: Ligges
    given: Uwe
  - family: Krey
    given: Sebastian
  - family: Mersmann
    given: Olaf
  - family: Schnackenberg
    given: Sarah
  id: tuneR2018
  issued: 2018
  title: "[tuneR]{.nocase}: Analysis of music and speech"
  title-short: "[tuneR]{.nocase}"
  type: book
  url: "https://CRAN.R-project.org/package=tuneR"
---

## Citation Test

@R-base; @R-dplyr

Preview

quarto preview test.qmd
# in JSON at position 60xpected token                                                                                                                   
jjallaire commented 2 years ago

The error is due to what be believe to be an invalid YAML quoted string:

  title: "Colorspace: A toolbox for manipulating and assessing colors
    and palettes"

If this is changed as follows (removing the newline) then there is no error:

  title: "Colorspace: A toolbox for manipulating and assessing colors and palettes"

@cscheid Let me know if you think there is something we should do here (targeting for v1.1 but if any change is risky we can put it in v1.2)

cscheid commented 2 years ago

The weird thing is that the string above is valid YAML according to http://www.yamllint.com/ and https://codebeautify.org/yaml-validator both. If we're failing here, it means our readers might not be strictly YAML compliant, which is a concern. I'll follow up.