Support/Kitsune/KB/WikiSyntax: Difference between revisions

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


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.
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 even be used with combinations of items:
{for not mac,win}You aren't using a Mac or Windows.{/for}

Revision as of 23:20, 4 October 2010

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 it isn't the one the user is running (or has manually selected).
  • The {for} lists at least one browser version, but it isn't 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 will instantly appear.

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 other than these". This is the role of the {for not} syntax.

Press the {for mac}Apple{/for}{for not mac}Control{/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 even be used with combinations of items:

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