summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/metadata_filter.lua17
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
164end 164end
165 165
166local 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
171function 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)
180end
181
182function find_depth(pages) 166function 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