Content deleted Content added
mw.loadData |
tweaks |
||
Line 1:
local p = {}
local words = mw.loadData('Module:A or an/words')
Line 20 ⟶ 19:
function p._main(args)
local s = args[1] and mw.text.trim(args[1])
local pron = 'a'
local ret = ''
if s and s ~= '' then
local origStr = s
s = gsub(s, '<%/?[A-Za-z]+[^>]*>', '') -- Remove HTML tags▼
s = gsub(s, '%[%[[^%|]+%|(.-)%]%]', '%1') -- Remove wikilinks▼
▲ s = gsub(s, '%[%[[^%|]+%|(..-)%]%]', '%1') -- Remove wikilinks
s = gsub(gsub(s, '%[%[', ''), '%]%]', '')
s = gsub(s, '^["%$\'%(<%[%{¢-¥₠-₿]+', '') -- Strip some symbols at the beginning
Line 32 ⟶ 33:
if find(s, '^[0-9]') then -- It begins with a number
s = match(s, '^[0-9]
if findWord(s, words['vNums']) then -- '18' etc.
pron = 'an'
end
elseif match(s, '^[0-9%u]
if find(s, '^[' .. ucVvChars .. ']')
and not findWord(s, words['cvAcronyms']) -- Exclude 'NASA' etc.
Line 57 ⟶ 58:
end
end
ret = pron .. ' ' ..
end
Line 64 ⟶ 65:
function p.main(frame)
return p._main(frame:getParent().args)▼
▲ return p._main(args)
end
|