require('strict')local p = local curFrame
local function getLangLink(s) return require('Module:Lang')._name_from_tagend
local function makeCrossRef(s, checkExistence) if not s then return nil end if s
local function incrementRowspan(cell) local num = cell:getAttr('rowspan') num = num and num + 1 or 2 cell:attr('rowspan', num)end
function p._main(args) curFrame = curFrame or mw.getCurrentFrame local rows, hasDialects = for k, v in pairs(args) do if k ~= 'lang' and not k:find('^lang_') then local num = k:match('%d+$') if num then local i = tonumber(num) if not rows[i] then rows[i] = end rows[i][k:sub(1, #num * -1 - 1)] = v else if not rows[1] then rows[1] = end rows[1][k] = v end hasDialects = hasDialects or k:find('^dialect%d*$') and true end end mw.logObject(rows) local langName = args.lang_name local langLink = args.lang_link if langName and langLink then langLink = string.format('%s', langLink, langName) elseif langName and args.lang then langLink = mw.ustring.gsub(getLangLink(args.lang), '|.+%]%]$', '|' .. langName .. ']]' ) end langLink = langLink or args.lang and getLangLink(args.lang) langName = langName or mw.ustring.match(langLink, '|(.+)%]%]$') langLink = langLink or string.format('%s', langName, langName) local langCrossRef = makeCrossRef(args.lang_crossref) local hasLangCrossRef = langCrossRef and true local root = mw.html.create() local tr = root:tag('tr') local langCell = tr:tag('td'):wikitext(langLink, args.lang_ref) if not hasDialects then langCell:attr('colspan', 2) end if #rows > 1 then langCell:attr('rowspan', #rows) end local prevCells, prevNote = for i, t in ipairs(rows) do if i ~= 1 then tr = root:tag('tr') end if hasDialects then if prevCells.dialect and t.dialect
'ditto' then incrementRowspan(prevCells.word) elseif t.word then local word = t.word do local link = t.word_link if not link then local title = mw.title.new(langName .. ' orthography') if title.exists then local redirect = title.redirectTarget link = redirect and redirect.fullText or title.fullText end end if link and link ~= 'none' then word = string.format('%s', link, word) end local lang = t.word_lang or args.lang if lang then local args = if lang
'ditto' then incrementRowspan(prevCells.ipa) elseif t.ipa then local ipa = '[' .. t.ipa .. ']' ipa = t.audio and curFrame:expandTemplate or curFrame:expandTemplate prevCells.ipa = tr:tag('td'):wikitext(ipa) if not t.word then prevCells.ipa:attr('colspan', 2):css('text-align', 'center') end else if t.word or t.meaning then tr:tag('td') else tr:tag('td'):attr('colspan', 3):wikitext(curFrame:expandTemplate) end prevCells.ipa = nil end if prevCells.meaning and t.meaning
'ditto' or note
function p.main(frame) curFrame = frame local args = -- for k, v in pairs(frame:getParent.args) do for k, v in pairs(frame.args or frame:getParent.args) do if v and v ~= then args[k] = v end end return p._main(args)end
return p