Skip to content
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

Compatibility issue with .{content-hidden} and section-bibliographies extension with update from Quarto v1.2 to v1.3 #5904

Closed
ttalVlatt opened this issue Jun 13, 2023 · 7 comments
Labels
Milestone

Comments

@ttalVlatt
Copy link

ttalVlatt commented Jun 13, 2023

Bug description

I updated to the latest published Quarto 1.3.361 and noticed that my section-bibliographies extension no longer worked. At first I thought it was a general compatibility issue, but it seems it might be a change in how the .{content-hidden} is processed? As I have played around and found that it still works fine if the content is cited in the normal markdown text, but not if the content is cited inside a .{content-hidden} section, which worked identically in v1.2.475.

Steps to reproduce

Quarto-Repex.zip
The attached zip repex should illustrate the issue, with Quarto 1.2.475 both section bibliographies are written, but with Quarto 1.3.361 only the second section where the citation not in .{content-hidden} shows up.

Expected behavior

section-bibliography should work identically if the citation is within .{content-hidden} or not

Actual behavior

with Quarto v.1.3 the section-bibliography does not form if the citation is within .{content-hidden} like it did in Quarto v1.2

Your environment

  • IDE RStudio 2023.03.01
  • Quarto 1.2.475 and 1.3.361

Quarto check output

No response

@ttalVlatt ttalVlatt added the bug Something isn't working label Jun 13, 2023
@ttalVlatt ttalVlatt changed the title Compatibility issue with section-bibliographies extension with update from Quarto v1.2 to v1.3 Compatibility issue with .{content-hidden} and section-bibliographies extension with update from Quarto v1.2 to v1.3 Jun 13, 2023
@mcanouil
Copy link
Collaborator

Sorry for the late reply.
Did you consider updating your extensions, as what you described as bug seems in fact to be a bug fix, i.e., something hidden using .content-hidden has absolutely no reason to appear anywhere (that's the whole point of using .content-hidden).

@ttalVlatt
Copy link
Author

No worries! Ah, so the content in .content-hidden wasn't showing up before, let me clarify. I know a few people had been using this a way of formatting academic CVs, as you could place the citation tags [@smith2001] and they wouldn't appear in the output (as they're hidden), but the information that they were cited in that section would still get to the extension, which is doesn't with the updated quarto. If that shouldn't have been happening in the first place, I guess I will need to find another workaround. Is there an alternative to .content-hidden that should work as described?

@mcanouil
Copy link
Collaborator

mcanouil commented Jul 26, 2023

Your use is actually a misuse of the reference feature (not only in Quarto).
See https://quarto.org/docs/authoring/footnotes-and-citations.html#including-uncited-items to include uncited references.

I am going ahead and close this as I don't see any bug or issue with the feature.

@mcanouil mcanouil added crossref and removed bug Something isn't working labels Jul 26, 2023
@ttalVlatt
Copy link
Author

Thanks for the response. So obviously yes, that was what I originally had tried, but again, you can only have one notice field per document. The purpose of the original method was to create multiple bibliographies, one for each document type, as is required on an academic CV. The only way I could get that to work using .{content-hidden}, so until I or someone else can work out an alternative, I guess I will just stick with v1.2.

Maybe a more official way to do this could be considered as a feature in the future?

@cderv
Copy link
Collaborator

cderv commented Jul 26, 2023

@ttalVlatt I believe you are trying to use a Quarto feature to circumvent a non-existing feature in the section-bibliography extensions. See current feature request

Maybe a more official way to do this could be considered as a feature in the future?

So yes this should be better supported but probably in https://github.com/pandoc-ext/section-bibliographies and not is quarto directly. At least not until splitting bibliography by section is a feature built in.

I guess I will just stick with v1.2.

It seems there was indeed a change in 1.2 - There was a reworkd in Quarto for custom AST node, and conditional blocks are one of them. See https://quarto.org/docs/prerelease/1.3/ast.html

This means that the filter section-bibliography.lua would need to now support specifically this custom node, or quarto AST logic in general.

I don't think will change in Quarto but this could probably be definitely supported in https://github.com/pandoc-ext/section-bibliographies

Bibliography is working in those conditional block as Quarto handles this custom AST nodes. If you do this

---
title: "repex"
csl: apa.csl
bibliography: references.yaml
format:
  html: default
  docx: default
---

# References

### Section One

:::{.content-hidden when-format="docx"}
@tufte2001 says this
:::

### Section Two

@yau2011 says that

You'll get the citation in HTML format.

So this is something to report in https://github.com/pandoc-ext/section-bibliographies so that some adaptation are made for Quarto, or maybe a fork specific for Quarto.

@cderv
Copy link
Collaborator

cderv commented Jul 26, 2023

Though just an addition. .content-hidden feature really means to hide the content and possibly the content will be hidden in AST when section-bibliography.lua applies. This is how it is supposed to work IIUC.

You could try reproduce this behavior though by adding custom lua filter.

  • hide.lua
Div = function(div) 
    if div.classes:includes("hide") then
        return {}
    end
end
  • Adding in YAML
filters:
  - section-bibliographies
  - hide.lua

As there is no custom AST node here, and you apply the hide feature after your filter, then section-bibliography.lua has access to the content, and do its work, but later you hide the content.

Hope it helps.

@ttalVlatt
Copy link
Author

Thanks for clarifying the situation @cderv ! I will play around with section-bib and see if I can get something to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants