Module:add etymology: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 12: Line 12:
local content = current:getContent()
local content = current:getContent()
content = mw.ustring.match(content, "(==%s*" .. language.name .. "%s*==.+)\n==[^=]+==\n") or mw.ustring.match(content, "==%s*" .. language.name .. "%s*==.+") or error("No " .. language.name .. " section found in:\n" .. content)
content = assert(mw.ustring.match(content, "(==%s*" .. language.name .. "%s*==.+)\n==[^=]+==\n") or mw.ustring.match(content, "==%s*" .. language.name .. "%s*==.+"), "No " .. language.name .. " section found in:\n" .. content)


local etymology_i = 1
local etymology_i = 1
Line 86: Line 86:
if section.pre then section.pre = mw.ustring.gsub(section.pre, "===", "====") end
if section.pre then section.pre = mw.ustring.gsub(section.pre, "===", "====") end
section.main = mw.ustring.gsub(section.main, "===", "====")
section.main = mw.ustring.gsub(section.main, "===", "====")
mw.log("••••••••••••••• PRE-PROCESSED")
mw.log(content)
mw.log("\n••••••••••••••• RESULT")
mw.log("•••••••••••••••••••• HEADING")
mw.log(section.heading)
mw.log("•••••••••••••••••••• PRONUNCIATION")
mw.log(section.pronunciation)
mw.log("•••••••••••••••••••• ETYMOLOGY")
mw.log(section.etymology)
mw.log("•••••••••••••••••••• PRE")
mw.log(section.pre)
mw.log("•••••••••••••••••••• MAIN")
mw.log(section.main)
mw.log("••••••••••••••••••••\n=== {{Etymology|" .. language.code .. "|2}} ===")
return section.heading .. (section.pronunciation or "") .. section.etymology .. (section.pre or "") .. section.main .. "\n\n=== {{Etymology|" .. language.code .. "|2}} ==="
return section.heading .. (section.pronunciation or "") .. section.etymology .. (section.pre or "") .. section.main .. "\n\n=== {{Etymology|" .. language.code .. "|2}} ==="

Navigation menu