Difference between revisions of "Template:CatAutoTOC/core"

From Cafe Plaisir
Jump to navigation Jump to search
(Created page with "<includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->...")
 
 
Line 1: Line 1:
 
<includeonly><!--
 
<includeonly><!--
 +
  # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}}
 +
  #
 
   # TOC, depending on category size
 
   # TOC, depending on category size
 
   # <= 100 pages → no TOC
 
   # <= 100 pages → no TOC
 
   # 101–1200 pages → {{Category TOC}}
 
   # 101–1200 pages → {{Category TOC}}
 
   # > 1200 pages → {{Large category TOC}}
 
   # > 1200 pages → {{Large category TOC}}
-->{{Category other|<!--
+
 
        #################################################################################
+
###########################################################################
        #### This is a category page, so generate a TOC if needed.                  ####
+
# NOTE: The sort key {{PAGENAME}} is used on all the tracking categories  #
        ####                                                                        ####
+
  #       to override any {{DEFAULTSORT}} used in the category              #
        #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have ####
+
###########################################################################
        #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} ####
+
 
        #################################################################################
+
-->{{#ifexpr: {{{pagecount}}} > 1200 <!--
    -->{{CatAutoTOC/core<!--
 
        -->|pagecount={{PAGESINCATEGORY|{{PAGENAME}}|R}}<!--
 
    -->}}<!--
 
-->}}<!--
 
-->{{Template other<!--
 
 
     -->|<!--
 
     -->|<!--
        #################################################################################
+
          # > 1200, so large TOC
         #### This page is a template, so categorise it                              ####
+
         -->{{Large category TOC|CatAutoTOC=yes}}<!--
         #### in [[Category:Templates using CatAutoTOC]] ...                          ####
+
         -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!--
        ####                                                                        ####
+
    -->|<!--
        #### ... unless it is a /doc, /testcases or /sandbox                        ####
+
          # < 1200, so check again
        ####                                                                        ####
+
         -->{{#ifexpr: {{{pagecount}}} > 100<!--
        #### There is no point categorising every sub-page of the same template      ####
+
            -->|<!--
        #################################################################################
+
                # > 100, so std TOC
         -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!--
+
                -->{{Category TOC|CatAutoTOC=yes}}<!--
        -->|<!--
+
                -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!--
              ### Don't categorise /doc, /testcases or /sandbox pages
+
            -->|<!--
         -->|<!--
+
                # <= 100, so no TOC
              ### Not a /doc, /testcases or /sandbox page, so categorise it
+
                -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!--
            -->[[Category:Templates using CatAutoTOC]]<!--
+
         -->}}<!--
    -->}}<!--
+
-->}}<!--
-->}}</includeonly><noinclude>
+
-->{{#ifeq: {{{pagecount}}} | 0 <!--
{{Documentation}}
+
    -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!--
 +
-->}}<!--
 +
--></includeonly><noinclude>
 +
{{Documentation|Template:{{ROOTPAGENAME}}/doc}}
 
[[Category:Wikipedia CatAutoTOC]]
 
[[Category:Wikipedia CatAutoTOC]]
 
</noinclude>
 
</noinclude>

Latest revision as of 21:32, 8 April 2020

50px Template documentation[create]