Difference between revisions of "Template:Book"

From DevSummit
Jump to navigation Jump to search
(First attempt at a "Book" template. I need to play with this some more to get it working)
 
(Fixed up the "Book" template a little bit)
Line 3: Line 3:
 
'''[[Template:Book]]''' is a [[MediaWiki]] template
 
'''[[Template:Book]]''' is a [[MediaWiki]] template
  
== Example ==
+
== Examples ==
  
 +
=== Example One ===
 
This is an example for using "Template:Book"
 
This is an example for using "Template:Book"
  <code>* <nowiki>{{Book|title=MediaWiki|author=Daniel J. Barrett|year=2009}}</nowiki></code>
+
  <code>* <nowiki>{{Book
 +
|title=MediaWiki
 +
|author=Daniel J. Barrett
 +
|year=2009
 +
|url=https://openlibrary.org/works/OL17309374W/MediaWiki
 +
}}</nowiki></code>
 
Result
 
Result
* {{Book|title=MediaWiki|author=Daniel J. Barrett|year=2009}}
+
* {{Book
</noinclude><includeonly>Book: "{{{title|}}}" by {{{author|}}} in the year {{{year|?}}}, available at FIXME https://openlibrary.org/works/OL17309374W/MediaWiki</includeonly>
+
|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>Book: "{{{title|}}}" by {{{author|}}} in the year {{{year|?}}}, available at {{{url|FIXME}}}</includeonly>

Revision as of 05:06, 20 November 2020


Template:Book is a MediaWiki template

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
}}

Result


Example Two

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

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

Result:

  • Book: "MediaWiki" by Daniel J. Barrett in the year ?, available at 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.