Module:add etymology: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 4: Line 4:


local m_languages = require("Module:languages")
local m_languages = require("Module:languages")
local pos = {
"Adjective",
"Adverb",
"Circumfix",
"Conjunction",
"Contraction",
"Infix",
"Interjection",
"Noun",
"Numeral",
"Participle",
"Particle",
"Phrase",
"Prefix",
"Preposition",
"Pronoun",
"Proper noun",
"Suffix",
}


function export.format(frame)
function export.format(frame)
Line 47: Line 67:
index.e1, index.e2, section.etymology = mw.ustring.find(content, regex_etymology)
index.e1, index.e2, section.etymology = mw.ustring.find(content, regex_etymology)
local check_init = 1
local check_init = 1
--[[
while mw.ustring.find(content, "===[^=]+===.+", check_init) do
while mw.ustring.find(content, "===[^=]+===.+", check_init) do
local match_start, _, section_check = mw.ustring.find(content, "(===[^=]+===.+)", check_init)
local match_start, _, section_check = mw.ustring.find(content, "(===[^=]+===.+)", check_init)
Line 56: Line 77:
else
else
check_init = match_start + 1
check_init = match_start + 1
end
end
]]--
for _, ps in ipairs(pos) do
index.m1 = mw.ustring.find(content, "===%s*" .. ps .. "%s*===")
if index.m1 then
section.main = mw.ustring.sub(content, index.m1)
break
end
end
end
end

Navigation menu