generated from tarleb/lua-filter-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor for compatibility with Pandoc 3.1.10+
We cannot use suppress-bibliography together with link-citations in Pandoc 3.1.10+ before. Rewrite the filter to work around this.
- Loading branch information
Showing
24 changed files
with
1,992 additions
and
890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
/_site/ | ||
|
||
# Quarto artefacts | ||
/.quarto/ | ||
/expected/input_files | ||
/expected/example/input_files | ||
|
||
/.luarc.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* anchorlinks.js: add anchor links before headers h2, h3 | ||
*/ | ||
document.addEventListener("DOMContentLoaded", function () { | ||
const headers = document.querySelectorAll("h2, h3" ); | ||
var css_needed = false; | ||
|
||
headers.forEach(header => { | ||
if (header.id) { | ||
css_needed = true | ||
// create anchor | ||
const anchor = document.createElement("a"); | ||
anchor.href = `#${header.id}`; | ||
anchor.textContent = "#"; | ||
anchor.className = "header-anchor"; | ||
// insert after header | ||
header.appendChild(anchor); | ||
} | ||
}); | ||
|
||
if (css_needed) { | ||
const style = document.createElement("style"); | ||
style.appendChild(document.createTextNode(` | ||
.header-anchor { | ||
display: inline-block; | ||
text-decoration: none; | ||
margin-left: 8px; | ||
font-size: 0.8em; | ||
opacity: 0.5; | ||
} | ||
.header-anchor:hover { | ||
opacity: 1; | ||
text-decoration: underline; | ||
} | ||
`)); | ||
document.head.appendChild(style); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function Meta(meta) | ||
ptype = pandoc.utils.type | ||
if meta['header-includes'] then | ||
head_inc = meta['header-includes'] | ||
if ptype(head_inc) == 'table' then | ||
head_inc = pandoc.List:new(head_inc) | ||
else | ||
head_inc = pandoc.List:new{head_inc} | ||
end | ||
else | ||
head_inc = pandoc.List:new{} | ||
end | ||
head_inc:insert(pandoc.RawBlock('html', | ||
'<script src=anchorlinks.js></script>')) | ||
meta['header-includes'] = head_inc | ||
return meta | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.