Difference between revisions of "Template:Example"

From CCS Cataloging Manual
Jump to navigation Jump to search
(Template for presenting fixed-width-font examples)
 
(Added usage instructions)
 
Line 11: Line 11:
| margin-left: {{#expr: {{{indent}}}*2}}em;
| margin-left: {{#expr: {{{indent}}}*2}}em;
| }}
| }}
">{{{text}}}</pre>
">{{{text}}}</pre><noinclude>
==Usage==
Provides a simple method of displaying text in a colored box with a fixed-pitch font.  Also, unlike with &lt;pre&gt;...&lt;/pre&gt; tags or the wiki markup of starting a line with a space, any long lines of text will wrap to the screen's width.  This makes it useful for displaying examples of MARC fields or entire MARC records.
 
To indent a box in order to align it with text in a bullet list or the like, use the "indent=" parameter with a number of ems to indent the box. (1 em is usually roughly equivalent to the indenting distance a browser uses for each level of a list.)
 
==Examples==
<nowiki>{{example|text=504  Includes index.}}</nowiki> gives:
{{example|text=504  Includes index.}}
 
&#123;&#123;example|text=<br>
100 1  Smith, John.<br>
245 10 Baseball, hot dogs, and apple pie /&#123;&#123;subfield|c&#125;&#125;by John Smith.&#125;&#125;<br>
gives:
 
{{example|text=
100 1  Smith, John.
245 10 Baseball, hot dogs, and apple pie /{{subfield|c}}by John Smith.}}
 
<nowiki>{{example|indent=1|text=504  Includes index.}}</nowiki> gives:
{{example|indent=1|text=504  Includes index.}}
</noinclude>

Latest revision as of 20:26, 28 November 2008

{{{text}}}

Usage

Provides a simple method of displaying text in a colored box with a fixed-pitch font. Also, unlike with <pre>...</pre> tags or the wiki markup of starting a line with a space, any long lines of text will wrap to the screen's width. This makes it useful for displaying examples of MARC fields or entire MARC records.

To indent a box in order to align it with text in a bullet list or the like, use the "indent=" parameter with a number of ems to indent the box. (1 em is usually roughly equivalent to the indenting distance a browser uses for each level of a list.)

Examples

{{example|text=504 Includes index.}} gives:

504  Includes index.

{{example|text=
100 1 Smith, John.
245 10 Baseball, hot dogs, and apple pie /{{subfield|c}}by John Smith.}}
gives:

100 1  Smith, John.
245 10 Baseball, hot dogs, and apple pie /‡cby John Smith.

{{example|indent=1|text=504 Includes index.}} gives:

504  Includes index.