quarto-dev / quarto-cli

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

A document listing as conditional content #4651

Open cscheid opened 1 year ago

cscheid commented 1 year ago

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/4635

Originally posted by **andrewpbray** March 5, 2023 Hello, I've just tried putting a document listing as conditional content and it didn't work. Here's a MWE. [conditional-listing.zip](https://github.com/quarto-dev/quarto-cli/files/10892937/conditional-listing.zip) The operative part is in this doc: ``` --- title: "Conditional-listing" listing: id: blog contents: - post-1.qmd - post-2.qmd --- This is a Quarto website. To learn more about Quarto websites visit . :::{.content-hidden when-profile="noblog"} :::{#blog} ::: ::: ``` I had hoped that on `quarto render` I'd see the blog but on `quarto render --profile noblog` I would not, but alas, both versions have the blog. I'm guessing this has something to do with the order of operations on render? Thanks for any thoughts / suggestions.
cscheid commented 1 year ago

@andrewpbray Thanks for the example! What's happening here is that quarto is getting confused when you specify an ID and then it turns out the ID is no longer there when you remove it under the conditional content.

We'd like to emit a warning here (and will in the future). But we're getting ready for the 1.3 release and there's a lot on our plate.

Here's a workaround: since you're using a noblog profile, you can also choose to put the listings configuration in your yesblog profile (or whichever appropriate name that is). We'll make sure to behave more consistently in 1.4.

andrewpbray commented 1 year ago

That makes a lot of sense - the reason and the workaround. I'll go ahead specify the yesblog as the default for now.

Good luck finishing up 1.3 - can't wait!