Support/Kitsune/KB/WikiSyntax

From MozillaWiki
< Support‎ | Kitsune‎ | KB
Jump to: navigation, search

How to use wiki syntax in the SUMO 2.3 Knowledgebase

{for}, the new SHOWFOR

Both {SHOWFOR} and {DIV(class=win,type=span)} have been replaced by the {for} directive.

Basic syntax and behavior

{SHOWFOR(os=mac,browser=firefox3.5)}Hello{SHOWFOR} is now spelled thus:

{for mac,fx35}Hello{/for}

A more complex condition with an "or", {SHOWFOR(os=mac+win,browser=firefox3.5+firefox4)} (not actually possible in the old system), is spelled...

{for mac, win, fx35, fx4}You are running a Mac or Windows and using Firefox 3.5 or 4.{/for}

Formally, the markup between {for} and {/for} will be hidden if either of these conditions is met:

  • The {for} lists at least one OS but doesn't include the one the user is running (or has manually selected).
  • The {for} lists at least one browser version but doesn't include the one the user is running (or has manually selected).

Otherwise, the contents of the {for}...{/for} is shown.

A few other things to note:

  • Spaces after the commas are optional.
  • No {SHOWFOR(spans=on)/} or equivalent is necessary anymore; the {for} syntax is always enabled.
  • Headings which are hidden by {for} blocks do not appear in the page's table of contents. If the user causes them to show by manually selecting the right OS/browser combination, TOC entries instantly appear.

Available abbreviations

Here are the browser and OS signifiers for use with {for} directives.

OS

  • win
  • mac
  • linux
  • maemo
  • android

Browser

  • fx4 (Firefox 4.0 up to but not including 5 (may be refined later))
  • fx35 (Firefox 3.5 up to but not including 4)
  • fx3 (3.0 up to but not including 3.5)
  • m4 (Any version of Firefox Mobile up to but not including 5 (may be refined later))

Inline and block-level contexts

{for} can be used in both inline and block-level contexts (in the HTML sense). The inline form takes effect when working within a line of text:

This is {for fx35, fx4}inline use{/for}.

The block form is used to wrap entire paragraphs, ordered lists, headings, and so on:

{for fx35, fx4}
This is block-level.

* One
* Two
{/for}

The only caveat is that, when using the block form, the {for} and {/for} should each be on a line by itself. Otherwise, it might be considered part of a neighboring paragraph and produce surprising results.

"not" operator

Since the Knowledgebase will see the addition of new OSes and browser versions from time to time, we introduce a future-proof way of saying, for example, "any OS but these". This is the role of the {for not} syntax.

Press the {for not mac}Control{/for}{for mac}Apple{/for} key.

The addition of the word "not" causes the {for} contents to show when they would otherwise have hidden and vice versa. The above message would thus read "Control" on any system not running Mac OS.

"not" can also be used with combinations of items:

{for not mac,win}You aren't using a Mac or Windows.{/for}

References