Difference between revisions of "Template:Documentation/core"

From Halachipedia
Jump to: navigation, search
(Starting out the /core for the {{documentation}} template. Intermediate save.)
 
(Using {{{doc exist|}}}. And check when to show the small box below for the doc meta-data.)
Line 10: Line 10:
 
   | <!--Add the [edit][purge] or [create] links-->
 
   | <!--Add the [edit][purge] or [create] links-->
 
     <span class="editsection plainlinks" id="doc_editlinks">{{
 
     <span class="editsection plainlinks" id="doc_editlinks">{{
     #ifexist: {{{docpage|{{FULLPAGENAME}}/doc}}}
+
     #if: {{{doc exist|yes}}}
     | <!--/doc exists-->
+
     | [[{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=edit}} edit]] [{{purge|purge}}]  
      [[{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=edit}} edit]] [{{purge|purge}}]  
 
 
     | <!--/doc doesn't exist-->
 
     | <!--/doc doesn't exist-->
 
       [[{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}| action=edit&preload=Template:Documentation/preload}} create]]
 
       [[{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}| action=edit&preload=Template:Documentation/preload}} create]]
Line 37: Line 36:
 
-->{{#if: {{{content|}}}
 
-->{{#if: {{{content|}}}
 
| {{{content|}}}
 
| {{{content|}}}
| {{#ifexist: {{{docpage|{{FULLPAGENAME}}/doc}}}
+
| {{#if: {{{doc exist|yes}}}
 
   | {{ {{{docpage|{{FULLPAGENAME}}/doc}}} }}
 
   | {{ {{{docpage|{{FULLPAGENAME}}/doc}}} }}
 
   }}
 
   }}
Line 43: Line 42:
 
<div style="clear: both;"></div>
 
<div style="clear: both;"></div>
 
</div><!--End of green doc box--><!--
 
</div><!--End of green doc box--><!--
   Green box below for the /doc meta-data.
+
   Small box below for the doc meta-data.
-->{{fmbox
+
-->{{#if:
| image = none
+
  <!--Check if we need the small box-->
| style = background-color: #ecfcf4;
+
  {{#if: {{{content|}}}
| text =  
+
  | <!--Don't link the /doc page-->
  ''{{#ifexist: {{{docpage|{{FULLPAGENAME}}/doc}}}
+
  | {{{doc exist|yes}}}
  | <!--/doc exists-->
+
  }}{{#switch: {{SUBJECTSPACE}}
    The above [[Wikipedia:Template documentation|documentation]] is [[Wikipedia:Transclusion|transcluded]] from [[{{{docpage|{{FULLPAGENAME}}/doc}}}]]. <small style="font-style: normal">([{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=edit}} edit] &#124; [{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=history}} history])</small> <br>
+
  | {{ns:Template}}
  }}<!--  
+
  | {{ns:User}} = add sandbox links
    Add links to /sandbox and /testcases when appropriate  
+
  }}
-->{{documentation/links/sandbox}}''
+
 
}}
+
| {{fmbox
 +
  | image = none
 +
  | style = background-color: #ecfcf4;
 +
  | text =  
 +
    ''{{#if: {{{doc exist|yes}}}
 +
    | <!--/doc exists-->
 +
      The above [[Wikipedia:Template documentation|documentation]] is [[Wikipedia:Transclusion|transcluded]] from [[{{{docpage|{{FULLPAGENAME}}/doc}}}]]. <small style="font-style: normal">([{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=edit}} edit] &#124; [{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=history}} history])</small> <br>
 +
    }}<!--  
 +
      Add links to /sandbox and /testcases when appropriate  
 +
  -->{{documentation/links/sandbox}}''
 +
  }}
 +
}}<noinclude>
 +
 
 +
</noinclude>

Revision as of 14:38, 5 February 2010

[edit] [purge] 50px Template documentation
This is the {{documentation/core}} sub-template.

Do not use this template directly, use {{documentation}} instead.

Template:Tlf calls {{documentation/core2}} which in turn calls this template. This template holds most of the code for Template:Tlf, while Template:Tlf and Template:Tlf do parameter preprocessing. Thus simplifying the code.

Technical details

This sub-template currently expects these parameters:

{{documentation/core
| heading = {{{heading|¬}}}   <!--Note that the "¬" is necessary 
     so we can detect the difference between empty and undefined-->
| heading-style = {{{heading-style|}}}
| content = {{{content|}}}    <!--Text instead of a /doc page-->
| link box = {{{link box|}}}  <!--So "link box=off" works-->

| docpage =     <!--Full pagename of the doc page-->
| doc exist =   <!--"yes" if the doc page exists, empty string if not-->
| docname fed = <!--"yes" if a docname was manually fed-->

| sandbox =     <!--Full pagename of the /sandbox-->
| testcases =   <!--Full pagename of the /testcases-->

| template page =   <!--Full pagename where the {{documentation}}
    template is placed, but without ending /sandbox or /testcases.
    Note: Unfortunately might not be the "correct" namespace if 
    the template is in subject space and the {{documentation}} 
    template is in talk space or the other way around.-->
}}

For more documentation see {{documentation}}. pt:Predefinição:Documentation/core