parsers/textile.lua

changeset 12
4c759312950b
parent 0
b40ca010c49c
equal deleted inserted replaced
11:36dd235e09d2 12:4c759312950b
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

mercurial