Difference between revisions of "Template:Expand"

From Wazeopedia
m
m (Add check for subpage link if no editlink, section)
Line 1: Line 1:
<includeonly>{{#if:{{{expand|}}}|{{Collapsible section top|expand=yes}}|{{Collapsible section top}}}}
+
{{#if:|{{Collapsible section top|expand=yes}}|{{Collapsible section top}}}}
 +
{{#if:|{{#switch:|1 = {{Eq}}|2 = {{Eq}}{{Eq}}|3 = {{Eq}}{{Eq}}{{Eq}}|4 = {{Eq}}{{Eq}}{{Eq}}{{Eq}}|{{Eq}}{{Eq}}{{Eq}}{{Eq}}{{Eq}}}} {{@|{{#if:||{{SUBPAGENAME:}}}}}} {{#if:||{{#if:
 +
      |
 +
      |{{#if:
 +
        |{{#ifexist:{{#ifeq:{{padleft:|1| }}|/|
 +
                      {{FULLPAGENAME}}
 +
                      }}{{{1}}}
 +
            |[[File:Edit.png|15px|text-top|link={{fullurl:{{#ifeq:{{padleft:|1| }}|/|{{FULLPAGENAME}}}}{{{1}}}|action=edit}}|edit nugget]]}}<!-- end ifexist subpage {{{1}}} -->
 +
        }}<!-- end if {{{1}}} -->
 +
      }}<!-- end if {{{editlink}}} -->}}<!-- end if {{{nt}}} --> {{#switch:|1 = {{Eq}}|2 = {{Eq}}{{Eq}}|3 = {{Eq}}{{Eq}}{{Eq}}|4 = {{Eq}}{{Eq}}{{Eq}}{{Eq}}|{{Eq}}{{Eq}}{{Eq}}{{Eq}}{{Eq}}}}
 +
{{#if:|
 +
 
 +
{{{summary}}}{{clear}}}}|Click Expand for details on {{#if:|this topic|{{SUBPAGENAME:}}}}}}
 +
{{Collapsible section content}}
 +
{{#if:
 +
  |{{red|ERROR: No content was specified}}
 +
  |{{#if:
 +
      |{{#if:
 +
        |{{#ifexist:{{FULLPAGENAME}}
 +
          |<!-- newscript subpage exists, show link to Nugget only, then transclude --><small>{{Private|This content is transcluded from a [[Waze:Wazeopedia #Nuggets|nugget]] source [[File:Link.png|12px|text-top|link={{#ifeq:{{padleft:|1| }}|/|
 +
                                            {{FULLPAGENAME}}
 +
                                            }}{{{1}}}|link to nugget]]}}</small><br>
 +
{{  }}
 +
          |<!-- newscript subpage doesn't exist, show link to create preload content -->[{{fullurl:{{FULLPAGENAME}}}}/{{urlencode:{{{2}}}|PATH}}?action{{=}}edit&section{{=}}new&preload{{=}}{{DraftLink|Scripts}}/Preload {{Minor Highway|Click here to add your script content}}]
 +
          }}<!-- end ifexist subpage{{{1}}} -->
 +
      |<!-- no {{{newscript}}}, is section or had {{{editlink}}}
 +
-- transclude content (will show red link if didn't exist)
 +
--><br>
 +
{{ {{red|ERROR: No content was specified}}  }}
 +
        }}<!-- end if newscript -->
 +
      |<!-- not a section and no {{{editlink}}} -->{{#ifexist:{{FULLPAGENAME}}
 +
          |<!-- subpage exists, show only edit link --><small>{{Private|This content is transcluded from a [[Waze:Wazeopedia #Nuggets|nugget]] source [[File:Edit.png|15px|text-top|link={{fullurl:{{#ifeq:{{padleft:|1| }}|/|{{FULLPAGENAME}}}}{{{1}}}|action=edit}}|edit nugget]]}}</small>
 +
          }}<!-- if no subpage don't show any link, so end ifexist
 +
-- then transclude (will show Red if didn't exist) for any page thats not a section or {{{editlink}}}. No check for {{{newscript}}} because all newscript are also section --><br>
 +
{{ {{red|ERROR: No content was specified}}  }}
 +
      }}<!-- end if editlink,section -->
 +
  }}<!-- end if nt -->
 +
{{Collapsible section bottom}}<includeonly>{{#if:{{{expand|}}}|{{Collapsible section top|expand=yes}}|{{Collapsible section top}}}}
 
{{#if:{{{section|}}}|{{#switch:{{{section|}}}|1 = {{Eq}}|2 = {{Eq}}{{Eq}}|3 = {{Eq}}{{Eq}}{{Eq}}|4 = {{Eq}}{{Eq}}{{Eq}}{{Eq}}|{{Eq}}{{Eq}}{{Eq}}{{Eq}}{{Eq}}}} {{@|{{{2|{{#if:{{{nt|}}}||{{SUBPAGENAME:{{{1|}}}}}}}}}}}} {{#if:{{{nt|}}}||{{#if:{{{editlink|}}}
 
{{#if:{{{section|}}}|{{#switch:{{{section|}}}|1 = {{Eq}}|2 = {{Eq}}{{Eq}}|3 = {{Eq}}{{Eq}}{{Eq}}|4 = {{Eq}}{{Eq}}{{Eq}}{{Eq}}|{{Eq}}{{Eq}}{{Eq}}{{Eq}}{{Eq}}}} {{@|{{{2|{{#if:{{{nt|}}}||{{SUBPAGENAME:{{{1|}}}}}}}}}}}} {{#if:{{{nt|}}}||{{#if:{{{editlink|}}}
 
       |
 
       |
Line 29: Line 66:
 
{{ {{{1|{{red|ERROR: No content was specified}} }}} }}
 
{{ {{{1|{{red|ERROR: No content was specified}} }}} }}
 
         }}<!-- end if newscript -->
 
         }}<!-- end if newscript -->
       |<!-- not a section and no {{{editlink}}} -->{{#ifexist:{{FULLPAGENAME}}{{{1|}}}
+
       |<!-- not a section and no {{{editlink}}} -->{{#if:{{{1|}}}
 +
|{{#ifexist:{{FULLPAGENAME}}{{{1|}}}
 
           |<!-- subpage exists, show only edit link --><small>{{Private|This content is transcluded from a [[Waze:Wazeopedia #Nuggets|nugget]] source [[File:Edit.png|15px|text-top|link={{fullurl:{{#ifeq:{{padleft:|1|{{{1|}}} }}|/|{{FULLPAGENAME}}}}{{{1}}}|action=edit}}|edit nugget]]}}</small>
 
           |<!-- subpage exists, show only edit link --><small>{{Private|This content is transcluded from a [[Waze:Wazeopedia #Nuggets|nugget]] source [[File:Edit.png|15px|text-top|link={{fullurl:{{#ifeq:{{padleft:|1|{{{1|}}} }}|/|{{FULLPAGENAME}}}}{{{1}}}|action=edit}}|edit nugget]]}}</small>
           }}<!-- if no subpage don't show any link, so end ifexist  
+
           }}<!-- if no subpage don't show any link, so end ifexist-->}}<!-- end if {{{1}}}
 
-- then transclude (will show Red if didn't exist) for any page thats not a section or {{{editlink}}}. No check for {{{newscript}}} because all newscript are also section --><br>
 
-- then transclude (will show Red if didn't exist) for any page thats not a section or {{{editlink}}}. No check for {{{newscript}}} because all newscript are also section --><br>
 
{{ {{{1|{{red|ERROR: No content was specified}} }}} }}
 
{{ {{{1|{{red|ERROR: No content was specified}} }}} }}

Revision as of 01:48, 9 July 2015

Click Expand for details on

 This content is transcluded from a nugget source edit nugget 
{{ ERROR: No content was specified }}

Documentation icon Template documentation[view] [edit] [history] [purge]

{{Expand|content or link to transclude|description for header|nt=yes|section=#1-4|editlink=no|summary=A short text summary|expand=yes|style=CSS style codes}}

This template takes two unnamed parameters in order, and some additional named parameters to alter the output.

It creates a collapsible section on a page, with a heading and optional summary text text. The heading may be formatted as a section header (level 1-5) which will appear in the TOC.

At the top of the collapsed section, if the content is being transcluded from another source, a link to edit the source directly is displayed by default.


|either a nugget/subpage link, or raw content= *required if left blank will produce an error.

|description text to be used in header line= if left blank it will use the {{SUBPAGENAME}} of the first parameter.

|summary=short descriptive summary This optional parameter allows you to define a very short summary text to be displayed in the header of the collapsible section. This will override the description parameter. If this is not used the default header will be used: Click expand for details on ...<description, or {{SUBPAGENAME}}>

|nt=yes content is raw (do not enclose in curly braces for transclusion).

|section=# any number 1-4, if anything else is entered it defaults to 5. This replaces the header test with just the description from the 2nd parameter (or the {{SUBPAGENAME}} of the 1st parameter, and formats it as a section header. The number entered is the header level used.

|newscript=yes Designed to detect input from the {{NewScript}} template, and is not meant to be used manually. If the defined subpage exists already it produces a direct link to the nugget above the transclusion. For script authors convenience

|editlink=no If this parameter is defined the link to edit the nugget is not displayed.

|expand=yes If defined, the section will be expanded by default when the page is loaded.

|style= If defined, the style codes specified here will be used on the collapsible section (such as border, background, etc).


Sample

{{Expand|(LINK)}}

{{Expand|/(LINK)}}

{{Expand|/(LINK)|(HEADER)}}

{{Expand|(CONTENT)|(HEADER)|nt=yes}}

{{ Expand}}

{{Expand|/(LINK)|section=2}}

{{Expand|/(LINK)|(HEADER)|section=2}}

{{Expand|/(LINK)|(HEADER)|section=2|newscript=yes|summary=This is a subsection dedicated to HEADER}}

{{Expand|/(LINK)|(HEADER)|section=2|newscript=yes|edit=/(LINK)|summary=This is a subsection dedicated to HEADER|expand=yes}}

{{Expand|(LINK)|style=border: solid 1px;}}

PRODUCES

Click Expand for details on (LINK)


Click Expand for details on (LINK)


Click Expand for details on (HEADER)


Click Expand for details on (HEADER)

(CONTENT)


Click Expand for details on


{{ ERROR: No content was specified }}




(HEADER) link to this section

This is a subsection dedicated to HEADER

(HEADER) link to this section

This is a subsection dedicated to HEADER

Click Expand for details on (LINK)


See Also

This template relies on:

This template is used by:

The above documentation is transcluded from Template:Expand/doc.
Please add categories to the /doc subpage.
Subpages of this template.