Skip to content

Commit

Permalink
feat(filters): Allow style guide meta data to impact title case norma…
Browse files Browse the repository at this point in the history
…lization
  • Loading branch information
alerque committed Jul 14, 2023
1 parent 17d011b commit 9f2d4f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pandoc-filters/titlecase_titles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

local decasify = require("decasify")
local locale = os.getenv("LANGUAGE") or "en"
local style = os.getenv("STYLEGUIDE") or "gruber"

Pandoc = function (doc)
local language = pandoc.utils.stringify(doc.meta.language or locale)
locale = pandoc.utils.stringify(doc.meta.language or locale)
style = pandoc.utils.stringify(doc.meta.styleguide or style)
return doc:walk {
Header = function (element)
local title = pandoc.utils.stringify(element.content)
local cased = decasify.titlecase(title, language)
local cased = decasify.titlecase(title, locale, style)
element.content = cased
return element
end
Expand Down

0 comments on commit 9f2d4f5

Please sign in to comment.