Editing
Module:Hatnote
Jump to navigation
Jump to search
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!
-- repurposed from -- -- https://en.wikipedia.org/w/index.php?title=Module:Hatnote&oldid=1063743122 -- -- -- -- Implements {{hatnote}} template -- local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {} -- Helper functions -- local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" β "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return mw.ustring.format('%s (%s)', page, disambiguator) end -- Produces standard hatnote text -- function p.hatnote(frame) local args = frame:getParent().args local s = args[1] if not s then return '<strong class="error">No text specified for hatnote</strong>' end return p._hatnote(s, { extraclasses = args.extraclasses }) end function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local inline = options.inline local hatnote = mw.html.create(inline == 1 and 'span' or 'div') local extraclasses if type(options.extraclasses) == 'string' then extraclasses = options.extraclasses end hatnote :attr('role', 'note') :addClass(inline == 1 and 'hatnote-inline' or 'hatnote') :addClass(extraclasses) :addClass('navigation-not-searchable') :wikitext(s) return tostring(hatnote) end return p
Summary:
Please note that all contributions to OtherX 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
OtherX:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Documentation
(
edit
)
Template:T
(
edit
)
Module:Array
(
edit
)
Module:DPLlua
(
edit
)
Module:DependencyList
(
edit
)
Module:Documentation
(
edit
)
Module:Hatnote
(
edit
)
Module:Hatnote/doc
(
edit
)
Module:Paramtest
(
edit
)
Module:T
(
edit
)
Module:Tooltip
(
edit
)
Module:Yesno
(
edit
)
This page is a member of a hidden category:
Category:Pages with broken file links
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Purge cache
Search
Discord
Discord
Navigation
Main page
About us
Random page
Otherside
Legends of the Mara
Otherside Trips
Otherside Test Events
LOTM Guides & Info
Basics Guide
Hunting Guide
Farming Guide
Enchanting Guide
Game Updates
Oda Information
Quick References
Koda Weapons
Oda Abilities Table
Oda Stats Table
Tools
What links here
Related changes
Special pages
Page information
Page values