Difference between revisions of "Template:Book"

From DevSummit
Jump to navigation Jump to search
(Hardcoding the result of {{Book}})
(Some fixes that work on a newer version of MediaWiki. This may work on this version of MediaWiki too...)
Line 1: Line 1:
<noinclude>
+
<noinclude>'''Template:Book''' is a [[MediaWiki]] template.  To edit the exmaples below, visit [[Template:Book/en]].  {{Template:Book/en}}</noinclude><includeonly><i>{{{title|some silly book}}}</i> ({{{year|timeless}}}) by {{{author|someone}}} ({{{url|FIXME}}})</includeonly>
 
 
'''[[Template:Book]]''' is a [[MediaWiki]] template
 
 
 
== Examples ==
 
 
 
=== Example One ===
 
This is an example for using "Template:Book"
 
<code>* <nowiki>{{Book
 
|title=MediaWiki
 
|author=Daniel J. Barrett
 
|year=2009
 
|url=https://openlibrary.org/works/OL17309374W/MediaWiki
 
}}</nowiki></code>
 
Result
 
* {{Book
 
|title=MediaWiki
 
|author=Daniel J. Barrett
 
|year=2009
 
|url=https://openlibrary.org/works/OL17309374W/MediaWiki
 
}}
 
 
 
 
 
=== Example Two ===
 
It's even possible to use this template on a single line of wikitext:
 
  <code>* <nowiki>{{Book|title=MediaWiki|author=Daniel J. Barrett}}</nowiki></code>
 
 
 
Result:
 
 
 
* {{Book|title=MediaWiki|author=Daniel J. Barrett}}
 
 
 
Leaving parameters out (as above) will just cause the resulting text to look a little weird.  But it's a wiki; things often look weird.
 
 
 
</noinclude><includeonly><i>{{{title|some silly book}}}</i> ({{{year|timeless}}}) by {{{author|someone}}} ({{{url|FIXME}}})
 
 
 
=== Example Three ===
 
 
 
This template is "forgiving".  It's possible to leave all of the parameters off:
 
 
 
<code>* <nowiki>{{Book}}</nowiki></code>
 
 
 
Result:
 
 
 
* {{subst:Book}}
 
 
 
When the "<code>title</code>" parameter is omitted, some filler text (e.g. "some silly book") is inserted.  When the "<code>author</code>" parameter is omitted, different filler text is inserted.
 
 
 
</noinclude><includeonly><i>{{{title|some silly book}}}</i> ({{{year|timeless}}}) by {{{author|someone}}} ({{{url|FIXME}}})
 
 
 
 
 
</includeonly>
 

Revision as of 06:17, 20 November 2020

Template:Book is a MediaWiki template. To edit the exmaples below, visit Template:Book/en.

Examples

Example One

This is an example for using "Template:Book"

* {{Book
|title=MediaWiki
|author=Daniel J. Barrett
|year=2009
|url=https://openlibrary.org/works/OL17309374W/MediaWiki
|comment=available to borrow from OpenLibrary.org
}}

Result One

Example Two

It's even possible to use this template on a single line of wikitext:

* {{Book|title=MediaWiki|author=Daniel J. Barrett}}

Result Two

  • MediaWiki (timeless) by Daniel J. Barrett (FIXME)

Leaving parameters out (as above) will just cause the resulting text to look a little weird. But it's a wiki; things often look weird.

Example Three

This template is "forgiving". It's possible to leave all of the parameters off:

* {{Book}}

Result:

  • some silly book (timeless) by someone (FIXME)

When the "title" parameter is omitted, some filler text (e.g. "some silly book") is inserted. When the "author" parameter is omitted, different filler text is inserted.