Correctly parse file extension to determine post format

Sat, 23 May 2009 20:18:49 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 23 May 2009 20:18:49 +0100
changeset 4
cebf96c3b522
parent 3
f22a275a3a33
child 5
951de9625338

Correctly parse file extension to determine post format

build.lua file | annotate | diff | comparison | revisions
--- a/build.lua	Wed May 20 14:43:12 2009 +0100
+++ b/build.lua	Sat May 23 20:18:49 2009 +0100
@@ -35,7 +35,7 @@
 		msg_info("Processing %s", post_filename);
 		local post_file, err = io.open(posts_dir..post_filename);
 		if post_file then
-			local post_format = post_filename:match("%.(%w+)") or "text";
+			local post_format = post_filename:match("%.(%w+)$") or "text";
 			local post = { filename = post_filename, path = posts_dir..post_filename, format = post_format };
 			if not parsers[post_format] then
 				msg_warn("Post format '%s' not supported", post_format);

mercurial