Module:inline: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 3: Line 3:
function export.parse(term)
function export.parse(term)
     local args = {}
     local args = {}
     local i, key, value = i
     for inline in mw.ustring.gmatch(term, "<([^>]+)>") do
    while i < #term do
    local s = mw.text.split(inline, ":", true)
        key, value, i = mw.ustring.match(term, "<([a-zA-Z]+):([^>]+)>()")
    args[s[1]] = s[2] or true
        if key and value then args[key] = value end  
    if #s > 2 then mw.addWarning("multiple : found in inline string") end
     end
     end
     return mw.ustring.gsub(term, "<[a-zA-Z]+:[^>]+>", ""), args
     return mw.ustring.gsub(term, "<[^>]+>", ""), args
end
end


return export
return export