Template:Samp/doc: Difference between revisions

→‎Usage: clean up
m (1 revision)
 
(→‎Usage: clean up)
 
Line 8: Line 8:
The template takes one mandatory parameter, the content to be marked up.  If this content contains "=" (an equals sign), the parameter {{em|must}} be explicitly named {{para|1}}, or the template will fail. (This is a limitation of the MediaWiki software, not the template.) It is always safer to use {{para|1}} syntax. It may be used as a container for {{tlx|var}}, {{tlx|varserif}} or {{tag|var}} when the example output contains or consists entirely of a variable. It may also be used with (but not inside) {{tlx|code}}, or with {{tag|code}} (it generally should not be used inside the latter, as output is not a part of source code, but something that results from it; however, this style can be used to illustrate computer display of mixed type, as illustrated below).
The template takes one mandatory parameter, the content to be marked up.  If this content contains "=" (an equals sign), the parameter {{em|must}} be explicitly named {{para|1}}, or the template will fail. (This is a limitation of the MediaWiki software, not the template.) It is always safer to use {{para|1}} syntax. It may be used as a container for {{tlx|var}}, {{tlx|varserif}} or {{tag|var}} when the example output contains or consists entirely of a variable. It may also be used with (but not inside) {{tlx|code}}, or with {{tag|code}} (it generally should not be used inside the latter, as output is not a part of source code, but something that results from it; however, this style can be used to illustrate computer display of mixed type, as illustrated below).


For cases where it is useful to display the color of the output, there is an optional parameter {{para|color}} that takes an [[Web colors|HTML color name or <code>#<var>nnnnnn</var></code> color code]] (in which case the <code>#</code> is mandatory). For [[WP:ACCESSIBILITY|accessibility]] reasons, color should never be the only distinguishing factor, as {{samp|foo|color=red}} and {{samp|foo|color=green}} may be indistinguisahble to color-blind readers.   
For cases where it is useful to display the color of the output, there is an optional parameter {{para|color}} that takes an [[Web colors|HTML color name or <code>#<var>nnnnnn</var></code> color code]] (in which case the <code>#</code> is mandatory). For [[SV:ACCESSIBILITY|accessibility]] reasons, color should never be the only distinguishing factor, as {{samp|foo|color=red}} and {{samp|foo|color=green}} may be indistinguisahble to color-blind readers.   


There may also be cases where some other aspect of the output may need to be reproduced; the {{para|style}} parameter accepts any complete CSS statement(s), terminating with a semicolon, e.g. {{para|style|font-variant:small-caps; font-style:italic;}}.
There may also be cases where some other aspect of the output may need to be reproduced; the {{para|style}} parameter accepts any complete CSS statement(s), terminating with a semicolon, e.g. {{para|style|font-variant:small-caps; font-style:italic;}}.
14,061

edits