Module:If preview
- Afrikaans
- अंगिका
- Аԥсшәа
- العربية
- Արեւմտահայերէն
- অসমীয়া
- Asturianu
- Авар
- تۆرکجه
- Basa Bali
- বাংলা
- 閩南語 / Bân-lâm-gí
- Беларуская
- Беларуская (тарашкевіца)
- भोजपुरी
- Bosanski
- Català
- Cebuano
- Cymraeg
- Dansk
- الدارجة
- ދިވެހިބަސް
- Ελληνικά
- فارسی
- Français
- Galego
- گیلکی
- Хальмг
- 한국어
- Հայերեն
- हिन्दी
- Hrvatski
- Ilokano
- Bahasa Indonesia
- Íslenska
- Jawa
- ქართული
- Қазақша
- Kurdî
- Lietuvių
- Magyar
- मैथिली
- Македонски
- മലയാളം
- Māori
- მარგალური
- مازِرونی
- Bahasa Melayu
- ꯃꯤꯇꯩ ꯂꯣꯟ
- 閩東語 / Mìng-dĕ̤ng-ngṳ̄
- Монгол
- မြန်မာဘာသာ
- Na Vosa Vakaviti
- Nederlands
- नेपाली
- 日本語
- Napulitano
- Norsk bokmål
- ଓଡ଼ିଆ
- Oʻzbekcha / ўзбекча
- ਪੰਜਾਬੀ
- پنجابی
- ပအိုဝ်ႏဘာႏသာႏ
- پښتو
- ភាសាខ្មែរ
- Português
- Qaraqalpaqsha
- Română
- Русиньскый
- Русский
- ᱥᱟᱱᱛᱟᱲᱤ
- سرائیکی
- Scots
- Sesotho sa Leboa
- සිංහල
- Simple English
- سنڌي
- Slovenščina
- کوردی
- Српски / srpski
- Srpskohrvatski / српскохрватски
- Suomi
- Tagalog
- தமிழ்
- Taclḥit
- တႆး
- ไทย
- Türkçe
- Türkmençe
- Українська
- اردو
- Tiếng Việt
- Winaray
- 中文
- Batak Toba
- Ghanaian Pidgin
- Kumoring
- Руски
- ꠍꠤꠟꠐꠤ
- ᥖᥭᥰ ᥖᥬᥲ ᥑᥨᥒᥰ
Appearance
From Wikipedia, the free encyclopedia
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
Page template-protected This module is currently protected from editing.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
Warning This Lua module is used on approximately 656,000 pages, or roughly 1% of all 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.
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 depends on the following other modules:
This module implements {{If preview }} and {{Preview warning }}. It helps templates/modules determine if they are being previewed.
Prefer implementing the template versions in other templates.
In a module to use the main(), you need to pass a frame table with an args table.
For the preview warning, use _warning().
The above documentation is transcluded from Module:If preview/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
localp={} localgetArgs=require("Module:Arguments").getArgs localyn=require("Module:Yesno") localcfg=mw.loadData('Module:If preview/configuration') --[[ main This function returns either the first argument or second argument passed to this module, depending on whether the page is being previewed. ]] functionp.main(frame) localargs=getArgs(frame) ifcfg.previewthen returnargs[1]or'' else returnargs[2]or'' end end --[[ pmain This function returns either the first argument or second argument passed to this module's parent (i.e. template using this module), depending on whether it is being previewed. ]] functionp.pmain(frame) returnp.main(frame:getParent()) end localfunctionwarning_text(warning) returnmw.ustring.format( cfg.warning_infrastructure, cfg.templatestyles, warning ) end functionp._warning(args) localwarning=args[1]andargs[1]:match('^%s*(.-)%s*$')or'' ifwarning==''then returnwarning_text(cfg.missing_warning) end ifnotcfg.previewthenreturn''end ifyn(args['consolewarning'])thenmw.addWarning(args[1]orcfg.missing_warning)end returnwarning_text(warning) end --[[ warning This function returns a "preview warning", which is the first argument marked up with HTML and some supporting text, depending on whether the page is being previewed. ]] -- function p.warning(frame) -- mw.addWarning(frame.args[1] or cfg.missing_warning) -- return p._warning(frame.args) -- end --[[ warning, but for pass-through templates like {{preview warning}} ]] functionp.pwarning(frame) localargs=getArgs(frame) returnp._warning(args) end --[[ Does both mw.addWarning and preview warning ]] functionp.warn(text) iftext==nilortext==""thenreturn""end mw.addWarning(text) returnp._warning({text}) end --[[ Console warning ]] functionp.consoleWarning(frame) localargs=getArgs(frame) mw.addWarning(args[1]orcfg.missing_warning) return'' end returnp