5:951de9625338 | 6:cf40d55f8122 |
---|---|
1 | |
2 -- Takes "Why I like fish" and returns "why-i-like-fish" | |
3 function make_short_title(long_title) | |
4 local short_title = long_title:gsub("%W+", "-"):lower():sub(1,45) | |
5 if #long_title:gsub("%W+", "-") > 45 then | |
6 short_title = short_title:gsub("%-%w+$", ""); | |
7 end | |
8 return short_title; | |
9 end |