http://proplan.55bet-pro.com/wiki/index.php?action=history&feed=atom&title=M%C3%B3dulo%3AHatnote
Módulo:Hatnote - Histórico de revisão-55BET Pro
2026-03-13T11:23:23Z
Histórico de revisões para esta página neste wiki
MediaWiki 1.42.7
http://proplan.55bet-pro.com/wiki/index.php?title=M%C3%B3dulo:Hatnote&diff=105&oldid=prev
Módulo:Hatnote - Histórico de revisão-55BET Pro
2024-06-27T11:11:55Z
<p>uma edição</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="pt-BR">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Edição anterior</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Edição das 08h11min de 27 de junho de 2024</td>
</tr><tr><td colspan="2" class="diff-notice" lang="pt-BR"><div class="mw-diff-empty">(Sem diferença)</div>
</td></tr></table>
Henryzord
http://proplan.55bet-pro.com/wiki/index.php?title=M%C3%B3dulo:Hatnote&diff=104&oldid=prev
Módulo:Hatnote - Histórico de revisão-55BET Pro
2022-09-05T18:18:32Z
<p>Reordered helper functions (first by export status, then alphabetically) and migrated p.quote upstream from <a href="/wiki/index.php?title=M%C3%B3dulo:Redirect_hatnote&action=edit&redlink=1" class="new" title="Módulo:Redirect hatnote (página inexistente)">Module:Redirect hatnote</a> (includes contributions by Tamzin and Nihiltres)</p>
<p><b>Página nova</b></p><div>--------------------------------------------------------------------------------<br />
-- Module:Hatnote --<br />
-- --<br />
-- This module produces hatnote links and links to related articles. It --<br />
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --<br />
-- helper functions for other Lua hatnote modules. --<br />
--------------------------------------------------------------------------------<br />
<br />
local libraryUtil = require('libraryUtil')<br />
local checkType = libraryUtil.checkType<br />
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg<br />
local mArguments -- lazily initialise [[Module:Arguments]]<br />
local yesno -- lazily initialise [[Module:Yesno]]<br />
local formatLink -- lazily initialise [[Module:Format link]] ._formatLink<br />
<br />
local p = {}<br />
<br />
--------------------------------------------------------------------------------<br />
-- Helper functions<br />
--------------------------------------------------------------------------------<br />
<br />
local function getArgs(frame)<br />
-- Fetches the arguments from the parent frame. Whitespace is trimmed and<br />
-- blanks are removed.<br />
mArguments = require('Module:Arguments')<br />
return mArguments.getArgs(frame, {parentOnly = true})<br />
end<br />
<br />
local function removeInitialColon(s)<br />
-- Removes the initial colon from a string, if present.<br />
return s:match('^:?(.*)')<br />
end<br />
<br />
function p.defaultClasses(inline)<br />
-- Provides the default hatnote classes as a space-separated string; useful<br />
-- for hatnote-manipulation modules like [[Module:Hatnote group]].<br />
return<br />
(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..<br />
'navigation-not-searchable'<br />
end<br />
<br />
function p.disambiguate(page, disambiguator)<br />
-- Formats a page title with a disambiguation parenthetical,<br />
-- i.e. "Example" → "Example (disambiguation)".<br />
checkType('disambiguate', 1, page, 'string')<br />
checkType('disambiguate', 2, disambiguator, 'string', true)<br />
disambiguator = disambiguator or 'disambiguation'<br />
return mw.ustring.format('%s (%s)', page, disambiguator)<br />
end<br />
<br />
function p.findNamespaceId(link, removeColon)<br />
-- Finds the namespace id (namespace number) of a link or a pagename. This<br />
-- function will not work if the link is enclosed in double brackets. Colons<br />
-- are trimmed from the start of the link by default. To skip colon<br />
-- trimming, set the removeColon parameter to false.<br />
checkType('findNamespaceId', 1, link, 'string')<br />
checkType('findNamespaceId', 2, removeColon, 'boolean', true)<br />
if removeColon ~= false then<br />
link = removeInitialColon(link)<br />
end<br />
local namespace = link:match('^(.-):')<br />
if namespace then<br />
local nsTable = mw.site.namespaces[namespace]<br />
if nsTable then<br />
return nsTable.id<br />
end<br />
end<br />
return 0<br />
end<br />
<br />
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)<br />
-- Formats an error message to be returned to wikitext. If<br />
-- addTrackingCategory is not false after being returned from<br />
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category<br />
-- is added.<br />
checkType('makeWikitextError', 1, msg, 'string')<br />
checkType('makeWikitextError', 2, helpLink, 'string', true)<br />
yesno = require('Module:Yesno')<br />
title = title or mw.title.getCurrentTitle()<br />
-- Make the help link text.<br />
local helpText<br />
if helpLink then<br />
helpText = ' ([[' .. helpLink .. '|help]])'<br />
else<br />
helpText = ''<br />
end<br />
-- Make the category text.<br />
local category<br />
if not title.isTalkPage -- Don't categorise talk pages<br />
and title.namespace ~= 2 -- Don't categorise userspace<br />
and yesno(addTrackingCategory) ~= false -- Allow opting out<br />
then<br />
category = 'Hatnote templates with errors'<br />
category = mw.ustring.format(<br />
'[[%s:%s]]',<br />
mw.site.namespaces[14].name,<br />
category<br />
)<br />
else<br />
category = ''<br />
end<br />
return mw.ustring.format(<br />
'<strong class="error">Error: %s%s.</strong>%s',<br />
msg,<br />
helpText,<br />
category<br />
)<br />
end<br />
<br />
local curNs = mw.title.getCurrentTitle().namespace<br />
p.missingTargetCat =<br />
--Default missing target category, exported for use in related modules<br />
((curNs == 0) or (curNs == 14)) and<br />
'Articles with hatnote templates targeting a nonexistent page' or nil<br />
<br />
function p.quote(title)<br />
--Wraps titles in quotation marks. If the title starts/ends with a quotation<br />
--mark, kerns that side as with {{-'}}<br />
local quotationMarks = {<br />
["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true<br />
}<br />
local quoteLeft, quoteRight = -- Test if start/end are quotation marks<br />
quotationMarks[string.sub(title, 1, 1)],<br />
quotationMarks[string.sub(title, -1, -1)]<br />
if quoteLeft or quoteRight then<br />
title = mw.html.create("span"):wikitext(title)<br />
end<br />
if quoteLeft then title:css("padding-left", "0.15em") end<br />
if quoteRight then title:css("padding-right", "0.15em") end<br />
return '"' .. tostring(title) .. '"'<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Hatnote<br />
--<br />
-- Produces standard hatnote text. Implements the {{hatnote}} template.<br />
--------------------------------------------------------------------------------<br />
<br />
function p.hatnote(frame)<br />
local args = getArgs(frame)<br />
local s = args[1]<br />
if not s then<br />
return p.makeWikitextError(<br />
'no text specified',<br />
'Template:Hatnote#Errors',<br />
args.category<br />
)<br />
end<br />
return p._hatnote(s, {<br />
extraclasses = args.extraclasses,<br />
selfref = args.selfref<br />
})<br />
end<br />
<br />
function p._hatnote(s, options)<br />
checkType('_hatnote', 1, s, 'string')<br />
checkType('_hatnote', 2, options, 'table', true)<br />
options = options or {}<br />
local inline = options.inline<br />
local hatnote = mw.html.create(inline == 1 and 'span' or 'div')<br />
local extraclasses<br />
if type(options.extraclasses) == 'string' then<br />
extraclasses = options.extraclasses<br />
end<br />
<br />
hatnote<br />
:attr('role', 'note')<br />
:addClass(p.defaultClasses(inline))<br />
:addClass(extraclasses)<br />
:addClass(options.selfref and 'selfref' or nil)<br />
:wikitext(s)<br />
<br />
return mw.getCurrentFrame():extensionTag{<br />
name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }<br />
} .. tostring(hatnote)<br />
end<br />
<br />
return p</div>
infobox>Nihiltres