local export = {}
function export.make(frame)
local args = frame:getParent().args
text = args
text = mw.ustring.gsub(text, "ス", "{")
text = mw.ustring.gsub(text, "ぞ", "|")
text = mw.ustring.gsub(text, "ど", "}")
text = mw.ustring.gsub(text, "も", "\n")
text = mw.ustring.gsub(text, "さ", "=")
if mw.ustring.match(text, "%{%{zh%-l|+%{") then
return text
end
text = mw.ustring.gsub(text, "|tr=", "|")
text = mw.ustring.gsub(text, "|gloss=", "|")
for line in mw.text.gsplit(text, "\n") do
if not mw.ustring.match(line, "^%* ?%{%{zh%-l.+%}%}$") then
return text
end
end
local result = {}
for line in mw.text.gsplit(text, "\n") do
table.insert(result, (mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(line, "%}%}", ""), "^%* ?%{%{zh%-l%|", ""), "|", ":")))
end
return "{{zh-der|" .. table.concat(result, "|") .. "}}"
end
return export