Module:Wikitext
- delistify: remove "*" and "#"s sequences in the beginning of each Wikitext line
{{#invoke:Wikitext|delistify| * plop wow *# plop *#plop}}
gives
plop wow plop plop
z = {
-- mw = require "Module:mw"
};
function z.listifyLines(text)
local result = ""
for idx,line in ipairs(mw.text.split(text, "\n", true)) do
if line ~= "" then
result = result .."* " .. line .. "\n"
end
end
return result
end
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
function z.delistifyLines(text)
local result = ""
for idx,line in ipairs(mw.text.split(text, "\n", true)) do
result = result .. line:gsub("^[*#]+ *", "") .. "\n"
end
return result
end
function z.listify(frame)
return z.listifyLines(frame.args[1])
end
function z.delistify(frame)
return z.delistifyLines(frame.args[1])
end
return z;