Template:Boilerplate

From PCSAR

(Difference between revisions)
Jump to: navigation, search
Current revision (15:55, 2 October 2017) (edit) (undo)
 
(2 intermediate revisions not shown.)
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 documentation purposes instead of angle
+
;;;;;;;;;;;; output. For purposes of documentation in this comments
-
;;;;;;;;;;;; brakets: < >, we will use parentheses, such as
+
;;;;;;;;;;;; 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.
-
;;;;;;;;;;;; Display the documentation from a separate page only when
+
;;;;;;;;;;;; The first line in this page (above), displays the
-
;;;;;;;;;;;; the template is viewed.
+
;;;;;;;;;;;; documentation from a separate page only when the template
 +
;;;;;;;;;;;; is viewed.
;;;;;;;;;;;;
;;;;;;;;;;;;
;;;;;;;;;;;; (noinclude){{documentation}}(/noinclude)
;;;;;;;;;;;; (noinclude){{documentation}}(/noinclude)
-
</noinclude>{{{|<}}}noinclude{{{|>}}}
+
;;;;;;;;;;;; The remainder of the file is processed only when
-
{{Based On Template|Boilerplate|Templates=y}}
+
;;;;;;;;;;;; transcluded (which should be by subst:)
-
This is a template for pages that are about {{subst:PAGENAME}}.
+
;;;;;;;;;;;;
-
Include it by saving a blank page with
+
;;;;;;;;;;;; (includeonly)...(/includeonly)
-
{{{|<}}}pre{{{|>}}}
+
-
{{subst:((}}Subst:{{subst:PAGENAME}}{{subst:))}}
+
-
{{{|<}}}/pre{{{|>}}}
+
-
If you do, what you'll then get is this:
+
;;;;;;;;;;;; Within the transclusion part, comments (like this one)
-
<hr/>
+
;;;;;;;;;;;; can be created which will be entirely ignored, by placing
-
<hr/>
+
;;;;;;;;;;;; them in noinclude blocks:
-
{{quote-page|{{subst:FULLPAGENAME}}/Boilerplate}}
+
;;;;;;;;;;;;
-
{{{|<}}}/noinclude{{{|>}}}<noinclude>
+
;;;;;;;;;;;; (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>
 +
 
 +
;;;;;;;;;;;; produce: <!-- {{XXXX/Doc/Related}} -->
 +
</noinclude>{{{|<}}}<noinclude>
 +
</noinclude>-- <noinclude>
 +
</noinclude>{{<noinclude>
 +
</noinclude>{{subst:PAGENAME}}<noinclude>
 +
</noinclude>/Doc/Related<noinclude>
 +
</noinclude>}}<noinclude>
 +
</noinclude> --<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)<!-- put your code here -->(/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>{{{|<}}}includeonly{{{|>}}}
+
</noinclude>{{{|<}}}/includeonly{{{|>}}}<noinclude>
-
{{subst:((}}subst:{{subst:PAGENAME}}/Boilerplate{{subst:))}}
+
-
{{{|<}}}/includeonly{{{|>}}}<noinclude>
+

Current revision

This is the documentation for the template Template:Boilerplate

Template:Boilerplate/Doc:

The template {{Boilerplate}} creates a new template suitable for use as a boilerplate.

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>.

Personal tools