Title: Module:Hatnote - freem URL Source: https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote Markdown Content: [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#) - [x] * [Home](https://freemwiki.com/wiki/Main_Page) * [Random](https://freemwiki.com/wiki/Special:Random) * [Log in](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3AHatnote&returntoquery=mobileaction%3Dtoggle_view_mobile) * [Settings](https://freemwiki.com/index.php?title=Special:MobileOptions&returnto=Module%3AHatnote) * [About](https://freemwiki.com/wiki/About) * [Terms of Service](https://freemwiki.com/wiki/Terms_of_Service) [freem](https://freemwiki.com/wiki/Main_Page) Search # Module:Hatnote * [Language](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote "Language") * [Watch](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3AHatnote) * [Edit](https://freemwiki.com/index.php?title=Module:Hatnote&action=edit) _Documentation for this module may be created at [Module:Hatnote/doc](https://freemwiki.com/index.php?title=Module:Hatnote/doc&action=edit&redlink=1 "Module:Hatnote/doc (page does not exist)")_ [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-1)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-2)-- Module:Hatnote --[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-3)-- --[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-4)-- This module produces hatnote links and links to related articles. It --[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-5)-- implements the {{[hatnote](https://freemwiki.com/wiki/Template:Hatnote "Template:Hatnote")}} and {{[format link](https://freemwiki.com/wiki/Template:Format_link "Template:Format link")}} meta-templates and includes --[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-6)-- helper functions for other Lua hatnote modules. --[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-7)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-8)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-9)local libraryUtil = require('libraryUtil')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-10)local checkType = libraryUtil.checkType[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-11)local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-12)local mArguments -- lazily initialise [[[Module:Arguments]]](https://freemwiki.com/wiki/Module:Arguments "Module:Arguments")[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-13)local yesno -- lazily initialise [[[Module:Yesno]]](https://freemwiki.com/wiki/Module:Yesno "Module:Yesno")[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-14)local formatLink -- lazily initialise [[[Module:Format link]]](https://freemwiki.com/wiki/Module:Format_link "Module:Format link") ._formatLink[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-15)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-16)local p = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-17)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-18)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-19)-- Helper functions[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-20)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-21)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-22)local function getArgs(frame)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-23)-- Fetches the arguments from the parent frame. Whitespace is trimmed and[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-24)-- blanks are removed.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-25)mArguments = require(['Module:Arguments'](https://freemwiki.com/wiki/Module:Arguments))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-26)return mArguments.getArgs(frame, {parentOnly = true})[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-27)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-28)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-29)local function removeInitialColon(s)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-30)-- Removes the initial colon from a string, if present.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-31)return s:match('^:?(.*)')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-32)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-33)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-34)function p.defaultClasses(inline)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-35)-- Provides the default hatnote classes as a space-separated string; useful[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-36)-- for hatnote-manipulation modules like [[[Module:Hatnote group]]](https://freemwiki.com/wiki/Module:Hatnote_group "Module:Hatnote group").[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-37)return[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-38)(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-39)'navigation-not-searchable'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-40)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-41)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-42)function p.disambiguate(page, disambiguator)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-43)-- Formats a page title with a disambiguation parenthetical,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-44)-- i.e. "Example" → "Example (disambiguation)".[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-45)checkType('disambiguate', 1, page, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-46)checkType('disambiguate', 2, disambiguator, 'string', true)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-47)disambiguator = disambiguator or 'disambiguation'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-48)return mw.ustring.format('%s (%s)', page, disambiguator)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-49)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-50)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-51)function p.findNamespaceId(link, removeColon)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-52)-- Finds the namespace id (namespace number) of a link or a pagename. This[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-53)-- function will not work if the link is enclosed in double brackets. Colons[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-54)-- are trimmed from the start of the link by default. To skip colon[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-55)-- trimming, set the removeColon parameter to false.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-56)checkType('findNamespaceId', 1, link, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-57)checkType('findNamespaceId', 2, removeColon, 'boolean', true)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-58)if removeColon ~= false then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-59)link = removeInitialColon(link)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-60)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-61)local namespace = link:match('^(.-):')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-62)if namespace then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-63)local nsTable = mw.site.namespaces[namespace][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-64)if nsTable then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-65)return nsTable.id[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-66)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-67)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-68)return 0[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-69)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-70)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-71)function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-72)-- Formats an error message to be returned to wikitext. If[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-73)-- addTrackingCategory is not false after being returned from[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-74)-- [[[Module:Yesno]]](https://freemwiki.com/wiki/Module:Yesno "Module:Yesno"), and if we are not on a talk page, a tracking category[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-75)-- is added.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-76)checkType('makeWikitextError', 1, msg, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-77)checkType('makeWikitextError', 2, helpLink, 'string', true)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-78)yesno = require(['Module:Yesno'](https://freemwiki.com/wiki/Module:Yesno))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-79)title = title or mw.title.getCurrentTitle()[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-80)-- Make the help link text.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-81)local helpText[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-82)if helpLink then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-83)helpText = ' ([[' .. helpLink .. '|help]])'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-84)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-85)helpText = ''[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-86)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-87)-- Make the category text.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-88)local category[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-89)if not title.isTalkPage -- Don't categorise talk pages[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-90)and title.namespace ~= 2 -- Don't categorise userspace[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-91)and yesno(addTrackingCategory) ~= false -- Allow opting out[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-92)then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-93)category = 'Hatnote templates with errors'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-94)category = mw.ustring.format([](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-95)'[[%s:%s]]',[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-96)mw.site.namespaces[14].name,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-97)category[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-98))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-99)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-100)category = ''[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-101)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-102)return mw.ustring.format([](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-103)'Error: %s%s.%s',[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-104)msg,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-105)helpText,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-106)category[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-107))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-108)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-109)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-110)local curNs = mw.title.getCurrentTitle().namespace[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-111)p.missingTargetCat =[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-112)--Default missing target category, exported for use in related modules[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-113)((curNs == 0) or (curNs == 14)) and[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-114)'Articles with hatnote templates targeting a nonexistent page' or nil[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-115)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-116)function p.quote(title)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-117)--Wraps titles in quotation marks. If the title starts/ends with a quotation[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-118)--mark, kerns that side as with {{[-'](https://freemwiki.com/wiki/Template:-%27 "Template:-'")}}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-119)local quotationMarks = {[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-120)["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-121)}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-122)local quoteLeft, quoteRight = -- Test if start/end are quotation marks[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-123)quotationMarks[string.sub(title, 1, 1)],[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-124)quotationMarks[string.sub(title, -1, -1)][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-125)if quoteLeft or quoteRight then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-126)title = mw.html.create("span"):wikitext(title)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-127)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-128)if quoteLeft then title:css("padding-left", "0.15em") end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-129)if quoteRight then title:css("padding-right", "0.15em") end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-130)return '"' .. tostring(title) .. '"'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-131)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-132)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-133)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-134)-- Hatnote[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-135)--[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-136)-- Produces standard hatnote text. Implements the {{[hatnote](https://freemwiki.com/wiki/Template:Hatnote "Template:Hatnote")}} template.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-137)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-138)p[''] = function (frame) return p.hatnote(frame:newChild{ title = "Template:Hatnote" }) end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-139)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-140)function p.hatnote(frame)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-141)local args = getArgs(frame)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-142)local s = args[1][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-143)if not s then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-144)return p.makeWikitextError([](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-145)'no text specified',[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-146)'Template:Hatnote#Errors',[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-147)args.category[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-148))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-149)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-150)return p._hatnote(s, {[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-151)extraclasses = args.extraclasses,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-152)selfref = args.selfref[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-153)})[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-154)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-155)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-156)function p._hatnote(s, options)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-157)checkType('_hatnote', 1, s, 'string')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-158)checkType('_hatnote', 2, options, 'table', true)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-159)options = options or {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-160)local inline = options.inline[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-161)local hatnote = mw.html.create(inline == 1 and 'span' or 'div')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-162)local extraclasses[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-163)if type(options.extraclasses) == 'string' then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-164)extraclasses = options.extraclasses[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-165)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-166)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-167)hatnote[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-168):attr('role', 'note')[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-169):addClass(p.defaultClasses(inline))[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-170):addClass(extraclasses)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-171):addClass(options.selfref and 'selfref' or nil)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-172):wikitext(s)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-173)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-174)return mw.getCurrentFrame():extensionTag{[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-175)name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-176)} .. tostring(hatnote)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-177)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-178)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3AHatnote#L-179)return p Retrieved from "[https://freemwiki.com/index.php?title=Module:Hatnote&oldid=579768](https://freemwiki.com/index.php?title=Module:Hatnote&oldid=579768)" [**Last edited 9 months ago** by Lukegao](https://freemwiki.com/index.php?title=Module:Hatnote&action=history) #### Languages This page is not available in other languages. freem * This page was last edited on 21 October 2025, at 06:18. * Content is available under [Creative Commons Attribution-ShareAlike 4.0](https://creativecommons.org/licenses/by-sa/4.0/) unless otherwise noted. FreemWiki is operated by **FINGERPOWER DIGITAL TECHNOLOGY LLC** (Colorado, Entity ID 20221978727). * [Privacy Policy](https://freemwiki.com/wiki/Privacy_Policy) * [About](https://freemwiki.com/wiki/About) * [Terms of Service](https://freemwiki.com/wiki/Terms_of_Service) * [Desktop](https://freemwiki.com/index.php?title=Module:Hatnote&mobileaction=toggle_view_desktop)