Skip to content

Commit

Permalink
style(filters): Restyle Lua code with stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Aug 29, 2024
1 parent b876b84 commit 1ed208c
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions pandoc-filters/sentence_lines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,43 @@ local en_non_terminal = {
}

local function is_tr_exception (previous, next)
if tr_non_terminal[previous] then return true end
if tr_non_terminal[previous] then
return true
end
-- Dates
if previous:match("M%.?Ö%.$") and next:match("^%d") then return true end
if previous:match("M%.?S%.$") and next:match("^%d") then return true end
if previous:match("M%.?Ö%.$") and next:match("^%d") then
return true
end
if previous:match("M%.?S%.$") and next:match("^%d") then
return true
end
-- Roman numeral ordinals
if previous:match("[IVXLCDM]+%.$") then return true end
if previous:match("[IVXLCDM]+%.$") then
return true
end
end

local function is_en_exception (previous, next)
if en_non_terminal[previous] then return true end
if en_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
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
if previous:match("^%u%P+%.$") and next:match("^%d") then
return true
end
end

local function wrap_sentences (element)
Expand Down

0 comments on commit 1ed208c

Please sign in to comment.