Difference between revisions of "Template:Infobox book/Wikidata/Sandbox/doc"

From blackwiki
Jump to navigation Jump to search
imported>RexxS
(level 3)
imported>RexxS
(→‎No Wikidata: blacklist and whitelist can be omitted)
Line 41: Line 41:
 
</pre>
 
</pre>
 
Works as a non-aware infobox: only locally supplied parameters are displayed.
 
Works as a non-aware infobox: only locally supplied parameters are displayed.
 +
<pre>
 +
{{Infobox book/Wikidata/Sandbox
 +
| name          = Animal Farm
 +
| title_orig    = Animal Farm: A Fairy Story
 +
| image          = Animal Farm - 1st edition.jpg
 +
| image_size    = 200px
 +
| caption        = First edition cover
 +
| author        = [[George Orwell]]
 +
| country        = United Kingdom
 +
| language      = English
 +
| genre          = Political satire
 +
}}
 +
</pre>
 +
The blacklist and whitelist can be omitted if unused
  
 
=== All Wikidata ===
 
=== All Wikidata ===

Revision as of 09:44, 17 May 2016

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 list 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.

Parameters supported so far are: Template:Ubl

Usage

No Wikidata

{{Infobox book/Wikidata/Sandbox
| suppressfields =
| fetchwikidata  =
| name           = Animal Farm
| title_orig     = Animal Farm: A Fairy Story
| image          = Animal Farm - 1st edition.jpg
| image_size     = 200px
| caption        = First edition cover
| author         = [[George Orwell]]
| country        = United Kingdom
| language       = English
| genre          = Political satire
}}

Works as a non-aware infobox: only locally supplied parameters are displayed.

{{Infobox book/Wikidata/Sandbox
| name           = Animal Farm
| title_orig     = Animal Farm: A Fairy Story
| image          = Animal Farm - 1st edition.jpg
| image_size     = 200px
| caption        = First edition cover
| author         = [[George Orwell]]
| country        = United Kingdom
| language       = English
| genre          = Political satire
}}

The blacklist and whitelist can be omitted if unused

All Wikidata

{{Infobox book/Wikidata/Sandbox
| suppressfields = 
| fetchwikidata  = author; genre; pub_date; pages; dewey; congress
}}

Fetches all of its values from Wikidata.

Never display genre

{{Infobox book/Wikidata/Sandbox
| suppressfields = genre
| fetchwikidata  = author; genre; pub_date; pages; dewey; congress
}}

The genre field will always be suppressed, even if a local value is supplied.

{{Infobox book/Wikidata/Sandbox
| suppressfields = genre
| fetchwikidata  = author; genre; pub_date; pages; dewey; congress
| genre          = Political satire
}}

Local override

{{Infobox book/Wikidata/Sandbox
| suppressfields = 
| fetchwikidata  = author; genre; pub_date; pages; dewey; congress
| genre          = Political satire
}}

The genre field will display "Political satire", no matter what is stored in Wikidata.

Don't fetch genre

{{Infobox book/Wikidata/Sandbox
| suppressfields = 
| fetchwikidata  = author; pub_date; pages; dewey; congress
}}

The genre field will not be fetched from Wikidata.