Jump to content
Menyu yikuru
Menyu yikuru
move to sidebar
kubisa
Mayendelo
Jani likulu
Vidumbizgano vya chikaya
Vakuchitika vasono
Kusintha kuphya
Jani lililose
Wovwili
To Do
Vyakuti vinozgeke
Vinyake
Mafumbo
Mazgo ghakomi
Helpful Pages (Wovwili)
Need for Fix
Need for Review
Admin Pages
Home pages
Home templates
Kufufuza
Kufufuza
Kaonekelo
Chakupeleka
Panga akaunti
Njila
Vilwelo vyako
Chakupeleka
Panga akaunti
Njila
Pages for logged out editors
learn more
vyakulemba
Pakuchezgela
Kulemba
Module:Format link/doc
Sazgapo viyowoyelo
Module
Kudumbizgana
chiTumbuka
Ŵelengani
Kulemba source
Kuona umo mayambilo
Vilwelo
Vilwelo
move to sidebar
kubisa
Vyakuchita
Ŵelengani
Kulemba source
Kuona umo mayambilo
Vya masiku ghose
Ivo vikwiza pano
Vyaku sintha
Kwezgela chinthu
Va jani lino
Penjani URL yakufupikizgika
Sangululani kodi ya QR
Kaonekelo
move to sidebar
kubisa
Chenjezgo:
Mundanjile mu akaunti yinu. Pala mulembenge chilichose IP adilesi yinu waliyose waionenge. Pala
mwanjila
mu akaunti yinu
panji
mwapanga akaunti
, vyakulemba vinu vyose viŵenge mu zina linu, na uwemi unyake.
Anti-spam check. Do
not
fill this in!
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> {{used in system|in [[MediaWiki:Perfcachedts]]}} This module, migrated from origins in [[Module:Hatnote]], provides functionality for formatting links for display, including that powering the {{tl|format link}} template. It can pretty-format section links with the section symbol ("§") and appropriate whitespace, it automatically escapes category and file names with the [[Help:Colon trick|colon trick]], and includes functionality for italicizing the page or section name, and for detecting and categorizing results that produce [[Wikipedia:Red link|red links]]. == Use from wikitext == The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see [[Template:Format link]] for documentation on usage of that template. == Use from other Lua modules== To load this module from another Lua module, use the following code: <syntaxhighlight lang="lua"> local mFormatLink = require('Module:Format link') </syntaxhighlight> You can then use the functions as documented below. === _formatLink === <syntaxhighlight lang="lua"> mFormatLink._formatLink{ link = 'Link', display = 'Display', target = 'Target', italicizePage = true, italicizeSection = true, categorizeMissing = 'Pages using formatted red links' } </syntaxhighlight> Formats <var>link</var> as a wikilink. Categories and files are automatically escaped with the [[Help:Colon trick|colon trick]], and links to sections are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''. Several options modify the output: * If the <var>display</var> value is present, then it will be used as a display value. Any manual piping (using the <code><nowiki>{{!}}</nowiki></code> magic word or similar) present in <var>link</var> will be overridden by the <var>display</var> value if present. * If the <var>target</var> value is present, then it will override <var>link</var> as a target, but the result will still be ''displayed'' using either the value from <var>display</var>, or the result of formatting <var>link</var>. * If <var>italicizePage</var> is true, then the page portion of the link is italicized if present. * If <var>italicizeSection</var> is true, then the section portion of the link is italicized if present. * If <var>categorizeMissing</var> is a non-empty string, then that value is used as a category name, and that category will be applied if the resulting target of the link (no matter whether through <var>link</var> or through <var>target</var>) doesn't exist. ;Examples: : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = 'Foo#Bar'}</syntaxhighlight> → <nowiki>[[:Foo#Bar|Foo §&nbsp;Bar]]</nowiki> → {{format link|Foo#Bar}} : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = 'Baz', display = 'Qux'}</syntaxhighlight> → <nowiki>[[:Baz|Qux]]</nowiki> → {{format link|Baz|Qux}} : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = 'Foo|Bar', display = 'Baz'}</syntaxhighlight> → <nowiki>[[:Foo|Baz]]</nowiki> → {{format link|Foo{{!}}Bar|Baz}} : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = '#Foo', target = 'Example#Foo'}</syntaxhighlight> → <nowiki>[[:Example#Foo|§&nbsp;Foo]]</nowiki> → {{format link|#Foo||Example#Foo}} : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = 'The Lord of the Rings#Plot', italicizePage = true}</syntaxhighlight> → <nowiki>[[:The Lord of the Rings#Plot|''The Lord of the Rings'' §&nbsp;Plot]]</nowiki> → {{format link|The Lord of the Rings#Plot|italicizepage=true}} : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = 'Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice', italicizeSection = true}</syntaxhighlight> → <nowiki>[[:Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice|Cybercrime Prevention Act of 2012 §&nbsp;''Disini v. Secretary of Justice'']]</nowiki> → {{format link|Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice|italicizesection=true}} : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = 'Nonexistent page', categorizeMissing = 'Example'}</syntaxhighlight> → <nowiki>[[:Nonexistent page]][[Category:Example]]</nowiki> → {{format link|Nonexistent page}} : <syntaxhighlight lang="lua" inline>mFormatLink._formatLink{link = 'Existing', categorizeMissing = 'Example'}</syntaxhighlight> → <nowiki>[[:Existing]]</nowiki> → {{format link|Existing}} === formatPages === <syntaxhighlight lang="lua"> mFormatLink.formatPages(options, pages) </syntaxhighlight> This derived function is useful for lists that format many links. It formats an array of pages using the [[#_formatLink|_formatLink]] function, and returns the result as an array. Options in the <var>options</var> table are applied, and use the same names as the options for <var>_formatLink</var>. ;Example :{{code|<nowiki>mFormatLink.formatPages({categorizeMissing = 'Example'}, {'Foo#Bar', 'Nonexistent page'})</nowiki>|lua}} → {{code|<nowiki>{'[[:Foo#Bar|Foo § Bar]]', '[[:Nonexistent page]][[Category:Example]]'}</nowiki>|lua}} == Errors == If <var>_formatLink</var> is used and neither a <var>link</var> nor a <var>target</var> argument is provided, then the module will produce an error message instead of its usual output, as it ''cannot'' then produce valid output. You can solve this error by providing appropriate parameters to <var>_formatLink</var>, or you may want to ensure that a more descriptive error is provided by a downstream template or module when it would otherwise call <var>_formatLink</var> with inadequate arguments. <includeonly>{{Sandbox other|| <!-- Categories below this line; interwikis at Wikidata --> }}</includeonly>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Kuleka
Wowili wakalembelo
(julani mu windo lanyuwani)
Preview page with this template
Nkhwaska zagwiliskika apa:
Template:Code
(
lemba
)
Template:Format link
(
lemba
)
Template:Sandbox other
(
lemba
)
Template:Str left
(
lemba
)
Template:Template link
(
lemba
)
Template:Tl
(
lemba
)
Template:Used in system
(
lemba
)
Module:Arguments
(
lemba
)
Module:Format link
(
lemba
)
Module:High-use
(
lemba
)
Module:Message box
(
lemba
)
Module:Message box/configuration
(
lemba
)
Module:Message box/ombox.css
(
lemba
)
Module:String
(
lemba
)
Module:Transclusion count
(
lemba
)
Module:Transclusion count/data/F
(
lemba
)
Module:Yesno
(
lemba
)
Kufufuza
Kufufuza
Kulemba
Module:Format link/doc
Sazgapo viyowoyelo
Add topic