Skip to content

Commit 7e77dc0

Browse files
committed
Turn on native cites, ref
1 parent f77ef4c commit 7e77dc0

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

src/format/asciidoc/format-asciidoc.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,24 @@ export function asciidocFormat(): Format {
4545
);
4646
}
4747

48+
const kFormatOutputDir = "asciidoc";
49+
50+
// Ref target marks the refs div so the post process can inject the bibliography
51+
const kRefTargetIdentifier = "refs-target-identifier";
52+
const kRefTargetIndentifierValue = "// quarto-refs-target-378736AB";
53+
const kUseAsciidocNativeCites = "use-asciidoc-native-cites";
54+
4855
// This provide book specific behavior for producing asciidoc books
4956
const asciidocBookExtension = {
5057
multiFile: true,
5158
formatOutputDirectory(_format: Format) {
52-
return "asciidoc";
59+
return kFormatOutputDir;
60+
},
61+
filterParams: (_options: PandocOptions) => {
62+
return {
63+
[kUseAsciidocNativeCites]: true,
64+
[kRefTargetIdentifier]: kRefTargetIndentifierValue,
65+
};
5366
},
5467
async onMultiFilePrePrender(
5568
isIndex: boolean,

src/resources/filters/main.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import("./quarto-init/configurefilters.lua")
5959
import("./quarto-init/includes.lua")
6060
import("./quarto-init/resourcerefs.lua")
6161

62+
import("./quarto-post/asciidoc.lua")
6263
import("./quarto-post/book.lua")
6364
import("./quarto-post/cites.lua")
6465
import("./quarto-post/delink.lua")
@@ -219,6 +220,7 @@ local quartoPre = {
219220
local quartoPost = {
220221
-- quarto-post
221222
{ name = "post-cites", filter = indexCites() },
223+
{ name = "post-asciidoc", filter = asciidoc() },
222224
{ name = "post-foldCode", filter = foldCode() },
223225
{ name = "post-figureCleanupCombined", filter = combineFilters({
224226
latexDiv(),
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- asciidoc.lua
2+
-- Copyright (C) 2020-2022 Posit Software, PBC
3+
4+
5+
local kAsciidocNativeCites = 'use-asciidoc-native-cites'
6+
7+
function asciidoc()
8+
return {
9+
Cite = function(el)
10+
if quarto.doc.isFormat("asciidoc") and param(kAsciidocNativeCites) then
11+
local citesStr = ""
12+
el.citations:map(function (cite)
13+
citesStr = citesStr .. '<<' .. cite.id .. '>>'
14+
end)
15+
return pandoc.RawInline("asciidoc", citesStr);
16+
end
17+
end
18+
}
19+
end
20+
21+

0 commit comments

Comments
 (0)