Skip to content

Commit

Permalink
feat(import): Assume italicized blockquotes are redundant inline form…
Browse files Browse the repository at this point in the history
…atting
  • Loading branch information
alerque committed Nov 7, 2024
1 parent df925a1 commit 55a86ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pandoc-filters/unitalicize-blockquotes.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local function unitalicize (element)
element = pandoc.walk_block(element, {
Para = function(el)
if #el.content == 1 then
local inner = el.content[1]
if inner.tag == "Emph" then
return pandoc.Plain(inner.content)
end
end
end
})
return element
end

return {
{ BlockQuote = unitalicize },
}
1 change: 1 addition & 0 deletions scripts/import.zsh.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function import_docx () {
pandoc_args+=(
--from=docx-gfm_auto_identifiers-ascii_identifiers-empty_paragraphs
--lua-filter="$CASILEDIR/pandoc-filters/guess-headings.lua"
--lua-filter="$CASILEDIR/pandoc-filters/unitalicize-blockquotes.lua"
)
alias pandoc="${PANDOC:-@PANDOC@}"
: ${bookid:=$1}
Expand Down

0 comments on commit 55a86ee

Please sign in to comment.