Nested templates and partial forms

From semantic-mediawiki.org
Semantic extension(s): Page Forms
Further extension(s):  -/-
Keyword(s):  -/-

Description:

Nested templates are widely used. For example:

 {{Infobox album
 | Name     = Yellow Submarine
 | Type     = studio
 | …
 | Misc     = {{Extra chronology
   | Artist     = [[The Beatles]]
   | Type       = studio
   | Last album = ''[[The Beatles (album)|The Beatles]]''<br>(1968)
   | This album = '''''Yellow Submarine'''''<br>(1969)
   | Next album = ''[[Abbey Road]]''<br>(1969)
   }}
 }}

(Example taken from Yellow Submarine article of Wikipedia.)

Note usage of Extra chronology template.

Unfortunately, Semantic Forms does not support nested templates now, so filling such a template with form is not possible. This limitation can be worked around by flattening the template (making the template flat).

Infobox album form allows editing "main" fields — Name and Type:

 {{{for template|Infobox album}}}
 {{{field|Name|…}}}
 {{{field|Type|…}}}
 {{{end template}}}

Additional Infobox album extra chronology partial form allows editing "additional fields" — Extra chronology Artist, Extra chronology Type, etc:

 {{{info|partial form}}}
 {{{for template|Infobox album}}} <!-- Note the name of the "main" template. -->
 {{{field|Extra chronology Artist|…}}}
 {{{field|Extra chronology Type|…}}}
 …
 {{{end template}}}

Infobox album template uses all the fields, passing Extra chronology … fields to Extra chronology template:

 {| class="Infobox album"
 |-
 | Name || {{{Name|}}}
 |-
 | Type || {{{Type|}}}
 |-
 | {{Extra chronology
   | Artist = {{{Extra chronology Artist|}}}
   | Type   = {{{Extra chronology Type|}}}
   | …
   }}
 |}

Extra chronology template utilizes its arguments and provides a link for editing them:

 <p><span class="editsection">[{{#formlink: 
   form      = Infobox album extra chronology
 | link text = edit 
 | target    = {{FULLPAGENAME}} 
 }}]</span></p>
 {|
 |-
 | Artist || {{{Artist|}}}
 |-
 | Type   || {{{Type|}}}
 | …
 |}