Content deleted Content added
fix aliases |
simpler |
||
(6 intermediate revisions by the same user not shown) | |||
Line 4:
local lects = mw.loadData('Module:IPA/data/export')
local function
cell:wikitext(▼
▲ string.format(' <small>(%s)</small>', table.concat(notes, '; '))
)▼
end▼
end
Line 52 ⟶ 48:
table.insert(cells, row:tag('td'))
end
if not lect.parent and
for _ = 1, 4 do
row:tag('td'):css('background', '#ececec')
end
end
cells[1]:wikitext('<code>' ..
if lect.aliases then
local aliases = {}
Line 63 ⟶ 59:
table.insert(aliases, alias)
end
'also <code>%s</code>',
▲ )
})▼
end
do
Line 83 ⟶ 77:
end
cells[2]:wikitext(lect.name or lect.extName)
addNote(cells[2], table.concat(notes, '; '))
end
do
local
local intLink = lect.link or lect.generatedLink
if intLink then
if intLink == lect.extLink then
elseif lect.extLink then
local intTitle = mw.title.new(intLink)
intTitle = intTitle.redirectTarget or intTitle
Line 100 ⟶ 96:
note = note .. ', a different article'
end
table.insert(notes, note)▼
end
end
Line 106 ⟶ 101:
s = lect.generatedLink and '([[' .. s .. ']])' or '[[' .. s .. ']]'
cells[3]:wikitext(s)
end
end
cells[4]:wikitext(
Line 128 ⟶ 125:
local key = lect.key or lect.parent and lect.parent.key
if key then
local asciiKey = mw.ustring.gsub(mw.ustring.toNFD(key), '[^ -~]', '')
▲ if not byKey[key] then
end
table.insert(byKey[
code = lect.code,
name = lect.name or lect.extName,
Line 140 ⟶ 138:
end
table.sort(keys)
for _,
local row = t:tag('tr')
local
local keyCell = row:tag('td'):wikitext('[[' .. keyLects.name .. ']]')
local lang
if #keyLects > 1 then
keyCell:attr('rowspan', #keyLects)
table.sort(keyLects, function (a, b) return a.name < b.name end)
local keyName = mw.ustring.gsub(
for _, lect in ipairs(keyLects) do
if lect.name == keyName then
Line 173 ⟶ 171:
end
lang = lang or keyLects[1]
local
count = 1,
)▼
▲ cell = row:tag('td'):wikitext(
▲ )
row:tag('td'):wikitext('<code>' .. lang.code .. '</code>')
for
if lect ~= lang then
local subRow = t:tag('tr')
if prev.name == lect.name then
else
name = lect.name,
nameCell = subRow:tag('td'):wikitext(▼
count = 1,
▲ string.format('[[%s|%s]]', lect.link, lect.name)
)▼
string.format('[[%s|%s]]', lect.link, lect.name)
▲ )
end
subRow:tag('td'):wikitext('<code>' .. lect.code .. '</code>')
Line 197 ⟶ 200:
return tostring(t)
end
return p
|