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&amp;action=edit&amp;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(&#039;libraryUtil&#039;)<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(&#039;Module:Arguments&#039;)<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(&#039;^:?(.*)&#039;)<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 &#039;hatnote-inline&#039; or &#039;hatnote&#039;) .. &#039; &#039; ..<br /> &#039;navigation-not-searchable&#039;<br /> end<br /> <br /> function p.disambiguate(page, disambiguator)<br /> -- Formats a page title with a disambiguation parenthetical,<br /> -- i.e. &quot;Example&quot; → &quot;Example (disambiguation)&quot;.<br /> checkType(&#039;disambiguate&#039;, 1, page, &#039;string&#039;)<br /> checkType(&#039;disambiguate&#039;, 2, disambiguator, &#039;string&#039;, true)<br /> disambiguator = disambiguator or &#039;disambiguation&#039;<br /> return mw.ustring.format(&#039;%s (%s)&#039;, 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(&#039;findNamespaceId&#039;, 1, link, &#039;string&#039;)<br /> checkType(&#039;findNamespaceId&#039;, 2, removeColon, &#039;boolean&#039;, true)<br /> if removeColon ~= false then<br /> link = removeInitialColon(link)<br /> end<br /> local namespace = link:match(&#039;^(.-):&#039;)<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(&#039;makeWikitextError&#039;, 1, msg, &#039;string&#039;)<br /> checkType(&#039;makeWikitextError&#039;, 2, helpLink, &#039;string&#039;, true)<br /> yesno = require(&#039;Module:Yesno&#039;)<br /> title = title or mw.title.getCurrentTitle()<br /> -- Make the help link text.<br /> local helpText<br /> if helpLink then<br /> helpText = &#039; ([[&#039; .. helpLink .. &#039;|help]])&#039;<br /> else<br /> helpText = &#039;&#039;<br /> end<br /> -- Make the category text.<br /> local category<br /> if not title.isTalkPage -- Don&#039;t categorise talk pages<br /> and title.namespace ~= 2 -- Don&#039;t categorise userspace<br /> and yesno(addTrackingCategory) ~= false -- Allow opting out<br /> then<br /> category = &#039;Hatnote templates with errors&#039;<br /> category = mw.ustring.format(<br /> &#039;[[%s:%s]]&#039;,<br /> mw.site.namespaces[14].name,<br /> category<br /> )<br /> else<br /> category = &#039;&#039;<br /> end<br /> return mw.ustring.format(<br /> &#039;&lt;strong class=&quot;error&quot;&gt;Error: %s%s.&lt;/strong&gt;%s&#039;,<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 /> &#039;Articles with hatnote templates targeting a nonexistent page&#039; 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 {{-&#039;}}<br /> local quotationMarks = {<br /> [&quot;&#039;&quot;]=true, [&#039;&quot;&#039;]=true, [&#039;“&#039;]=true, [&quot;‘&quot;]=true, [&#039;”&#039;]=true, [&quot;’&quot;]=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(&quot;span&quot;):wikitext(title)<br /> end<br /> if quoteLeft then title:css(&quot;padding-left&quot;, &quot;0.15em&quot;) end<br /> if quoteRight then title:css(&quot;padding-right&quot;, &quot;0.15em&quot;) end<br /> return &#039;&quot;&#039; .. tostring(title) .. &#039;&quot;&#039;<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 /> &#039;no text specified&#039;,<br /> &#039;Template:Hatnote#Errors&#039;,<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(&#039;_hatnote&#039;, 1, s, &#039;string&#039;)<br /> checkType(&#039;_hatnote&#039;, 2, options, &#039;table&#039;, true)<br /> options = options or {}<br /> local inline = options.inline<br /> local hatnote = mw.html.create(inline == 1 and &#039;span&#039; or &#039;div&#039;)<br /> local extraclasses<br /> if type(options.extraclasses) == &#039;string&#039; then<br /> extraclasses = options.extraclasses<br /> end<br /> <br /> hatnote<br /> :attr(&#039;role&#039;, &#039;note&#039;)<br /> :addClass(p.defaultClasses(inline))<br /> :addClass(extraclasses)<br /> :addClass(options.selfref and &#039;selfref&#039; or nil)<br /> :wikitext(s)<br /> <br /> return mw.getCurrentFrame():extensionTag{<br /> name = &#039;templatestyles&#039;, args = { src = &#039;Module:Hatnote/styles.css&#039; }<br /> } .. tostring(hatnote)<br /> end<br /> <br /> return p</div> infobox>Nihiltres