Help:Automatic conversion of wikitext

From SacredWiki
Jump to navigation Jump to search
MediaWiki Handbook: Contents, Readers, Editors, Moderators, System admins +/-

Depending on the wikitext in the edit box, when clicking on "Save page" the wikitext may be automatically modified before saving. The result of this automatic conversion of wikitext (pre-save transform) is shown when pressing "Show changes". The rendering is shown with "Show preview". The conversion does not display in the edit box (save and press Edit again to see the result in the wikitext there).

Cases in which this occurs:

  • Substitution
  • Tildes:
    • ~~~ gives a signature without time or date
    • ~~~~~ gives the time and date, e.g. 08:56, 2 July 2010 (UTC)
    • ~~~~ gives a full signature, i.e. it combines ~~~ and ~~~~~
  • Pipe trick

If such code is put in a template with the intention of being applied when the template is substituted, care should be taken to prevent premature conversion of wikitext (i.e., when the template is saved). One way is to provide part of the code as default value of an unused parameter. Since the empty string is a possible but for other purposes uncommon parameter name, it is usually a suitable choice for the name of this unused parameter, for example:

  • {{{{{|safesubst:}}}CURRENTTIME}}
  • {{{|~~}}}~~
  • [[abc (def)|{{{|}}}]]

The third example is hardly useful, and just given to illustrate the analogy with the other two cases.

Another method is with <includeonly> tags.

Also, a template parameter can be used to control whether the conversion is applied when the template is substituted. For example, {{{{{subst1|}}}CURRENTTIME}} converts if the value of parameter subst1 is equal to subst: or safesubst:, and not if it is empty or undefined.

See also

Links to other help pages

Help contents
Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · mw: · b: · s: · mw:Manual · Google
Versions of this help page (for other languages see further)
Meta · Wikinews · Wikipediahttp://en.wikipedia.org/index.php/Help:Automatic_conversion_of_wikitext · Wikiquote · Wiktionary
What links here on Meta or from Meta · Wikipedia · MediaWiki
Reading
Go · Search · Stop words · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
Tracking changes
Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
Logging in and preferences
Logging in · Preferences · User style
Editing
Starting a new page · Advanced editing · Editing FAQ · Edit toolbar · Export · Import · Shortcuts · Edit conflict · Page size
Referencing
Links · URLs · Piped links · Interwiki linking · Footnotes
Style and formatting
Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · List · Table · Sorting · Colors · Images and file uploads
Fixing mistakes
Show preview · Testing · Reverting edits
Advanced functioning
Expansion · Template · Advanced templates · Parser function · Parameter default · Variable · System message · Substitution · Array · Calculation · Embed page
Others
Special characters · Renaming (moving) a page · Talk page · Signatures · Sandbox · Legal issues for editors