Module:User:Wyang/der
Jump to navigation
Jump to search
- This module sandbox lacks a documentation subpage. You may create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • user page • user talk page • userspace
This is a private module sandbox of Wyang, for their own experimentation. Items in this module may be added and removed at Wyang's discretion; do not rely on this module's stability.
local export = {}
function export.make(frame)
local args = frame:getParent().args
text = args[1]
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