View source for Module:add etymology
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
local export = {}
local getArgs = require("Module:Arguments").getArgs
local m_languages = require("Module:languages")
function export.format(frame)
local args = getArgs(frame)
local current = (args["entry"] and mw.title.makeTitle("", args["entry"])) or mw.title.getCurrentTitle()
local language = m_languages.get_by_code(args[1])
local content = current:getContent()
content = mw.ustring.match(content, "(==%s*" .. language.name .. "%s*==.+)\n==[^=]+==\n") or mw.ustring.match(content, "==%s*" .. language.name .. "%s*==.+")
local etymology_i = 1
for etymology_heading in mw.ustring.gmatch(content, "===%s*Etymology%s?[0-9]*%s*===") do -- replaces un-templated etymology headings
if etymology_i == 1 then
content = mw.ustring.gsub(content, etymology_heading, "=== {{Etymology|" .. language.code .. "}} ===")
elseif etymology_i == 2 then
000
1:0
Templates used on this page:
Return to Module:add etymology.