Difference between revisions of "Template:Book"

From DevSummit
Jump to navigation Jump to search
(Making the {{Book}} template more forgiving)
(Hardcoding the result of {{Book}})
Line 42: Line 42:
 
Result:
 
Result:
  
* {{Book}}
+
* {{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.
 
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.

Revision as of 05:48, 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 Three

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

* {{Book}}

Result:

  • {{subst:Book}}

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.

</noinclude>MediaWiki (2009) by Daniel J. Barrett (https://openlibrary.org/works/OL17309374W/MediaWiki)



Example Two

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

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

Result:

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

Example Three

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

* {{Book}}

Result:

  • {{subst:Book}}

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.

</noinclude>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.