Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Births and deaths by year for decade
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local uc = {births="Births", deaths="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("{{#section-h::" .. page_name .. "|".. section_name .. "}}") end end return "" end local function transclude(frame, entry, year, article) local s = "'''{{dr|y|y|" .. year .. "|0|{{#ifexpr: " .. year .. " <= 100|na|n}}}}''' " s = frame:preprocess(s) .. get_section(frame, article, uc[entry]) s = mw.ustring.gsub(s, '==+[^=]-==+%s*%c*', '') return mw.ustring.match(s, '.*%*.*%a.+') 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 = "Year article", 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 = "Year article", 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] .. '==') table.insert(result, frame:expandTemplate { title = "transcluding article", args = article_list}) for i, article in ipairs(article_list) do table.insert(result, transclude(frame, entry, year_list[i], article)) end end return table.concat(result, "\n") end return p
Summary:
Please note that all contributions to Humanipedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Error
(
edit
)
Template:Lua sidebar
(
edit
)
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Pp
(
edit
)
Template:Protection padlock
(
edit
)
Template:Sandbox other
(
edit
)
Template:Sidebar
(
edit
)
Template:Template link
(
edit
)
Template:Tl
(
edit
)
Module:Births and deaths by year for decade/doc
(
edit
)
Module:Error
(
edit
)
Module:File link
(
edit
)
Module:Message box
(
edit
)
Module:Protection banner
(
edit
)
Module:String
(
edit
)