Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Gonnym/sometest5/2
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!
--[[ A category layout is as follows (not all items appear in all categories): - Poratls - "Container category" template - Hatnotes - Header text - Navigation template ]]-- local getOrdinal = require('Module:Ordinal')._ordinal local ERROR_CATEGORY = "[[Category:Errors reported by television chronology category header templates]]" local navigationTemplates = { ["year"] = "Navseasoncats with decades below year/sandbox", ["decade"] = "Navseasoncats with centuries below decade/sandbox", ["century"] = "Navseasoncats" } local p = {} p.errorMessagePrefixList = { ["NOT_ON_CATEGORY"] = "This page is not a category!<br />", ["INVALID_PAGE_NAME"] = "Invalid page name.<br />", } function p.isOnCategory(pageName) if (pageName.nsText == 'Category') then return true else return false end end function p.getPortals(frame, portal_categories, timePeriod) table.insert(portal_categories, frame:expandTemplate{title = "FindYDCportal", args = {timePeriod}}) return frame:expandTemplate{title = "Portal", args = portalArgs} end function p.getContainerCategoryTemplate(frame) frame:expandTemplate{title = "Container category"} end function p.getCatMainTemplate(frame, title) if (mw.title.makeTitle(0, title).exists) then return frame:expandTemplate{title = "Cat main", args = {title}} else return "" end end function p.getNavigationTemplate(frame, categoryHeader) return frame:expandTemplate{title = navigationTemplates[categoryHeader.type]} end function p.getError(errorPrefix, errorMessageText) local errorMessageText = errorPrefix .. errorMessageText local errorMessage = tostring(mw.html.create('strong') :addClass('error') :wikitext(errorMessageText) ) return errorMessage .. ERROR_CATEGORY end function p.getMillennium(century) century = tonumber(century) -- Need a more complete solution if this will be used with fictional categories. if (century > 9) then century = century * 100 end local millennium = math.floor((math.abs(century) - 1) / 1000) + 1 millennium = getOrdinal(millennium) .. " millennium" if (century < 0) then millennium = millennium .. " BC" end return millennium end function p.getCentury(decade) decade = tonumber(decade) local century = ((decade - 1) / 100) + 1 if (decade < -1) then century = century - 1 end century = math.floor(century) return getOrdinal(century) .. " century" end function p.getDecade(year) year = tonumber(year) local decade = year / 10 decade = math.floor(decade) decade = decade .. "0s" return decade end function p.getNextTierTimePeroid(categoryHeader, timePeriod) if (categoryHeader.type == "year") then return p.getDecade(timePeriod) elseif (categoryHeader.type == "decade") then return p.getCentury(timePeriod) elseif (categoryHeader.type == "century") then return p.getMillennium(timePeriod) end end return p
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Gonnym/sometest5/2/doc
(
edit
)