Template:Boilerplate
From PCSAR
(Difference between revisions)
Line 10: | Line 10: | ||
;;;;;;;;;;;; this one. They would be interpreted and cause portions | ;;;;;;;;;;;; this one. They would be interpreted and cause portions | ||
;;;;;;;;;;;; of this comment block to be included in the template | ;;;;;;;;;;;; of this comment block to be included in the template | ||
- | ;;;;;;;;;;;; output. For | + | ;;;;;;;;;;;; output. For purposes of documentation in this comments |
- | ;;;;;;;;;;;; brakets: < >, we will use | + | ;;;;;;;;;;;; like this, instead of angle brakets: < >, we will use |
- | ;;;;;;;;;;;; (noinclude) (/noinclude), (includeonly) (/includeonly). | + | ;;;;;;;;;;;; parentheses, such as (noinclude) (/noinclude), |
+ | ;;;;;;;;;;;; (includeonly) (/includeonly). | ||
;;;;;;;;;;;; | ;;;;;;;;;;;; | ||
;;;;;;;;;;;; To cause this template to produce these tags in its | ;;;;;;;;;;;; To cause this template to produce these tags in its | ||
Line 24: | Line 25: | ||
;;;;;;;;;;;; instead. | ;;;;;;;;;;;; instead. | ||
- | ;;;;;;;;;;;; | + | ;;;;;;;;;;;; The first line in this page (above), displays the |
- | ;;;;;;;;;;;; | + | ;;;;;;;;;;;; documentation from a separate page only when the template |
+ | ;;;;;;;;;;;; is viewed. | ||
;;;;;;;;;;;; | ;;;;;;;;;;;; | ||
;;;;;;;;;;;; (noinclude){{documentation}}(/noinclude) | ;;;;;;;;;;;; (noinclude){{documentation}}(/noinclude) | ||
- | + | ;;;;;;;;;;;; The remainder of the file is processed only when | |
- | + | ;;;;;;;;;;;; transcluded (which should be by subst:) | |
- | + | ;;;;;;;;;;;; | |
- | + | ;;;;;;;;;;;; (includeonly)...(/includeonly) | |
- | + | ||
- | + | ||
- | + | ||
- | If you do, what you'll then get is this: | + | ;;;;;;;;;;;; Within the transclusion part, comments (like this one) |
- | {{quote-page|{{subst:FULLPAGENAME}}/Boilerplate}} | + | ;;;;;;;;;;;; can be created which will be entirely ignored, by placing |
- | {{{|<}}}/noinclude{{{|>}}}<noinclude> | + | ;;;;;;;;;;;; them in noinclude blocks: |
+ | ;;;;;;;;;;;; | ||
+ | ;;;;;;;;;;;; (noinclude) any comment (/noinclude) | ||
+ | |||
+ | ;;;;;;;;;;;; The newly created template starts with a | ||
+ | ;;;;;;;;;;;; (noinclude)...(/noinclude) section which is what happens | ||
+ | ;;;;;;;;;;;; when the template page is veiwed. | ||
+ | |||
+ | </noinclude>{{{|<}}}noinclude{{{|>}}}<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>{{Based On Template|Boilerplate|Templates=y}}<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>This is a template for pages that are about {{subst:PAGENAME}}.<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>Include it by saving a blank page with<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>{{{|<}}}pre{{{|>}}}<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>{{subst:((}}Subst:{{subst:pagename as template|subst=subst:}}{{subst:))}}<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>{{{|<}}}/pre{{{|>}}}<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>If you do, what you'll then get is this:<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>{{quote-page|{{subst:FULLPAGENAME}}/Boilerplate}}<noinclude> | ||
+ | </noinclude>{{subst:end of line character}}<noinclude> | ||
+ | |||
+ | </noinclude>{{{|<}}}/noinclude{{{|>}}}<noinclude> | ||
;;;;;;;;;;;; Only when the template is transcluded, use the | ;;;;;;;;;;;; Only when the template is transcluded, use the | ||
- | ;;;;;;;;;;;; substitution code. | + | ;;;;;;;;;;;; following substitution code. |
;;;;;;;;;;;; | ;;;;;;;;;;;; | ||
- | ;;;;;;;;;;;; (includeonly)< | + | ;;;;;;;;;;;; (includeonly)...(/includeonly) |
+ | |||
+ | </noinclude>{{{|<}}}includeonly{{{|>}}}<noinclude> | ||
+ | |||
+ | ;;;;;;;;;;;; Call using {{subst:...}} the specified page. Since | ||
+ | ;;;;;;;;;;;; we're already being subst'd, this will cause the | ||
+ | ;;;;;;;;;;;; specified page to be subst'd in immediately. | ||
+ | |||
+ | </noinclude>{{subst:((}}subst:<noinclude> | ||
+ | |||
+ | ;;;;;;;;;;;; The page that has the boilerplate text. This is a | ||
+ | ;;;;;;;;;;;; separate page with no (noinclude) or (includeonly) | ||
+ | ;;;;;;;;;;;; directives, so that it can be used with preload. See | ||
+ | ;;;;;;;;;;;; Template:Link/Create for example. | ||
+ | |||
+ | </noinclude>{{subst:pagename as template|subst=subst:}}/Boilerplate<noinclude> | ||
+ | |||
+ | </noinclude>{{subst:))}}<noinclude> | ||
- | </noinclude> | + | </noinclude>{{{|<}}}/includeonly{{{|>}}}<noinclude> |
- | + | ||
- | {{{|<}}}/includeonly{{{|>}}}<noinclude> | + |
Revision as of 18:50, 31 December 2012
This is the documentation for the template Template:Boilerplate
The template On a new or blank template page, type: {{subst:boilerplate}} This will create a template of the form: <noinclude> {{Based On Template|Boilerplate|Templates=y}} This is a template for pages that are about XXXX. Include it by saving a blank page with <pre> {{Subst:XXXX}} </pre> If you do, what you'll then get is this: {{quote-page|Sandbox/Boilerplate}} </noinclude><includeonly>{{subst:XXXX/Boilerplate}}</includeonly> Where XXXX is the template name. Move Template:XXXX to Template:XXXX/Page |
To see how this template is implemented,
edit this page and examine the portion
between <includeonly>
and </includeonly>
.