قالب:Births and deaths by year for decade/doc

Usage

Invoked with a decade as single argument, for example {{Transclude deaths|82}} for the 820s, the template compiles the list of births and deaths from each year article of the decade, by transcluding their "Births" and "Deaths" sections. Empty or non-existent sections are not transcluded. Year numbers are prepended to the transcluded contents with bold pseudo-headers, in order to avoid overloading the transcluding page's table of contents.

Negative years use the BC suffix, years 1–100 use the AD prefix, and years above 100 use the plain year number.

Technical requirements

قالب:Incomplete section The module underlying this templates assumes that year articles will be named in a certain way and will have specific formatting in the articles.

Example: the 70s AD

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

Example: the 910s AD

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

Example: the 10s BC

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

Example: the 0s BC

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

الوفيات

local p = {} local uc = {births="الميلاد", deaths="الوفيات"} -- تم التصحيح هنا

local page_content = {} local function get_section(frame, page_name, section_name) if page_content[page_name] == nil then local title = mw.title.new(page_name) if title then if title.redirectTarget then title = title.redirectTarget end page_content[page_name] = title:getContent() end end if page_content[page_name] then if mw.ustring.find(page_content[page_name], "=%s*" .. section_name .. "%s*=", 1, false) then return frame:preprocess("" .. page name .. "") -- تم التصحيح هنا end end return "" end

local function transclude(frame, entry, year, article) local s = "' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', ) -- تم تعديل التطابق ليكون أكثر مرونة للنص العربي return mw.ustring.match(s, '.*%*.*[%a%p].+') or "" -- تم التصحيح هنا end

function p.main(frame) local decade = mw.text.trim(frame.args[1] or frame:getParent().args[1] or '0') local result = {} local article_list = {} local year_list = {}

if decade:sub(1, 1) == '-' then for i = -9, (decade == '-0' and -1 or 0) do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. math.abs(i)) end else for i = (decade == '0' and 1 or 0), 9 do table.insert(article_list, frame:expandTemplate { title = "مقالة السنة", args = { decade .. '0', tostring(i) } }) table.insert(year_list, decade .. tostring(i)) end end

for i, entry in ipairs({"births", "deaths"}) do table.insert(result, '== ' .. uc[entry] .. ' ==')

-- الحصول على المحتوى الفعلي بدلاً من عرض كود القالب local content = {} for j, article in ipairs(article_list) do local section_content = transclude(frame, entry, year_list[j], article) if section_content and section_content ~= "" then table.insert(content, section_content) end end

if #content > 0 then table.insert(result, table.concat(content, "\n")) else table.insert(result, "لا توجد بيانات متاحة") end

table.insert(result, "") -- سطر فارغ لفصل الأقسام end

return table.concat(result, "\n") end

return p

Notes

المراجع

خطأ استشهاد: الوسم <ref> ذو الاسم "met" المُعرّف في <references> غير مستخدم في النص السابق.
خطأ استشهاد: الوسم <ref> ذو الاسم "BBC" المُعرّف في <references> غير مستخدم في النص السابق.
خطأ استشهاد: الوسم <ref> ذو الاسم "hinsch" المُعرّف في <references> غير مستخدم في النص السابق.