quarto-dev / quarto-cli

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

profile-specific metadata files not being incorporated #6859

Open poldrack opened 1 year ago

poldrack commented 1 year ago

Bug description

I am trying to render a book with a profile-specific metadata file specified in the profile _quarto.yml. However, the profile-specific metadata file doesn't seem to actually be used. All of the relevant files can be found at https://github.com/poldrack/quarto_profile_test. The profile here is called "undergrad".

Here are the contents of the _quarto-undergrad.yml:

project:
  title: "Undergrad Profile Detected from _quarto-undergrad.yml"
  output-dir: _site-undergrad

metadata-files:
  - _book-undergrad.yml

I know that the project setting is being parsed, because the output is placed in the specified directory. However, the settings in _book-undergrad.yml are not being included. This can be seen in several places when comparing the output - the title, authors, and chapters should be different for the specified profile, but they are not. However, the profile is being corrected detected when the pages are rendered, as the following code within one of the qmd files gives the expected output:

::: {.content-visible unless-profile="undergrad"}
This is the default profile.
:::
::: {.content-visible when-profile="undergrad"}
This is the undergrad profile.
:::

Steps to reproduce

git clone https://github.com/poldrack/quarto_profile_test
cd quarto_profile_test
make all
diff _book/index.html _site-undergrad/index.html 

Expected behavior

there should be a number of differences, including different title, authors, and chapter listing.

Actual behavior

only the detected profile reported in the index.qmd file differs as expected.:

$ diff _book/index.html _site-undergrad/index.html 
187c187
< <p>This is the default profile.</p>
---
> <p>This is the undergrad profile.</p>

Your environment

-OS: Ubuntu 22.04.3 LTS (IDE not relevant as this runs in the shell)

Quarto check output

Note: this was done using the development version of quarto-cli, commit 3aab9b28b

Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.8: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.4: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      Path: /home/poldrack/Dropbox/code/quarto-cli/package/dist/bin

(-) Checking tools....................Check file:///home/poldrack/Dropbox/code/quarto-cli/src/resources/vendor/deno-land/x/puppeteer@9-0-2/mod.ts
[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/bin
      Version: 2021

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.2 (Conda)
      Path: /home/poldrack/miniconda3/envs/py311/bin/python
      Jupyter: 5.3.0
      Kernels: python3

(|) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
(|) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.1.2
      Path: /usr/lib/R
      LibPaths:
        - /home/poldrack/R/x86_64-pc-linux-gnu-library/4.1
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.41
      rmarkdown: 2.19

[✓] Checking Knitr engine render......OK
dragonstyle commented 1 year ago

It looks like this is working because of the metadata-files. You can workaround right now by placing the contents of the yaml metadata-file right inline into _quarto.yml and _quarto-undergrad.yml. I think we may need to re-resolve the complete metadata-files metadata after the profile has been applied.

poldrack commented 1 year ago

Thanks - that works! It would probably be good to make this clear on the relevant documentation page: https://quarto.org/docs/projects/profiles.html

dragonstyle commented 9 months ago

(See also repro case here https://github.com/quarto-dev/quarto-cli/issues/8323)

cwickham commented 1 month ago

Removing documentation label as resolved via https://github.com/quarto-dev/quarto-web/pull/1376

Leaving open for enhancement to handle metadata-files in project profiles.