From 3b222aa779fd9789b5467dfb55d2722b342c29fb Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 22 Aug 2024 21:01:27 +0300 Subject: [PATCH] feat(filters): Catch English dates as exception to sentence filter --- pandoc-filters/sentence_lines.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandoc-filters/sentence_lines.lua b/pandoc-filters/sentence_lines.lua index 90507cf7..e15f7de4 100644 --- a/pandoc-filters/sentence_lines.lua +++ b/pandoc-filters/sentence_lines.lua @@ -34,6 +34,11 @@ end local function is_en_exception (previous, next) if tr_non_terminal[previous] then return true end + -- Dates (reverse from most common order, but other way harder to match without negatives) + if previous:match("A%.?D%.$") and next:match("^%d") then return true end + if previous:match("B%.?C%.$") and next:match("^%d") then return true end + if previous:match("C%.?E%.$") and next:match("^%d") then return true end + if previous:match("B%.?C%.?E%.$") and next:match("^%d") then return true end -- Verse refs, e.g. Gen. 16 if previous:match("^%u%P+%.$") and next:match("^%d") then return true end end