summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/9thPK7O3xn/index.md2
-rw-r--r--scripts/metadata_filter.lua20
2 files changed, 18 insertions, 4 deletions
diff --git a/content/9thPK7O3xn/index.md b/content/9thPK7O3xn/index.md
index fb6160a..47e789b 100644
--- a/content/9thPK7O3xn/index.md
+++ b/content/9thPK7O3xn/index.md
@@ -6,5 +6,3 @@ create_feed: true
6 6
7Welcome to the personal section of my website! 7Welcome to the personal section of my website!
8Here you will find content that doesn't belong in the public sections of my website, such as test pages for development purposes or content that's too personal in nature. 8Here you will find content that doesn't belong in the public sections of my website, such as test pages for development purposes or content that's too personal in nature.
9
10Please avoid sharing anything from here with larger audiences.
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua
index ebbd6d4..6c3817a 100644
--- a/scripts/metadata_filter.lua
+++ b/scripts/metadata_filter.lua
@@ -146,7 +146,7 @@ function process_pages(global, pages_by_id)
146 pages_list:sort(function(p1, p2) 146 pages_list:sort(function(p1, p2)
147 if p1.position then 147 if p1.position then
148 if p2.position then 148 if p2.position then
149 return p1.position < p2.position 149 return tonumber(p1.position) < tonumber(p2.position)
150 else 150 else
151 return true 151 return true
152 end 152 end
@@ -197,12 +197,28 @@ function pages_last_update(all_pages)
197 return last_update 197 return last_update
198end 198end
199 199
200local titlecase_exceptions = pandoc.List({
201 "a", "an", "and", "as", "at", "but", "by", "en", "for", "if", "in", "nor", "of", "on", "or",
202 "per", "the", "to", "v%.?", "vs%.?", "via",
203})
204
205function titlecase(str)
206 return str:gsub("(%S)(%S*)(%s*)", function(a, b, space)
207 local word = a .. b
208 local is_exception = word:match("%u") or
209 titlecase_exceptions:find_if(
210 function(exception) return word:match("^" .. exception .. "$") end)
211 if is_exception then return word .. space end
212 return string.upper(a) .. b .. space
213 end)
214end
215
200function process(global, meta) 216function process(global, meta)
201 meta.namespace = resolve_namespace(meta.namespace) 217 meta.namespace = resolve_namespace(meta.namespace)
202 meta.file_out = pandoc.utils.stringify(meta.file_out):gsub("^out", "") 218 meta.file_out = pandoc.utils.stringify(meta.file_out):gsub("^out", "")
203 meta.layout = resolve_layout(meta.layout) 219 meta.layout = resolve_layout(meta.layout)
204 meta.url = resolve_url(global.site.url, global.file_out, meta.file_out) 220 meta.url = resolve_url(global.site.url, global.file_out, meta.file_out)
205 meta.title = (meta.title and pandoc.utils.stringify(meta.title)) or "" 221 meta.title = (meta.title and titlecase(pandoc.utils.stringify(meta.title))) or ""
206 222
207 if meta.position then meta.position = pandoc.utils.stringify(meta.position) end 223 if meta.position then meta.position = pandoc.utils.stringify(meta.position) end
208 224