Сравнить ревизии

How to use "For" tags

Ревизия 6456:

Ревизия 6456 сделанная Verdi

Ревизия 6458:

Ревизия 6458 сделанная Verdi

Ключевые слова:

Сводка результатов поиска:

How to use for
How to use for

Содержимое:

One of the great features of our Knowledge Base is the ability to show instructions customized for operating systems and Firefox versions. We can say, for example, that a certain section of a help article is "for" Windows users and Mac and Linux users won't see it. This article goes over the details of how to use <nowiki>{</nowiki>for<nowiki>}</nowiki> in Knowledge Base articles. __TOC__ == Basic syntax and behavior == Here is the syntax to show something for one condition: '''<code><nowiki>{</nowiki>for mac<nowiki>}</nowiki>Hellooo!<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>'''<br>Change the "Help with:" selector to Mac to see a message => {for mac}'''Hellooo!'''{/for} You can specify two conditions like this: '''<code><nowiki>{</nowiki>for mac,fx4<nowiki>}</nowiki>Hellooo!<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>'''<br>Change the "Help with:" selector to Mac and Firefox 4 to see a message => {for mac,fx4}'''Hellooo!'''{/for} A more complex condition with an implied "or" is can be written like this:<br> '''<code><nowiki>{</nowiki>for mac, win, fx35, fx4<nowiki>}</nowiki>You are running Mac or Windows and using Firefox 3.5-3.6 or 4.<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>'''<br>Change the "Help with:" selector to Mac or Windows and Firefox 3.5-3.6 or Firefox4 to see a message =>{for mac,win,fx35,fx4}'''You are running Mac or Windows and using Firefox 3.5-3.6 or 4.'''{/for} Formally, the markup between <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> will be ''shown'' if either of these conditions is met: * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one OS and includes the one the user is running (or has manually selected). * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one Firefox version and includes the one the user is running (or has manually selected). Otherwise, the contents of the <nowiki>{</nowiki>for<nowiki>}</nowiki>...<nowiki>{</nowiki>/for<nowiki>}</nowiki> is not shown. A few other things to note: * Spaces after the commas are optional. * The <nowiki>{</nowiki>for<nowiki>}</nowiki> syntax is always enabled. * Headings which are hidden by <nowiki>{</nowiki>for<nowiki>}</nowiki> 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, the table of contents entries instantly appear. == Operating system and browser abbreviations == These are the operating system and browser abbreviations available for use with <nowiki>{</nowiki>for<nowiki>}</nowiki>: * win (Windows) * mac (Mac OS X) * linux (Linux) * maemo (Maemo mobile OS) * android (Android mobile OS) * 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 == <nowiki>{</nowiki>for<nowiki>}</nowiki> 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 <nowiki>{</nowiki>for fx35, fx4<nowiki>}</nowiki>inline use<nowiki>{</nowiki>/for<nowiki>}</nowiki>.''' The block form is used to wrap entire paragraphs, ordered lists, headings, and so on. The only caveat is that, when using the block form, the <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> should each be on a line by itself. Otherwise, it might be considered part of a neighboring paragraph and produce surprising results. '''<nowiki>{</nowiki>for fx35, fx4<nowiki>}</nowiki><br>''' '''This is block-level.<br>''' '''<nowiki>*</nowiki>One<br>''' '''<nowiki>*</nowiki>Two<br>''' '''<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' ==Using the handy dandy <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the article editor== When you're editing a Knowledge Base article you can use the <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the toolbar to write the markup for you. #Highlight the text you want to put <nowiki>{</nowiki>for<nowiki>}</nowiki> tags around. #Click {button Show for...} in the editing toolbar. #Check the boxes next to the Firefox versions and operating systems that you want to see this piece of content and then click {button Add Rule}. The customized <nowiki>{</nowiki>for<nowiki>}</nowiki> tags will be placed around the section you highlighted. == How to use the "not" operator == Since the Knowledge Base will see the addition of new OSes and browser versions from time to time, we have a future-proof way of saying, for example, "any OS but these". This is the role of the <nowiki>{</nowiki>for not<nowiki>}</nowiki> syntax. In a mobile article we might say '''<nowiki>{</nowiki>for not maemo<nowiki>}</nowiki>you can use the pinch to zoom gesture...<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' and if we ever, for example, added iOS to our supported operating systems the syntax would work without needing to be updated with a new OS version. The addition of the word "not" causes the <nowiki>{</nowiki>for<nowiki>}</nowiki> contents to show when they would otherwise have hidden and vice versa.
One of the great features of our Knowledge Base is the ability to show instructions customized for operating systems and Firefox versions. We can say, for example, that a certain section of a help article is "for" Windows users and Mac and Linux users won't see it. This article goes over the details of how to use <nowiki>{</nowiki>for<nowiki>}</nowiki> in Knowledge Base articles. __TOC__ == Basic syntax and behavior == Here is the syntax to show something for one condition: '''<code><nowiki>{</nowiki>for mac<nowiki>}</nowiki>Hellooo!<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>'''<br>Change the "Help with:" selector to Mac to see a message => {for mac}'''Hellooo!'''{/for} You can specify two conditions like this: '''<code><nowiki>{</nowiki>for mac,fx4<nowiki>}</nowiki>Hellooo!<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>'''<br>Change the "Help with:" selector to Mac and Firefox 4 to see a message => {for mac,fx4}'''Hellooo!'''{/for} A more complex condition with an implied "or" can be written like this:<br> '''<code><nowiki>{</nowiki>for mac, win, fx35, fx4<nowiki>}</nowiki>You are running Mac or Windows and using Firefox 3.5-3.6 or 4.<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>'''<br>Change the "Help with:" selector to Mac or Windows and Firefox 3.5-3.6 or Firefox4 to see a message =>{for mac,win,fx35,fx4}'''You are running Mac or Windows and using Firefox 3.5-3.6 or 4.'''{/for} Formally, the markup between <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> will be ''shown'' if either of these conditions is met: * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one OS and includes the one the user is running (or has manually selected). * The <nowiki>{</nowiki>for<nowiki>}</nowiki> lists at least one Firefox version and includes the one the user is running (or has manually selected). Otherwise, the contents of the <nowiki>{</nowiki>for<nowiki>}</nowiki>...<nowiki>{</nowiki>/for<nowiki>}</nowiki> is not shown. A few other things to note: * Spaces after the commas are optional. * The <nowiki>{</nowiki>for<nowiki>}</nowiki> syntax is always enabled. * Headings which are hidden by <nowiki>{</nowiki>for<nowiki>}</nowiki> 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, the table of contents entries instantly appear. == Operating system and browser abbreviations == These are the operating system and browser abbreviations available for use with <nowiki>{</nowiki>for<nowiki>}</nowiki>: * win (Windows) * mac (Mac OS X) * linux (Linux) * maemo (Maemo mobile OS) * android (Android mobile OS) * 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 == <nowiki>{</nowiki>for<nowiki>}</nowiki> 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 <nowiki>{</nowiki>for fx35, fx4<nowiki>}</nowiki>inline use<nowiki>{</nowiki>/for<nowiki>}</nowiki>.''' The block form is used to wrap entire paragraphs, ordered lists, headings, and so on. The only caveat is that, when using the block form, the <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> should each be on a line by itself. Otherwise, it might be considered part of a neighboring paragraph and produce surprising results. '''<nowiki>{</nowiki>for fx35, fx4<nowiki>}</nowiki><br>''' '''This is block-level.<br>''' '''<nowiki>*</nowiki>One<br>''' '''<nowiki>*</nowiki>Two<br>''' '''<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' ==Using the handy dandy <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the article editor== When you're editing a Knowledge Base article you can use the <nowiki>{</nowiki>for<nowiki>}</nowiki> button in the toolbar to write the markup for you. #Highlight the text you want to put <nowiki>{</nowiki>for<nowiki>}</nowiki> tags around. #Click {button Show for...} in the editing toolbar. #Check the boxes next to the Firefox versions and operating systems that you want to see this piece of content and then click {button Add Rule}. The customized <nowiki>{</nowiki>for<nowiki>}</nowiki> tags will be placed around the section you highlighted. == How to use the "not" operator == Since the Knowledge Base will see the addition of new OSes and browser versions from time to time, we have a future-proof way of saying, for example, "any OS but these". This is the role of the <nowiki>{</nowiki>for not<nowiki>}</nowiki> syntax. In a mobile article we might say '''<nowiki>{</nowiki>for not maemo<nowiki>}</nowiki>you can use the pinch to zoom gesture...<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' and if we ever, for example, added iOS to our supported operating systems the syntax would work without needing to be updated with a new OS version. The addition of the word "not" causes the <nowiki>{</nowiki>for<nowiki>}</nowiki> contents to show when they would otherwise have hidden and vice versa.

Вернуться к истории