Difference between revisions of "Template:Ifpreview/doc"

From blackwiki
Jump to navigation Jump to search
imported>Daask
(Use Template:demo for usage examples)
imported>Daask
(Add blank to first demo)
Line 4: Line 4:
 
This template returns the <code>then</code> parameter if it is included in an ''editing preview'', else it returns the <code>else</code> parameter if it is included in a ''saved page''. This can be useful for giving instructions to editors before they save the page, without those instructions cluttering the saved page if work is done incorrectly.
 
This template returns the <code>then</code> parameter if it is included in an ''editing preview'', else it returns the <code>else</code> parameter if it is included in a ''saved page''. This can be useful for giving instructions to editors before they save the page, without those instructions cluttering the saved page if work is done incorrectly.
 
== Usage ==
 
== Usage ==
−
* {{demo|<nowiki>{{ifpreview|{{error|This error message will only be shown in previews}}}}</nowiki>}}
+
* {{demo|<nowiki>{{ifpreview|{{error|This error message will only be shown in previews}} | }}</nowiki>}}
 
* {{demo|<nowiki>{{ifpreview|Show this in previews|Show this on published pages, but not in previews}}</nowiki>}}
 
* {{demo|<nowiki>{{ifpreview|Show this in previews|Show this on published pages, but not in previews}}</nowiki>}}
 
* {{demo|<nowiki>{{ifpreview|then=Show this in previews|else=Show this on published pages, but not in previews}}</nowiki>}}
 
* {{demo|<nowiki>{{ifpreview|then=Show this in previews|else=Show this on published pages, but not in previews}}</nowiki>}}

Revision as of 06:49, 28 March 2018

Description

This template returns the then parameter if it is included in an editing preview, else it returns the else parameter if it is included in a saved page. This can be useful for giving instructions to editors before they save the page, without those instructions cluttering the saved page if work is done incorrectly.

Usage

  • {{ifpreview|{{error|This error message will only be shown in previews}} | }}

  • {{ifpreview|Show this in previews|Show this on published pages, but not in previews}}

    Show this on published pages, but not in previews
  • {{ifpreview|then=Show this in previews|else=Show this on published pages, but not in previews}}

  • {{ifpreview}}