Sat, 11 Jul 2009 03:37:48 +0100
Strip trailing punctuation from short titles
0 | 1 | module("textile", package.seeall) |
2 | ||
3 | ||
4 | return function (textile) | |
5 | if not textile then | |
6 | error("textile: nil data!"); | |
7 | end | |
8 | textile = textile:gsub("_(.-)_", "<em>%1</em>"):gsub("%*(.-)%*", "<b>%1</b>"); | |
9 | textile = textile:gsub("h(%d+)%. ([^\r\n]+)", "<h%1>%2</h%1>"); | |
10 | textile = textile:gsub("p%. ([^\r\n]+)", "<p>%1</p>"); | |
11 | textile = textile:gsub("p%((%w+)%)%. ([^\r\n]+)", "<p class='%1'>%2</p>"); | |
12 | textile = textile:gsub("[\r\n](.-)[\r\n]", "<p>%1</p>"); | |
13 | return textile; | |
14 | end |