Module:String2: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(upgrade posnq - Now supports named parameters: source, target, plain, nomatch; and UTC) |
(fetch parent args) |
||
Line 110: | Line 110: | ||
-- any double quotes " are stripped out. |
-- any double quotes " are stripped out. |
||
p.posnq = function(frame) |
p.posnq = function(frame) |
||
local |
local args = frame.args |
||
local pargs = frame:getParent().args |
|||
⚫ | |||
for k, v in pairs(pargs) do |
|||
⚫ | |||
args[k] = v |
|||
end |
|||
local str = mw.text.trim(args[1] or args.source or "") |
|||
⚫ | |||
⚫ | |||
⚫ | |||
if plain == "false" then plain = false else plain = true end |
if plain == "false" then plain = false else plain = true end |
||
local nomatch = mw.text.trim( |
local nomatch = mw.text.trim(args[4] or args.nomatch or "") |
||
⚫ | |||
-- just take the start position |
-- just take the start position |
||
local pos = mw.ustring.find(str, match, 1, plain) or nomatch |
local pos = mw.ustring.find(str, match, 1, plain) or nomatch |