Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Article history/Category
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!
------------------------------------------------------------------------------- -- Category class -- This module makes a Category class for use in [[Module:Article history]]. -- It provides a unified interface for the creation of category links. With -- this class, categories can passed between objects without concerns about -- interoperability and still have their values and sort keys easily -- accessible. ------------------------------------------------------------------------------- local checkType = require('libraryUtil').checkType local CATEGORY_NS_TEXT = mw.site.namespaces[14].name local Category = {} Category.__index = Category function Category.new(category, sortKey) checkType('Category.new', 1, category, 'string') checkType('Category.new', 2, sortKey, 'string', true) local obj = setmetatable({}, Category) obj.category = category obj.sortKey = sortKey return obj end function Category:__tostring() if self.sortKey then return string.format( '[[%s:%s|%s]]', CATEGORY_NS_TEXT, self.category, self.sortKey ) else return string.format( '[[%s:%s]]', CATEGORY_NS_TEXT, self.category ) end end return Category
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)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Module:Arguments
(
edit
)
Module:Article history/Category/doc
(
edit
)
Module:Effective protection level
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Yesno
(
edit
)