menu menu_open
  • edit Edit

    description Contents

    • 1 Use from wikitext
    • 2 Use from other Lua modules
      • 2.1 _formatLink
      • 2.2 formatPages

    Navigation

    • Main page
    • All pages
    • Recent changes
    • Random page
    • Help

    Tools

    • What links here
    • Related changes
    • Special pages
    • Printable version
    • Permanent link
    • Page information

    Variants

The Lab Rats 2 - Reformulate Wiki

Module:Format link/doc

14 article Pages
18 photo Files
2128 edit Edits
22 person Users
timeline photo_library leaderboard file_upload
palette
  • computer
code
  • computer
pages api security app_shortcut
more_vertical
  • timeline Recent changes
  • photo_library New Files
  • leaderboard Statistics
  • file_upload Upload file
  • palette CSS expand_more
    • computer
  • code JS expand_more
    • computer
  • pages All pages
  • apisandbox API sandbox
  • security System messages
  • app_shortcut Special pages
grid_view double_arrow forum file_download extension file_upload visibility book category delete_sweep
settings
contrast

  • brightness_auto hdr_auto
  • brightness_7 brightness_1
  • brightness_6 brightness_2
  • brightness_5 brightness_3
  • brightness_4
  • brightness_3 brightness_5
  • brightness_2 brightness_6
  • brightness_1 brightness_7
hdr_auto
  • brightness_auto
  • hdr_auto
  • light_mode
  • dark_mode

  • palette
  • tonality

  • brightness_auto hdr_auto
  • gradient gradient
  • thermostat thermostat
  • ac_unit storm
  • Duo
  • Solo
format_paint
  • emergency deployed_code
  • emergency opacity
  • square
  • contrast

  • deployed_code build square contrast
  • 1
  • 2
  • 3
  • 4
palette
  • brightness_auto
  • hdr_auto
  • light_mode
  • dark_mode

  • build
  • emergency invert_colors_off
  • contrast
  • format_paint
  • android
  • colorize
colorize
  • brightness_auto
  • hdr_auto
  • bedtime_off
  • bedtime

  • build
  • square
  • computer
  • invert_colors
  • brush
  • filter_b_and_w
  • contrast
  • smart_toy
  • 1
  • 2
  • 3
  • 4
brush
  • A
  • B
  • C
  • D
  • E
  • F
  • G
  • H
  • Welcome to the Lab Rats 2 - Reformulate Wiki.
  • Stay tuned here for news and changes...
  • This wiki is currently being built. Feel free to contribute to it and discuss any suggestions or changes.
  • Visit the Lab Rats 2 Discord to discuss any missing information!
  • Module
  • Discussion
  • Read
  • View source
  • View history

Module:Format link/doc

From The Lab Rats 2 - Reformulate Wiki
< Module:Format link
Revision as of 02:06, 28 December 2021 by Cooperdk (talk | contribs) (1 revision imported: Imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:Format link

WarningThis Lua module is used on approximately 160,000 pages.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.

This module, migrated from origins in Module:Hatnote, provides functionality for formatting links for display, including that powering the {{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 colon trick, and includes functionality for italicizing the page or section name, and for detecting and categorizing results that produce red links.

Contents

  • 1 Use from wikitext
  • [+]2 Use from other Lua modules
    • 2.1 _formatLink
    • 2.2 formatPages

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:

local mFormatLink = require('Module:Format link')

You can then use the functions as documented below.

_formatLink

mFormatLink._formatLink{
    link = link,
    display = display,
    italicizePage = true,
    italicizeSection = true,
    categorizeMissing = 'Pages using formatted red links'
}

Formats link as a wikilink, with optional display value display. Categories and files are automatically escaped with the colon trick, and links to sections are automatically formatted as page § section, rather than the MediaWiki default of page#section. If manual piping is present in link, then the "manual" display value will be overridden by the display value if present.

If italicizePage is true then the page portion of the link is italicized, and if italicizeSection is true then the section portion of the link is italicized. If categorizeMissing is a string, then that value is used as a category name, and that category will be applied if the target of the link doesn't exist.

Examples
mFormatLink._formatLink{link = 'Foo#Bar'} → [[:Foo#Bar|Foo §&nbsp;Bar]] → Foo § Bar
mFormatLink._formatLink{link = 'Baz', display = 'Qux'} → [[:Baz|Qux]] → Qux
mFormatLink._formatLink{link = 'Foo|Bar', display = 'Baz'} → [[:Foo|Baz]] → Baz
mFormatLink._formatLink{link = 'Nonexistent page', categorizeMissing = 'Example'} → [[:Nonexistent page]][[Category:Example]] → Nonexistent page
mFormatLink._formatLink{link = 'Existing', categorizeMissing = 'Example'} → [[:Existing]] → Existing
mFormatLink._formatLink{link = 'The Lord of the Rings#Plot', italicizePage = true} → [[:The Lord of the Rings#Plot|''The Lord of the Rings'' §&nbsp;Plot]] → The Lord of the Rings § Plot
mFormatLink._formatLink{link = 'Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice', italicizeSection = true} → [[:Cybercrime Prevention Act of 2012#Disini v. Secretary of Justice|Cybercrime Prevention Act of 2012 §&nbsp;''Disini v. Secretary of Justice'']] → Cybercrime Prevention Act of 2012 § Disini v. Secretary of Justice

formatPages

mFormatLink.formatPages(options, pages)

This derived function is useful for lists that format many links. It formats an array of pages using the _formatLink function, and returns the result as an array. Options in the options table are applied, and use the same names as the options for _formatLink.

Example
mFormatLink.formatPages({categorizeMissing = 'Example'}, {'Foo#Bar', 'Nonexistent page'}) → {'[[:Foo#Bar|Foo § Bar]]', '[[:Nonexistent page]][[Category:Example]]'}


Retrieved from "https://lr2wiki.porn-organizer.org/index.php?title=Module:Format_link/doc&oldid=1218"
  • Privacy policy
  • About The Lab Rats 2 - Reformulate Wiki
  • Disclaimers
    • This page was last edited on 28 December 2021, at 02:06.
    • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
    • Creative Commons Attribution-ShareAlike
    • Powered by MediaWiki

    timeline Recent changes
    arrow_forward_ios

    No changes during the given period match these criteria.

    info About The Lab Rats 2 - Reformulate Wiki
    edit

    The wiki for the adult sandbox game Lab Rabs 2 - Reformulate

    search saved_search
    search saved_search Search
    apps
    • live_help
    • hive
    • insert_link
    • timeline
    • visibility
    • shuffle
    • build
    • help
    • file_download
    • attachment
    public_off Not logged inReady
    widgets
    public StandardReady
    hive MirahezeReady
    Qora QoreReady
    • Privacy policy
    • About The Lab Rats 2 - Reformulate Wiki
    • Disclaimers
    insert_link timeline visibility shuffle build help file_download attachment
    account_circle
    • refresh

    • Create account
    • Log in
    refresh