"साँचा:BookCat": अवतरणों में अंतर

छो Fixed sort key
Updates by Pi zero
पंक्ति १:
<includeonly>{{#ifeq:{{FULLPAGENAME}}|{{TALKPAGENAME}}||{{#switch:{{NAMESPACE}}|Template={{#ifeq:"{{FULLCHAPTERNAME}}"|"{{FULLBOOKNAMEtemplate-filing|}}"}|deep|[[Category:{{BOOKNAME}}/Templates{{#if:{{#titleparts:{{PAGENAME}}||3}}|/{{#titleparts:{{PAGENAME}}|-1| 2}}}}|{{{1|{{#if:{{CHAPTERNAME}}|{{#titleparts:{{PAGENAME}}||-1}}}}}}} ]]|[[Category:{{BOOKNAME}}/Templates|{{{1|{{FULLCHAPTERNAME#titleparts:{{FULLPAGENAME}}||2}}}}} ]]}}|Category={{#ifeq:"{{FULLCHAPTERNAME}}"|"{{FULLBOOKNAME}}"||[[Category:{{#titleparts:{{PAGENAME}}|-1}}|{{{1|{{#titleparts:{{PAGENAME}}||-1}}}}} ]]{{#ifeq:"{{FULLCHAPTERNAME}}"|"Templates"| [[Category:Book-specific templates|{{{1|{{PAGENAME}}}}} ]]}}}}|#default={{#ifeq:"{{FULLCHAPTERNAME{filing|}}}"|"deep|[[Category:{{FULLBOOKNAME#if:{{CHAPTERNAME}}"|[[Category{{#titleparts:{{FULLBOOKNAMEFULLPAGENAME}}|-1}}|{{FULLPAGENAME}}}}|{{{1| {{#if:{{CHAPTERNAME}}|{{#titleparts:{{PAGENAME}}||-1}}}}}}} ]]|[[Category:{{FULLBOOKNAME}}|{{{1|{{FULLCHAPTERNAME#titleparts:{{FULLPAGENAME}}||2}}}}} ]]}}}}}}</includeonly><noinclude>
This template puts the page on which it's used (<code><nowiki>{{FULLPAGENAME}}</nowiki></code>) into appropriate categories, based on certain page-naming and page-categorization conventions.
This template does the following, based on the page it's added to:
 
*Places subpages of a book in the book's category (<tt>Category:{{tlx|FULLBOOKNAME}}</tt>) and sorts them by chapter name.
When used without parameters, it
*Places a book's templates in the template category ({{nowrap|<tt>Category:{{tlx|BOOKNAME}}/Templates</tt>}}). ''This only works if a book's templates begin with'' {{nowrap|<tt>Template:{{tlx|FULLBOOKNAME}}</tt>}}&nbsp;.
*Placesplaces subpages of a book's template category in the book's category and ({{nowrap|[[:<code>Category:Book-specific templates]]{{tlx|ROOTBOOKNAME}}</code>}}) and sorts them by chapter name.
*Placesplaces a book's templates in the book's template category ({{nowrap|<ttcode>Category:{{tlx|BOOKNAMEROOTBOOKNAME}}/Templates</ttcode>}}). ''This only works if a book's templates begin with''&nbsp; {{nowrap|<ttcode>Template:{{tlx|FULLBOOKNAMEROOTBOOKNAME}}</ttcode>}}&nbsp;.
*Places any other category in its parent, sorted by its last name. The parent has the same name except removing every from the last slash on; and the last name is the part that was removed after that last slash. For example, {{nowrap|<tt>Category:My Book/Images</tt>}}&nbsp; would go in&nbsp; {{nowrap|<tt>Category:My Book</tt>}}&nbsp; with sort key&nbsp; <tt>Images</tt>.
*places a book's template category in the book's category and in&nbsp; {{nowrap|<code>[[:Category:Book-specific templates]]</code>}}&nbsp;.
*Placesplaces any other category in its parent, sorted by itsthe category's last name. The parent has the same name except removing everyeverything from the last slash on; and the last name is the part that was removed after that last slash. For example, {{nowrap|<ttcode>Category:My Book/Images</ttcode>}}&nbsp; would go in&nbsp; {{nowrap|<ttcode>Category:My Book</ttcode>}}&nbsp; with sort key&nbsp; <ttcode>Images</ttcode>&nbsp;.
 
Optional parameter&nbsp; {{nowrap|<code><nowiki>filing=deep</nowiki></code>}}&nbsp; changes the behavior on book pages, so that a book page with more than one slash in its name is placed in a subcategory of the category where its parent page would be placed, sorted by the page's last name. For example, using&nbsp; {{nowrap|<code><nowiki>{{BookCat|filing=deep}}</nowiki></code>}}&nbsp; on page&nbsp; {{nowrap|<code>My Book/Maps/Asia</code>}}&nbsp; would put that page in&nbsp; {{nowrap|<code>Category:My Book/Maps</code>}}&nbsp; with sort key&nbsp; <code>Asia</code>&nbsp;.
 
Optional parameter&nbsp; {{nowrap|<code><nowiki>template-filing=deep</nowiki></code>}}&nbsp; changes the behavior on template pages to deep filing (so&nbsp; {{nowrap|<code>Template:My book/Maps/Asia</code>}}&nbsp; would go in&nbsp; {{nowrap|<code>Category:My book/Templates/Maps</code>}}).
 
See [[Using Wikibooks/Subjects, Categories, and Classifications#Deep filing (advanced)]] for more information.
 
[[Category:Catalogue templates|{{PAGENAME}}]]</noinclude>