Module:zh-Christian-syn

-- adapted from MOD:zh-dial-syn

local export = {} local m_links = require("Module:links") local m_languages = require("Module:languages") local zh = m_languages.getByCode("zh")

local branch_list = { "Protestant", "Roman Catholic", "Eastern Orthodox", "Church of the East" }

local branch_colour = { ["Protestant"]			= "FAF5F0", ["Roman Catholic"]		= "F0F5FA", ["Eastern Orthodox"]	= "F0FAF3", ["Church of the East"]	= "F6F0FA", }

function export.main(frame) local args = frame:getParent.args local pagename = mw.title.getCurrentTitle.text local target_page = args[1] or pagename local resource_page = "Module:zh/data/Christian-syn/" .. target_page local m_syndata if mw.title.new(resource_page).exists then m_syndata = require(resource_page).list else return frame:expandTemplate{ title = "Template:zh-Christian-syn/uncreated", args = { target_page } } end local syn_table = { [=[ Terms for ]=] .. m_syndata["title"] .. ' in different branches of Christianity' .. [=[ 		{| class="wikitable" style="margin:0; text-align:center; width: 100%" |-		! style="background:#E8ECFA" | Branch]=] .. "\n" } if m_syndata["type"] == "book" then table.insert(syn_table, [=[! style="background:#E8ECFA" | Names			! style="background:#E8ECFA" | Abbreviations]=] .. [=[			 []=] ..				tostring(mw.uri.fullUrl("Module:zh/data/Christian-syn/" .. target_page, { ["action"] = "edit" })) ..			' edit]  ') for _, branch in ipairs(branch_list) do			local colour = branch_colour[branch] local formatted_names = {} local formatted_abbs = {} local synonym_set = m_syndata[branch] or { "" } if synonym_set[1] ~= "" then for i, synonym in ipairs(synonym_set) do					local synonym_note = mw.text.split(synonym, ":") local syn, note = synonym_note[1], synonym_note[2] local link = m_links.full_link( {							term = syn.."//",							lang = zh,							tr = "-"						} ) if note and note == "abb" then table.insert(formatted_abbs, link) else note = note and ' ''' .. note .. ''' ' or "" table.insert(formatted_names, link .. note) end end table.insert(syn_table, "\n|-") table.insert(syn_table, '\n|style="background:#' .. colour .. '"| ' .. '' .. branch .. '\n|style="background:#' .. colour .. '"| ' .. table.concat(formatted_names, ", ") .. '\n|style="background:#' .. colour .. '"| ' .. table.concat(formatted_abbs, ", ")) end end else table.insert(syn_table, [=[! style="background:#E8ECFA" | Words]=] .. [=[			 []=] ..				tostring(mw.uri.fullUrl("Module:zh/data/Christian-syn/" .. target_page, { ["action"] = "edit" })) ..			' edit]  ') for _, branch in ipairs(branch_list) do			local colour = branch_colour[branch] local formatted_synonyms = {} local synonym_set = m_syndata[branch] or { "" } if synonym_set[1] ~= "" then for i, synonym in ipairs(synonym_set) do					local synonym_note = mw.text.split(synonym, ":") local syn, note = synonym_note[1], synonym_note[2] local synonym_link = m_links.full_link( {							term = syn.."//",							lang = zh,							tr = "-"						} ) note = note and ' ''' .. note .. ''' ' or "" table.insert(formatted_synonyms, synonym_link .. note) end table.insert(syn_table, "\n|-") table.insert(syn_table, '\n|style="background:#' .. colour .. '"| ' .. '' .. branch .. '\n|style="background:#' .. colour .. '"| ' .. table.concat(formatted_synonyms, ", ")) end end end table.insert(syn_table, '\n|} ') return table.concat(syn_table, "") end

return export