Commit b3f8c775 authored by Albert Krewinkel's avatar Albert Krewinkel 🚴
Browse files

Add filter to localize dates

parent e5c5bb61
......@@ -21,7 +21,8 @@ PANDOC_WRITER_OPTIONS += --filter=$(PANDOC_CITEPROC)
# PANDOC_WRITER_OPTIONS = --metadata-file=config/
# PANDOC_WRITER_OPTIONS ?= --metadata-file=config/
PANDOC_READER_OPTIONS ?= --metadata-file=config/
PANDOC_READER_OPTIONS ?= --metadata-file=config/ \
# Additional option per file type
-- This *should* be doable with ``, but it seems to ignore
-- the `LC_TIME` environment variable.
local months = {
'Januar', 'Februar', 'März', 'April', 'May', 'Juni',
'July', 'August', 'September', 'Oktober', 'November', 'Dezember'
function localize_date(date_meta)
local date_string = pandoc.utils.stringify(date_meta)
local year, month, day = date_string:match('^(%d%d%d%d)-(%d%d)-(%d%d)')
return ("%02d. %s %d"):format(day, months[tonumber(month)], year)
function Meta (meta)
meta.quality.received = localize_date(meta.quality.received)
meta.quality.accepted = localize_date(meta.quality.accepted)
meta.quality.published = localize_date(meta.quality.published)
return meta
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment