build.lua

changeset 6
cf40d55f8122
parent 5
951de9625338
child 8
6dc28a66f4d9
--- a/build.lua	Sat May 23 21:15:19 2009 +0100
+++ b/build.lua	Sat Jul 11 02:14:33 2009 +0100
@@ -1,6 +1,7 @@
 require "LuaTemplates.templates"
 require "LuaTemplates.parsers"
 require "lfs"
+require "util"
 
 -- Config --
 
@@ -68,10 +69,7 @@
 			-- Parse post_data according to extension, add to post list
 			--msg_info("Parsing %s...", post_filename) --:gsub("%.[^%.]+$", ""):match("[^/]+"));
 			post.content = templates.load(parsers[post_format](post_data)):render{ page = post };
-			post.shorttitle = post.title:gsub("%W+", "-"):lower():sub(1,45)
-			if #post.title:gsub("%W+", "-") > 45 then
-				post.shorttitle = post.shorttitle:gsub("%-%w+$", "");
-			end
+			post.shorttile = make_short_title(post.title);
 			post.url = base_url..post.shorttitle.."/"
 			post.post = post
 			post.updated = post.updated or os.date("!%Y-%m-%dT%H:%M:%SZ", lfs.attributes(post.path).modification);

mercurial