format more clever bools

This commit is contained in:
p.kosyh 2010-07-03 05:36:47 +00:00
parent 89d1baa363
commit bd1be750c8

View file

@ -16,15 +16,15 @@ stead.fmt = stead.hook(stead.fmt, function(f, ...)
if type(format.filter) == 'function' and stead.state then if type(format.filter) == 'function' and stead.state then
r = format.filter(r); r = format.filter(r);
end end
if format.dash and utf8 then if call_bool(format, 'dash') and utf8 then
r = r:gsub('([^-])%-%-([^-])', '%1—%2'); r = r:gsub('([^-])%-%-([^-])', '%1—%2');
r = r:gsub('^%-%-([^-])', '—%1'); r = r:gsub('^%-%-([^-])', '—%1');
end end
if format.quotes and utf8 then if call_bool(format, 'quotes') and utf8 then
r = r:gsub('_"','«'):gsub('"_',"»"); r = r:gsub('_"','«'):gsub('"_',"»");
r = r:gsub('"([^"]*)"','«%1»'); r = r:gsub('"([^"]*)"','«%1»');
end end
if format.para and stead.state then if call_bool(format, 'para') and stead.state then
r = r:gsub('\n([^\n])', '<&para;>%1'):gsub('<&para;>[ \t]*', '\n'..txtnb(format.para_space)); r = r:gsub('\n([^\n])', '<&para;>%1'):gsub('<&para;>[ \t]*', '\n'..txtnb(format.para_space));
r = r:gsub('^[ \t]*',txtnb(format.para_space)) r = r:gsub('^[ \t]*',txtnb(format.para_space))
end end