Module:Clean image/doc

Revision as of 07:32, 25 March 2024 by BlackHawk (talk | contribs) (Created page with "{{Documentation}} Cleans an input image to prevent double linking. {{Helper module |name=Clean image |fname1=<nowiki>clean{ file = [string|'no'], width = [string|nil], height = [string|nil], link = [string|nil], align = [string|nil] }</nowiki> |ftype1=table |fuse1=Used to clean up user input; extracts only the file name of the input and returns its own formatted link. Input is a table with fields: * <code>file</code> - t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:Clean image

This is a documentation subpage for Module:Clean image.
It contains usage information, categories, and other content that is not part of the original module page.
Module:Clean image's function main is invoked by Template:Clean image.
Module:Clean image requires Module:Paramtest.

Cleans an input image to prevent double linking.

This module is a helper module to be used by other modules; it may not designed to be invoked directly. See Brighter Shores:Lua/Helper modules for a full list and more information.

FunctionTypeUse
clean{ file = [string|'no'], width = [string|nil], height = [string|nil], link = [string|nil], align = [string|nil] }tableUsed to clean up user input; extracts only the file name of the input and returns its own formatted link.

Input is a table with fields:

  • file - the full wikitext to be cleaned. All processing is skipped if file is empty or is the string no.
  • width - width to resize the file to; no default
  • height - height to resize the file to, can be combined with width; no default
  • link - what page to link the file to; no default (file will link to file page), no to link to nothing
  • align - alignment for the image; left, center, right; no default

Example:

local cleanImage = require( 'Module:Clean image' ).clean
mw.log( cleanImage{ file = '[[File:Basic bacon.png|link=Basic bacon|200px]]' } ) --> '[[File:Basic bacon.png|frameless]]'