Template:Viewsource
Jump to navigation
Jump to search
{{msgnw:{{{1}}}}}
This documentation is transcluded from Template:Viewsource/doc.
This template can be used to transclude the source of another template onto a page.
Usage
[edit]{{viewsource|template name|(optional parameters)}}
Optional parameters:
nowrap=1
- Disable wrapping. By default, the template includes CSS style rules to make long lines in the source code wrap. Set this parameter to a non-empty value to disable it.
class=class names
- Include additional custom CSS classes. See MediaWiki:Common.css for available classes.
style=CSS
- Directly include additional custom CSS style rules. For example, to make the border red, you could use "
style=border: 1px solid red;
".
- Directly include additional custom CSS style rules. For example, to make the border red, you could use "
Example:
To display the source code of Template:Information, use {{viewsource|Information}}
, which produces:
<noinclude>{{heavily used template|3=very}}</noinclude><!-- -->{{#invoke:Information|information | lang = {{#if:{{{lang|}}} | {{{lang}}} | {{int:Lang}} }} | demo = {{{demo|<noinclude>1</noinclude>}}} }}<noinclude> {{documentation}} </noinclude>
Hints:
To transclude the source of non-template pages, include the namespace in the page name, e.g. {{viewsource|Help:Contents}}
. To display the source of pages in the main (gallery) namespace, prefix the page name with a colon (":"), e.g. {{viewsource|:Main Page}}
.
See also
[edit]- Template:Collapsed (useful for collapsing long source listings)