Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 295:
end
 
local function splitref(texts)
local posparts = mw.text:find.split(s or '\127', 1'\127', true)
-- this code was imported from module:convert
local text, = strip(text)references
for k, v in ipairs( parts ) do
text if = mw.text.gsubv:match('^(.*)(\127[^\127]*UNIQ[^\127]*%-ref[^\127]*\127)(.*)$',) '%1%3%2')then
local reference
references = (references or '') .. '\127' .. v .. '\127'
local pos = text:find('\127', 1, true)
else
if pos then
local before text = text:sub(1,text pos.. - 1'') .. v
local remainder = text:sub(pos)
local refs = {}
while #remainder > 0 do
local ref, spaces
ref, spaces, remainder = remainder:match('^(\127[^\127]*UNIQ[^\127]*%-ref[^\127]*\127)(%s*)(.*)')
if ref then
table.insert(refs, ref)
else
refs = {}
break
end
end
if #refs > 0 then
text = strip(before)
reference = table.concat(refs)
end
end