util.lua

changeset 10
58f3707e44d7
parent 9
13eb9435e1c0
child 17
1d0ae741807e
equal deleted inserted replaced
9:13eb9435e1c0 10:58f3707e44d7
3 function make_short_title(long_title) 3 function make_short_title(long_title)
4 local short_title = long_title:gsub("%W+", "-"):lower():sub(1,45) 4 local short_title = long_title:gsub("%W+", "-"):lower():sub(1,45)
5 if #long_title:gsub("%W+", "-") > 45 then 5 if #long_title:gsub("%W+", "-") > 45 then
6 short_title = short_title:gsub("%-%w+$", ""); 6 short_title = short_title:gsub("%-%w+$", "");
7 end 7 end
8 return short_title; 8 return short_title:gsub("%W+$", "");
9 end 9 end
10 10
11 -- Config -- 11 -- Config --
12 local conffile = ".blogrc"; 12 local conffile = ".blogrc";
13 for i=1,#arg do 13 for i=1,#arg do

mercurial