Difference between revisions of "Template:Book"

From PKC
Jump to navigation Jump to search
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
This is the "Book" template.
Please type the following instruction to fill in the reference of a book:


<nowiki>
<nowiki>{{Author=Author(s) separated by ,|Name= Book Name|Publisher=Name of publisher|Year=Year of publication|Edition=Edition|Page=Number of Pages}}</nowiki>
<syntaxhighlight>
 
{{#cargo_declare:_table=Books
When certain parameters are absent, they will be automatically omitted. The syntax for doing so can be shown as follows:
|Authors=List (,) of Page
<nowiki>{{#if:{{{Edition</nowiki><font color=red>|</font><nowiki>}}}|{{{Edition}}} Edition,|}}{{{Publisher}}}</nowiki>
|Genres=List (,) of String
Please note the <nowiki>"pipe"</nowiki> symbol (<font color=red>|</font>) after the parameter name: '''Edition'''<font color=red>|</font>, it is needed to enabled the <code><nowiki>#if</nowiki></code> statement to work.
|Year_of_publication=Date
|Number_of_pages=Integer}}
</syntaxhighlight>
</nowiki>
</noinclude>
</noinclude>


<includeonly>
<includeonly>
{{#cargo_store:_table=Books}}
{{{Author}}},
{|
{{{Name}}},
! Author(s)
{{#if:{{{Edition|}}}|{{{Edition}}} Edition,|}}{{{Publisher}}},
| {{#arraymap:{{{Authors|}}}|,|x|{{#formredlink:form=Author|target=x}} }}
{{{Year}}},
|-
{{#if:{{{Page|}}}|Number of Pages:{{{Page}}}| }}
! Genre(s)
| {{{Genres|}}}
|-
! Year of publication
| {{{Year of publication|}}}
|-
! Number of pages
| {{{Number of pages|}}}
|}
</includeonly>
</includeonly>

Latest revision as of 17:41, 27 June 2021

Please type the following instruction to fill in the reference of a book:

{{Author=Author(s) separated by ,|Name= Book Name|Publisher=Name of publisher|Year=Year of publication|Edition=Edition|Page=Number of Pages}}

When certain parameters are absent, they will be automatically omitted. The syntax for doing so can be shown as follows:

{{#if:{{{Edition|}}}|{{{Edition}}} Edition,|}}{{{Publisher}}}

Please note the "pipe" symbol (|) after the parameter name: Edition|, it is needed to enabled the #if statement to work.