Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/resources/filters/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ table.insert(quarto_filter_list, { name = "pre-render", filter = {} }) -- entry
tappend(quarto_filter_list, quarto_layout_filters)
tappend(quarto_filter_list, quarto_post_filters)
table.insert(quarto_filter_list, { name = "post-render", filter = {} }) -- entry point for user filters
table.insert(quarto_filter_list, { name = "pre-finalize", filter = {} }) -- entry point for user filters
tappend(quarto_filter_list, quarto_finalize_filters)
table.insert(quarto_filter_list, { name = "post-finalize", filter = {} }) -- entry point for user filters

-- now inject user-defined filters on appropriate positions
inject_user_filters_at_entry_points(quarto_filter_list)
Expand Down
3 changes: 2 additions & 1 deletion src/resources/filters/quarto-finalize/coalesceraw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function coalesce_raw()
Div = function(div)
-- only flatten out divs that have no classes or attributes
-- (see https://github.com/quarto-dev/quarto-cli/issues/6936)
if #div.classes == 0 and #div.attributes == 0 then
-- or empty identifier (see https://github.com/quarto-dev/quarto-cli/issues/6867)
if #div.classes == 0 and #div.attributes == 0 and div.identifier == "" then
return div.content
end
end
Expand Down
23 changes: 23 additions & 0 deletions tests/docs/smoke-all/citations/biblatex-refs-position.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Position citation
bibliography: ref.bib
cite-method: biblatex
_quarto:
tests:
latex:
ensureFileRegexMatches:
- ['\\subsection\{References\}[\s\S]+\\printbibliography\[heading=none\][\s\S]+\\subsection\{Appendix\}']
- []
pdf: null
---

@Lovelace1842

## References {#references}

::: {#refs}
:::

## Appendix {#appendix}

Blah.
23 changes: 23 additions & 0 deletions tests/docs/smoke-all/citations/check-refs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--[[
This test that none of our Lua processing is removing the div of id refs which is used to hold the bibliography placement
for Pandoc citeproc.
--]]
local ref_div_found = false

Blocks = function(blocks)
blocks:walk({
Div = function(div)
if div.identifier == "refs" then
quarto.log.output(div)
ref_div_found = true
end
end
})
end

Pandoc = function(doc)
if not ref_div_found then
error("No div with identifier 'refs' found")
crash()
end
end
31 changes: 31 additions & 0 deletions tests/docs/smoke-all/citations/citeproc-refs-position.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Position citation
bibliography: ref.bib
format:
html: default
latex: default
filters:
- at: post-finalize
path: check-refs.lua
_quarto:
tests:
html:
ensureHtmlElements:
- ['#references div#refs.references div.csl-entry']
- []
latex:
ensureFileRegexMatches:
- ['\\subsection\{References\}[\s\S]+\\begin\{CSLReferences\}[\s\S]+\\subsection\{Appendix\}']
- []
---

@Lovelace1842

## References {#references}

::: {#refs}
:::

## Appendix {#appendix}

Blah.
23 changes: 23 additions & 0 deletions tests/docs/smoke-all/citations/natbib-refs-position.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Position citation
bibliography: ref.bib
cite-method: natbib
_quarto:
tests:
latex:
ensureFileRegexMatches:
- ['\\subsection\{References\}[\s\S]+\\bibliography\{ref\.bib\}[\s\S]+\\subsection\{Appendix\}']
- []
pdf: null
---

@Lovelace1842

## References {#references}

::: {#refs}
:::

## Appendix {#appendix}

Blah.
11 changes: 11 additions & 0 deletions tests/docs/smoke-all/citations/ref.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@article{Lovelace1842,
author = {Lovelace, Augusta Ada},
title = {Sketch of the Analytical Engine Invented by {Charles}
{Babbage,} by {LF} {Menabrea,} Officer of the Military Engineers,
with Notes Upon the Memoir by the Translator},
journal = {TaylorÔÇÖs Scientific Memoirs},
volume = {3},
pages = {666-731},
date = {1842},
langid = {en-GB}
}