Template:Subjects: Difference between revisions
[checked revision] | [checked revision] |
FULLBOOKNAME, diagnose |
BOOKNAME (new-style) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{#ifeq:{{ |
<includeonly>{{#ifeq:{{BOOKPAGENAME}}||<!-- this isn't a subpage --> |
||
{{#switch:{{NAMESPACE}}|Wikijunior|=[[ |
{{#switch:{{NAMESPACE}}|Wikijunior|=[[{{BOOKCATEGORY|book={{{bookcategory|{{NAIVEBOOKNAME}}}}}}}| ]]}} |
||
{{#if:{{{1|}}}|{{Subjects/leaf|{{{1}}}|diagnose={{{diagnose|}}}}}|[[Category:Uncategorized books|{{ |
{{#if:{{{1|}}}|{{Subjects/leaf|{{{1}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}|[[Category:Uncategorized books|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{2|}}}|{{Subjects/leaf|{{{2}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{2|}}}|{{Subjects/leaf|{{{2}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{3|}}}|{{Subjects/leaf|{{{3}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{3|}}}|{{Subjects/leaf|{{{3}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{4|}}}|{{Subjects/leaf|{{{4}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{4|}}}|{{Subjects/leaf|{{{4}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{5|}}}|{{Subjects/leaf|{{{5}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{5|}}}|{{Subjects/leaf|{{{5}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{6|}}}|{{Subjects/leaf|{{{6}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{6|}}}|{{Subjects/leaf|{{{6}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{7|}}}|{{Subjects/leaf|{{{7}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{7|}}}|{{Subjects/leaf|{{{7}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{8|}}}|{{Subjects/leaf|{{{8}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{8|}}}|{{Subjects/leaf|{{{8}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{9|}}}|{{Subjects/leaf|{{{9}}}|diagnose={{{diagnose|}}}}}}} |
{{#if:{{{9|}}}|{{Subjects/leaf|{{{9}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}} |
||
{{#if:{{{10|}}}|{{Subjects/leaf|{{{10}}}|diagnose={{{diagnose|}}}}}}}|<!-- this is a subpage --> |
{{#if:{{{10|}}}|{{Subjects/leaf|{{{10}}}|bookcategory={{{bookcategory|{{NAIVEBOOKNAME}}}}}|diagnose={{{diagnose|}}}}}}}|<!-- this is a subpage --> |
||
{{#switch:{{NAMESPACE}}|Wikijunior|=[[ |
{{#switch:{{NAMESPACE}}|Wikijunior|=[[{{BOOKCATEGORY|{{{bookcategory|{{BOOKNAME}}}}}}}|{{BOOKSORTKEY}}]]|#default= |
||
{{#if:{{{1|}}}|[[Category:{{{1}}}|{{ |
{{#if:{{{1|}}}|[[Category:{{{1}}}|{{BOOKSORTKEY}}]]|[[Category:Uncategorized books|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{2|}}}|[[Category:{{{2}}}|{{ |
{{#if:{{{2|}}}|[[Category:{{{2}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{3|}}}|[[Category:{{{3}}}|{{ |
{{#if:{{{3|}}}|[[Category:{{{3}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{4|}}}|[[Category:{{{4}}}|{{ |
{{#if:{{{4|}}}|[[Category:{{{4}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{5|}}}|[[Category:{{{5}}}|{{ |
{{#if:{{{5|}}}|[[Category:{{{5}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{6|}}}|[[Category:{{{6}}}|{{ |
{{#if:{{{6|}}}|[[Category:{{{6}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{7|}}}|[[Category:{{{7}}}|{{ |
{{#if:{{{7|}}}|[[Category:{{{7}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{8|}}}|[[Category:{{{8}}}|{{ |
{{#if:{{{8|}}}|[[Category:{{{8}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{9|}}}|[[Category:{{{9}}}|{{ |
{{#if:{{{9|}}}|[[Category:{{{9}}}|{{BOOKSORTKEY}}]]}} |
||
{{#if:{{{10|}}}|[[Category:{{{10}}}|{{ |
{{#if:{{{10|}}}|[[Category:{{{10}}}|{{BOOKSORTKEY}}]]}}}}}} |
||
{{#if:{{{bookcategory|}}}|[[Category:Books that specify subjects bookcategory]]}} |
{{#if:{{{bookcategory|}}}|[[Category:Books that specify subjects bookcategory]]}} |
||
</includeonly><noinclude>{{documentation}}</noinclude> |
</includeonly><noinclude>{{documentation}}</noinclude> |
Latest revision as of 03:10, 24 January 2018
This template is used on 6,000+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template categorizes a book in up to 10 subject categories, plus the book category (this is automatic). The book category can be modified by setting the bookcategory
variable. You can also use this on subpages of a book and it will only add the book category; however, {{BookCat}} is recommended for subpages.
For non-subject categories (typically, descendants of Category:Books by type), use template {{categories}} instead of this template.
Usage
{{subjects|mathematics|science|etc}}
Internals
This template is responsible for adding books to the hidden allbooks categories, which allow automatic generation of lists of books belonging to a given subject or any of its sub-subjects. When this template detects that it is being used on the main page of a book, for each subject specified it calls {{subjects/leaf}}. This is why this template should only be used for subject categories: {{subjects/leaf}} uses subject pages to figure out which allbooks categories to add the book to, and if there are no subject pages to consult, it reports the problem to Category:Attention needed (allbooks). By using {{categories}} for non-subject categories, one avoids nuisance reports to Category:Attention needed (allbooks).
This template can be induced to display diagnostic messages, explaining why it has put the page in Category:Attention needed (allbooks), by specifying parameter diagnose=true
.
See also
- {{categories}} — adds book to non-subject categories
- {{alphabetical}} — adds book to alphabetical classification
- {{status}} — classifies book by completion status
- {{BOOKNAME}} — Returns the name of the book including the namespace