Module:gloss grid: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 22: Line 22:
-- build term row
-- build term row
build("<tr>")
build("<tr>")
if data.IPAs then build("<td />") end -- extra column for alignment
if data.IPAs and data.IPAs[1] then build("<td />") end -- extra column for alignment
for _, term in ipairs(data.terms) do
for _, term in ipairs(data.terms) do
local cell_type = data.bold and "th" or "td"
local cell_type = data.bold and "th" or "td"
Line 32: Line 32:
if data.IPAs then
if data.IPAs then
build("<tr>")
build("<tr>")
build('<td style="' .. mw.ustring.gsub(cell_style, "padding: (%S+) %S+", "padding: %1 0") .. '" class="IPA nolarge">' .. (data.phonemic and "/" or "[") .. "</td>")
if data.IPAs[1] then
build('<td style="' .. mw.ustring.gsub(cell_style, "padding: (%S+) %S+", "padding: %1 0") .. '" class="IPA nolarge">' .. (data.phonemic and "/" or "[") .. "</td>")
end
for i = 1, term_count do
for i = 1, term_count do
if data.IPAs[i] then
if data.IPAs[i] then
Line 40: Line 42:
end
end
build('<td style="' .. cell_style .. '" class="IPA nolarge">' .. ipa_temp .. '</td>')
build('<td style="' .. cell_style .. '" class="IPA nolarge">' .. ipa_temp .. '</td>')
elseif i == 1 then
build('<td style="' .. cell_style .. '; text-align:right" class="IPA nolarge">' .. (data.phonemic and "/" or "[") .. '</td>')
elseif i == term_count then
elseif i == term_count then
build('<td style="' .. cell_style .. '; text-align:right" class="IPA nolarge">' .. (data.phonemic and "/" or "]") .. '</td>')
build('<td style="' .. cell_style .. '; text-align:right" class="IPA nolarge">' .. (data.phonemic and "/" or "]") .. '</td>')
Line 52: Line 56:
if data.glosses then
if data.glosses then
build("<tr>")
build("<tr>")
if data.IPAs then build("<td />") end -- extra column for alignment
if data.IPAs and data.IPAs[1] then build("<td />") end -- extra column for alignment
for i = 1, term_count do
for i = 1, term_count do
if data.glosses[i] then
if data.glosses[i] then
Line 66: Line 70:
if data.translations then
if data.translations then
build("<tr>")
build("<tr>")
if data.IPAs then build("<td />") end -- extra column for alignment
if data.IPAs and data.IPAs[1] then build("<td />") end -- extra column for alignment
for i = 1, term_count do
for i = 1, term_count do
if data.translations[i] then
if data.translations[i] then
Line 80: Line 84:
if data.s_IPA then
if data.s_IPA then
build("<tr>")
build("<tr>")
if data.IPAs then build("<td />") end -- extra column for alignment
if data.IPAs and data.IPAs[1] then build("<td />") end -- extra column for alignment
build('<td style="' .. cell_style .. '" class="IPA" colspan=' .. term_count .. '>' .. data.s_IPA .. '</td></tr>')
build('<td style="' .. cell_style .. '" class="IPA" colspan=' .. term_count .. '>' .. data.s_IPA .. '</td></tr>')
end
end
Line 87: Line 91:
if data.s_translation then
if data.s_translation then
build("<tr>")
build("<tr>")
if data.IPAs then build("<td />") end -- extra column for alignment
if data.IPAs and data.IPAs[1] then build("<td />") end -- extra column for alignment
build('<td style="' .. cell_style .. '" colspan=' .. term_count .. '>“' .. data.s_translation .. '”</td></tr>')
build('<td style="' .. cell_style .. '" colspan=' .. term_count .. '>“' .. data.s_translation .. '”</td></tr>')
end
end