Template:Infobox book/Wikidata/Sandbox
Testing sandbox for a wikidata-aware Infobox book.
This uses a 'blacklist' of fields that will never be displayed, by using the parameter |suppressfields, e.g.:
| suppressfields = dewey; congress
It uses a 'whitelist' of fields that will be fetched from Wikidata, by using the parameter |fetchwikidata (unless the field is suppressed or a local value is supplied), e.g.:
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
Any separators can be used, except | and {} as you might expect.
The snag will be if a field name is included inside another field name like "date" is inside "pub_date". Try to avoid naming parameters like that.
As a shorthand the whitelist of fields to be fetched from Wikidata can be given the value ALL, for all available fields.
| fetchwikidata = ALL
Parameters supported so far are:
- author
- genre
- pub_date
- pages
- dewey
- congress
Usage
No Wikidata
<syntaxhighlight lang="wikitext">
![]() First edition cover | |
Author | George Orwell |
---|---|
Original title | Animal Farm: A Fairy Story |
Country | United Kingdom |
Language | English |
Genre | Political satire |
</syntaxhighlight> Works as a non-aware infobox: only locally supplied parameters are displayed. <syntaxhighlight lang="wikitext">
![]() First edition cover | |
Author | George Orwell |
---|---|
Original title | Animal Farm: A Fairy Story |
Country | United Kingdom |
Language | English |
Genre | Political satire |
</syntaxhighlight> The blacklist and whitelist can be omitted if unused
All Wikidata
<syntaxhighlight lang="wikitext">
</syntaxhighlight> Fetches all of its values from Wikidata. <syntaxhighlight lang="wikitext">
</syntaxhighlight>
As shorthand, the |fetchwikidata=
can be set to ALL to fetch all available fields.
Any of them can be suppressed by |suppressfields=
, or overridden by supplying a local value.
Never display genre
<syntaxhighlight lang="wikitext">
</syntaxhighlight> The genre field will always be suppressed, even if a local value is supplied. <syntaxhighlight lang="wikitext">
Genre | Political satire |
---|
</syntaxhighlight>
Local override
<syntaxhighlight lang="wikitext">
Genre | Political satire |
---|
</syntaxhighlight> The genre field is set to display "Political satire", no matter what is stored in Wikidata. <syntaxhighlight lang="wikitext">
Genre | Novel |
---|
</syntaxhighlight> The genre field is set to display "Novel", no matter what is stored in Wikidata.
Don't fetch genre
<syntaxhighlight lang="wikitext">
</syntaxhighlight> The genre field will not be fetched from Wikidata.