diff options
author | Volpeon <git@volpeon.ink> | 2021-11-21 21:27:26 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-11-21 21:27:26 +0100 |
commit | 9ef79b2215d894d5252961e1cb2b7050647de4fe (patch) | |
tree | e54b16dfe1eafc2b2b9d0de901a3851bf753ce58 /scripts | |
parent | Added IBM Plex italic variant (diff) | |
download | volpeon.ink-9ef79b2215d894d5252961e1cb2b7050647de4fe.tar.gz volpeon.ink-9ef79b2215d894d5252961e1cb2b7050647de4fe.tar.bz2 volpeon.ink-9ef79b2215d894d5252961e1cb2b7050647de4fe.zip |
Remove automatic titlecase algorithm
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/metadata_filter.lua | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 26d2423..d5a2909 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua | |||
@@ -163,22 +163,6 @@ function process_pages(global, order, pages_by_id) | |||
163 | return pages_data | 163 | return pages_data |
164 | end | 164 | end |
165 | 165 | ||
166 | local titlecase_exceptions = pandoc.List({ | ||
167 | "a", "an", "and", "as", "at", "but", "by", "en", "for", "if", "in", "nor", "of", "on", "or", | ||
168 | "per", "the", "to", "v%.?", "vs%.?", "via", | ||
169 | }) | ||
170 | |||
171 | function titlecase(str) | ||
172 | return str:gsub("(%S)(%S*)(%s*)", function(a, b, space) | ||
173 | local word = a .. b | ||
174 | local is_exception = word:match("%u") or | ||
175 | titlecase_exceptions:find_if( | ||
176 | function(exception) return word:match("^" .. exception .. "$") end) | ||
177 | if is_exception then return word .. space end | ||
178 | return string.upper(a) .. b .. space | ||
179 | end) | ||
180 | end | ||
181 | |||
182 | function find_depth(pages) | 166 | function find_depth(pages) |
183 | local depth = 0 | 167 | local depth = 0 |
184 | 168 | ||
@@ -291,7 +275,6 @@ function process(global, meta) | |||
291 | meta.url = meta.url and pandoc.utils.stringify(meta.url) | 275 | meta.url = meta.url and pandoc.utils.stringify(meta.url) |
292 | meta.url = resolve_url(global.site.url, global.file_out, meta.url or meta.file_out) | 276 | meta.url = resolve_url(global.site.url, global.file_out, meta.url or meta.file_out) |
293 | meta.title = (meta.title and pandoc.utils.stringify(meta.title)) or "" | 277 | meta.title = (meta.title and pandoc.utils.stringify(meta.title)) or "" |
294 | if meta.titlecase ~= false then meta.title = titlecase(meta.title) end | ||
295 | if meta.list_order then meta.list_order = pandoc.utils.stringify(meta.list_order) end | 278 | if meta.list_order then meta.list_order = pandoc.utils.stringify(meta.list_order) end |
296 | if meta.position then meta.position = pandoc.utils.stringify(meta.position) end | 279 | if meta.position then meta.position = pandoc.utils.stringify(meta.position) end |
297 | 280 | ||