Difference between revisions of "Template:Commoncats"

From blackwiki
Jump to navigation Jump to search
imported>MelonBot
m (Tag for MfD using AWB)
imported>Happy-melon
Line 1: Line 1:
<noinclude>{{mfd|WikiProject template sharing and related structures}}</noinclude>
+
#REDIRECT[[Template:Commons cats multi]]
<!-- Commoncats -- descendent of the various commons:WikiPcatXX family and w:CommonscatXX templates, consolidated into a single general template in April-May 2007
 
start_div1/+DV01:
 
--><div class="sister-project" style="<!--
 
-->border:solid #aaa 1px; <!--
 
    Note: params clear and margin principally used inside other templates
 
-->{{#if:{{{left|}}} <!-- if left float
 
    then:
 
    -->|float:{{{float|left }}};clear:{{{clear|left }}}; margin:{{{margin|0em 3em 1em 0em}}}<!--
 
    else:    normal right float
 
    -->|float:{{{float|right}}};clear:{{{clear|right}}}; margin:{{{margin|0em 0em 1em 3em}}}<!--
 
-->}}; <!--
 
   
 
-->font-size:{{{fontsize|85%}}}; background:#f9f9f9; <!---f9f9d9--->; <!--
 
-->width:{{#ifexist:Template:IWTG width  <!--
 
-->|<!--then:
 
    -->{{{boxwidth|{{{width|{{IWTG width}} }}} }}}  <!--
 
-->|<!--else:
 
    -->{{{boxwidth|{{{width|250px}}} }}}  <!--
 
-->}}; <!--
 
-->padding:4px; spacing:0px; <!--
 
-->text-align:left; "><!--
 
 
 
<!----------------------------------- Logo images ----------------------------------->
 
<!--start_div2/+DV02:--><div style="float:left; border:1px solid #a9a9a9;"><!--
 
-->{{#ifeq:Wikimedia Commons |<!--equals:-->{{SITENAME}} <!--
 
-->|<!--then:-->[[Image:Wikipedia-logo.png|left|{{#if:{{{boxwidth|{{{width|}}}}}}|13px|30px}}|none]]<!--Image:Wikipedia-logo.png
 
=== -->{{#if: {{{2A|}}}{{{3A|}}}{{{2C|}}}{{{3C|}}}<!--
 
=== === -->|<br/><!-- Then: Add extra height between logos
 
=== -->}}<!--
 
--><!-- <br/>
 
              -->[[Image:Wikimedia_Foundation_RGB_logo_with_text.svg|{{#if:{{{boxwidth|{{{width|}}}}}}|13px|30px}}|left|none]] <!--
 
=== --------------------------------------------------------------------- Else...
 
-->|<!--else:-->[[Image:Wikimedia_Foundation_RGB_logo_with_text.svg|{{#if:{{{boxwidth|{{{width|}}}}}}|13px|30px}}|left|none]] <!--
 
=== -->{{#if: {{{2A|}}}{{{3A|}}}{{{2C|}}}{{{3C|}}}<!--
 
=== === -->|<br/><!-- Then: Add extra height between logos
 
=== -->}}<!--
 
--><!-- <br/>
 
              -->[[Image:Wikipedia-logo.png|left|{{#if:{{{boxwidth|{{{width|}}}}}}|13px|30px}}|none]]<!--
 
-->}}<!--
 
<!---end_div2/-DV02:---></div><!--
 
 
 
===================================================================================
 
...--><!--    =================================================
 
...  +DV03 --><div style="margin-left: 40px; line-height:95%"><!-- Master output formating line
 
...--><!--    =================================================
 
... all output takes place now within this div "DV03" block
 
... and within "DV01" sisterclass box.
 
===================================================================================
 
-->{{#switch: {{{2|}}}<!--
 
=== -->| !<!-- Do nothing up here if {{{2}}} undefined... handle these cases in the
 
=== -->| #<!-- Second switch (2) logic inside Second (full) switch (2).
 
=== -->| $<!--
 
=== -->=<!--
 
=== -->{{#switch: {{{1|}}} <!--
 
combined logic of en.wp's CommonscatNo and commons:template:WikiPcatNo templates.
 
=== === -->| !<!-- switch 1-#2 tests
 
=== === -->| #<!--
 
=== === -->| $ =<!-- Detect skip Cat mode in Sw2-1 && Sw1-1... <br>
 
=== ...
 
=== ... CASE: Both {{{1}}} and {{{2}}} are defined as '!', '#', or '$', thereby
 
=== ... disabling default {{PAGENAME}} output, and putting all article linking logic here
 
=== ...
 
=== === ...  Begin by seeing if there is an article override: (In Sw1-#1)
 
=== === -->{{#if: {{{1A|}}}{{{2A|}}}{{{3A|}}}<!-- OR (any articles =?= TRUE?) test (1)
 
=== === -->|<small><!-- OL-01 <!-- USE/need: rare to very-rare
 
=== === === -->{{#if: {{{2A|}}}{{{3A|}}}<!--
 
=== === === === -->|Likely articles on En.Wikipedia are:<!--
 
=== === === === -->|A likely article on En.Wikipedia is:<!--
 
=== === === -->}}<!-- endif
 
=== === === === Do first output line, then test if there may be another...
 
=== === === --></small><br /><b><!--{{S|3}}-->''[[{{WPD|}}{{{1A|{{PAGENAME}}}}}|{{{1A|{{PAGENAME}} }}}]]'' <!--
 
=== === === -->{{#if: {{{2A|}}}{{{3A|}}} |<!--
 
=== === === === -->{{#if: {{{2A|}}} |or <br />''[[{{WPD|}}{{{2A}}} |{{{2A}}} ]]''}} <!--
 
=== === === === -->{{#if: {{{3A|}}} |or <br />''[[{{WPD|}}{{{3A}}} |{{{3A}}} ]]''}} <!--
 
=== === === -->}}<!-- endif (another)
 
=== === -->|<small><!-- OL-02 (No English Wikipedia article)</small><br><!-- USE/need: med-rare to rare
 
=== === -->}}<!--endif (any articles =?= TRUE?) test
 
=== === === 
 
=== === ===  Regardless of other output, this switch case combination categorises to:
 
=== -->[[Category:Sister Project category scheme mismatch]] <!--
 
===
 
=== Endcase: Sw(1) says one of '!', '#', or '$' is TRUE, as is Sw(2) case
 
===
 
=== -->}}<!-- End switch (1-#1)
 
===
 
============================
 
=== Back in Switch (2-#1) ==
 
============================
 
=== -->| #default =<!-- p/o Switch (2-#1)... reaching HERE means: 'no command character'
 
=== ... detected as parameter {{{2}}}. {{{2}}} is null, or {{{2}}} has a pagename that
 
=== ... is other than the default category. (Or is a garbage character or word!)
 
=== Begin switch 1-#2...
 
=== -->{{#switch: {{{1}}}<!--
 
=== === -->| !<!-- switch 1-#2 tests
 
=== === -->| #<!--
 
=== === -->| $ =<small><!-- OL-03 </small><!--Possible article display in Sw1-#2<br>
 
=== === {In sw1-#2 AND case default of Sw2-#1)
 
=== === ===    Begin by seeing if there is an article override:
 
=== === -->{{#if: {{{1A|}}}{{{2A|}}}{{{3A|}}}<!-- OR (any articles =?= TRUE?) test (2)
 
=== === === -->|<!--
 
=== === === -->{{#if: {{{2A|}}}{{{3A|}}}<!--
 
=== === === === -->|Articles on English Wikipedia are:<!--
 
=== === === === -->|An article on English Wikipedia is:<!--
 
=== === === -->}}<!-- endif
 
=== === === === Do first output line, then test to see if another...
 
=== === === --><br><b><!--{{S|2}} --><!--
 
=== === === -->{{#if: {{{1A|}}} |''[[{{WPD|}}{{{1A|}}}|{{{1A}}}]]'' <!-- OL-OR -->}} <!--
 
=== === === -->{{#if: {{{2A|}}} |{{#if: {{{1A|}}} |or <br />}}''[[{{WPD|}}{{{2A}}} |{{{2A}}} ]]''}} <!--
 
=== === === -->{{#if: {{{3A|}}} |{{#if: {{{1A|}}}{{{2A|}}} |or <br />}}''[[{{WPD|}}{{{3A}}} |{{{3A}}} ]]''}} <!--
 
=== === -->}}<!--endif (any articles =?= TRUE?) test (2)
 
===
 
=== ======================================================
 
=== EndCase: Suppress article display and link building ==
 
=== BegCase: Use default per trigger param              ==
 
=== ======================================================
 
=== === -->| "<!--
 
=== === -->| @<!--
 
=== === -->| *<!--        '"', '@', or '*' handling
 
=== {In sw1-#2 AND case default of Sw2-#1)
 
=== ...  Select Default for Article name, implication is that the Category 
 
=== ...  name must differ or the user could just employ the default form. 
 
=== ...  That is, specifying one of these characters forces the default art
 
=== ...  -cle name {{PAGENAME}} or the parameter name {{{1A}}} to be used. 
 
=== ...
 
=== === === --><small><!-- OL-04 English Wikipedia <!--  USE/need: seldom to moderately-rare,
 
===                        cats and articles usually have a plural singular difference
 
=== === === -->{{#if: {{{2A|}}}{{{3A|}}}<!--
 
=== === === -->|articles:|article:<!--
 
=== === === -->}}<!--
 
=== === === --></small><b> ''<br />[[{{WPD|}}{{{1A|{{PAGENAME}} }}} | {{{1A|{{PAGENAME}} }}} ]]'' <!--
 
=== === === -->{{#if: {{{2A|}}}{{{3A|}}}|<!--
 
=== === === === -->{{#if: {{{2A|}}}|''<br />[[{{WPD|}}{{{2A}}} |{{{2A}}} ]]'' }}<!--
 
=== === === === -->{{#if: {{{3A|}}}|''<br />[[{{WPD|}}{{{3A}}} |{{{3A}}} ]]''}}<!--
 
=== === === -->}}<!-- endif: More than one article
 
=== =====================================================================
 
=== Endcase: (1) is one of '"', '@', or '*' AND case default of Sw2-#1 ==
 
=== =====================================================================
 
===
 
=== ... ===========================================
 
=== === -->| #default =<!-- of Sw1-#2 (&& is OL-05)
 
=== ... ===========================================
 
=== {In sw1-#2 case default AND case default of Sw2-#1)
 
=== === ...  other {{{1}}} handling, case of twin '!' handled above, as is a       
 
=== === ...  single (1)=='!' (etc.), so are other single char cmnds... so {{{1}} by deduction   
 
=== === ...  must be some 'specified pagename'. Nevertheless, let a 1A parameter override.
 
=== === ...
 
=== === ========================================================================= ===
 
=== ===  default flow... many cases. Implies {{{1}}} not a switch character and  ===
 
=== ===  therefore if present, is an alternative article name (most are wp pages  ===
 
=== ===  are NOT plural as are most category names) or is totally undefined, thus ===
 
=== ===  should default to {{PAGENAME}} since {{{1}}} logic does not suppress    ===
 
=== ===  this brachto case either using '!', '#', or '$'.                        ===
 
=== === =============================================================================
 
=== === --><small><!-- OL-05  -->English Wikipedia <!-- USE/need: common to very-common,
 
=== === ...    as most commons and wikipedia categories match up well, most wikipedia
 
=== === ...    categories have some main article, and this should be the most prevalent
 
=== === ...    output for articles as {{{1}}} can and should be (will!) be filled in
 
=== === ...    by the applying editor.
 
=== === ...    This logic and code also handles the default case, so is prevalent.
 
=== === ...
 
=== {In sw1-#2 case default AND case default of Sw2-#1)
 
=== === ---  First (normal flow case) output line header follows:
 
=== === -->{{#if: {{{2A|}}}{{{3A|}}}<!--
 
=== === === -->|articles:|article:<!--
 
=== === -->}} </small><b> ''<br /><!--
 
=== === -->{{#if:{{ifequal|{{{1|}}}|@|{{{1|}}}|*|{{{1|}}}|"}}<!--
 
=== === === --->|[[{{WPD|}}{{{1A|{{PAGENAME}} }}} |{{{1A|{{PAGENAME}} }}} ]]'' <!--
 
=== === ===
 
=== === === Having to code this if block implies nesting per the below line summary from above is misfigured, and code is nested differently.
 
=== "Endcase: (1) is one of '"', '@', or '*' AND case default of Sw2-#1" (Dup of above)
 
=== === ===
 
=== === ===
 
=== === === --->|[[{{WPD|}}{{{1A|{{{1|{{PAGENAME}} }}} }}} |{{{1A|{{{1|{{PAGENAME}} }}} }}} ]]'' <!--
 
=== === -->}}<!--
 
=== === -->{{#if: {{{2A|}}}{{{3A|}}} |<!--
 
=== === === -->{{#if: {{{2A|}}} |<br />''[[{{WPD|}}{{{2A}}} |{{{2A}}} ]]''}} <!--
 
=== === === -->{{#if: {{{3A|}}} |<br />''[[{{WPD|}}{{{3A}}} |{{{3A}}} ]]''}}<!--
 
=== === -->}}</b><br><!-- endif: More than one article
 
=== ===
 
=== === === ==================================================================
 
=== -->}}<!-- End switch (1-#2) case default inside case default of Sw2-#1 ===
 
=== === === ==================================================================
 
=== ...
 
=== ==================================================
 
-->}}</b><br><!-- End switch (2-#1) (aka: Switch 2-#1)
 
=== ==================================================
 
 
 
*** *********** Begin Part II - Category output *************
 
==============================================================
 
-->{{#switch: {{{2|}}} <!-- Category Output Switch: Sw2-#2 ==
 
==============================================================
 
=== -->| !<!-- switch 2-#2 tests ?Do(Inhibit category link output)???
 
=== -->| #<!--
 
=== -->| $<!--
 
=== -->=<!--OL-06a <!-- Case Begins: switch on {{{2}}} equals one of '!', '#', or '$' 
 
=== ===          signifying suppression of normal category logic 
 
=== ===          behavior is desired. That means no good category 
 
=== ===          match between sisters exists, and the two schemes
 
=== ===          are quite different in this part of their       
 
=== ===          respective heirarchial structures or schemes.               
 
=== ===
 
=== === Now article part is handled above in Sw2-#1 [the first switch on '(2)']
 
=== === so here we just handle the bottom output -- the category overrides, if any.
 
=== ===
 
=== === CASE: {{{2}}} is defined as '!', '#', or '$', thereby disabling default
 
=== === {{PAGENAME}} output, and putting category logic here to any named parameters.
 
=== ===
 
=== ===    Begin by seeing if there is an category override:
 
=== -->{{#if:{{{3C|}}}{{{2C|}}}{{{1C|}}}<!-- do cat message
 
=== === -->|<br><small><!--OL-06b <!-- (Inhibit category link output) USE/need:
 
=== === ===                ... very-rare to nearly never
 
=== === ===   
 
=== === -->{{#ifeq: Wikimedia Commons|{{SITENAME}}<!--
 
=== === === -->|English Wikipedia|Commons<!--
 
=== === -->}} related <!-- Display the (named) Category(s) or 1C, 2C, 3C OVERRIDEs.
 
=== === -->{{#if: {{{2C|}}}{{{3C|}}}|categories:|category:}} </small><b>''<!--
 
=== === -->{{#if: {{{1C|}}}|<br />[[{{OTHERSITE|}}Category:{{{1C}}}|{{{1C}}}]]}}<!--
 
=== === -->{{#if: {{{2C|}}}|<br />[[{{OTHERSITE|}}Category:{{{2C}}}|{{{2C}}}]]}}<!--
 
=== === -->{{#if: {{{3C|}}}|<br />[[{{OTHERSITE|}}Category:{{{3C}}}|{{{3C}}}]]}}''</b><!--
 
=== -->|<br />No Category scheme name matches at <!--
 
=== -->{{#ifeq:{{SITENAME}}|Wikimedia Commons<!--
 
=== === -->|the English Wikipedia.<!--
 
=== === -->|Wikimedia Commons.<!--
 
=== -->}}<!--
 
-->}}<!-- Endif/Endcase: default (1), when {{{2}}} equals one of '!', '#', or '$'
 
===             
 
===    **************************************************************************
 
=== === Case: Overt command to Use Default {{Pagename}} as category link output **
 
===    **************************************************************************
 
=== -->| "<!-- In and Testing (Sw2-#2)
 
=== -->| @<!--
 
=== -->| *<!--
 
=== -->= <!-- 
 
=== ...      Display the default (PAGENAME) Category or 1C, 2C, 3C overrides.
 
=== ...      This would be an unusual mode, as assumes {{{2}}} defined, but 
 
=== ...      essentially ignored as an input parameter, as may be the normal 
 
=== ...      default PAGENAME.                                               
 
=== --><small><!-- OL-07 <!-- USE/need: rare to very-rare, Should generally only used
 
=== ...      if and when applying editor is compulsive. This is just a safety net
 
=== ...      so the logic covers all cases of combos of command characters with
 
=== ...      consistency on this one, for the same syntax on the article links.
 
=== -->{{#if:Wikimedia Commons|{{SITENAME}}<!--
 
=== === -->|Commons|English Wikipedia<!--
 
=== -->}} related <!--
 
=== -->{{#if: {{{2C|}}}{{{3C|}}} <!--
 
=== === -->|categories:|category:}} </small><b><!--
 
=== -->''<br />[[{{OTHERSITE|}}Category:{{{1C|{{PAGENAME}} }}} | {{{1C|{{PAGENAME}} }}} ]]'' <!--
 
=== -->{{#if: {{{2C|}}}{{{3C|}}}|<!--
 
=== === -->{{#if: {{{2C|}}}|''<br />[[{{OTHERSITE|}}Category:{{{2C}}} |{{{2C}}}]]''}}<!--
 
=== === -->{{#if: {{{3C|}}}|''<br />[[{{OTHERSITE|}}Category:{{{3C}}} |{{{3C}}}]]''}}<!--
 
=== -->}}<!-- Endif: More than one Category
 
=== ================================================================
 
=== Case ends: switch on {{{2}}} equals one of '"', '@', or '*'  ===
 
=== ================================================================
 
=== ...
 
=== ... (Normally output and flow comes here unless '{{{2}}}' is an override name)
 
=== ... Main category linking logic follows... most cases will either             
 
=== ... default to {{PAGENAME}}, or override {{PAGENAME}} as {{{2}}} is specified.
 
=== ...
 
=== -->| #default =<small><!-- OL-08 <!-- switch on (2) default output.  USE/need: Almost always, ubiquitous
 
=== In and Testing (Sw2-#2), case default
 
=== ===
 
=== -->{{#ifeq:Wikimedia Commons|{{SITENAME}}<!--
 
=== === -->|English Wikipedia|Commons<!--
 
=== -->}} related <!--
 
=== -->{{#if: {{{2C|}}}{{{3C|}}}<!--
 
=== === -->|categories:|category:<!--
 
=== -->}} </small><b><!--
 
=== --><br />''[[:{{OTHERSITE|}}Category:{{{2|{{{1C|{{PAGENAME}} }}} }}}<!--
 
=== -->| {{{2|{{{1C|{{PAGENAME}} }}} }}}]]'' <!--
 
*** ****  As the default case, the preceding line above is the main output line 49 times out of fifty
 
=== -->{{#if: {{{2C|}}}|<br />''[[:{{OTHERSITE|}}Category:{{{2C}}} |{{{2C}}}]]''}}<!--
 
=== -->{{#if: {{{3C|}}}|<br />''[[:{{OTHERSITE|}}Category:{{{3C}}} |{{{3C}}}]]''}}<!--
 
===
 
=== === ==================================
 
=== End case: Switch (2) default output ==
 
=== === ==================================
 
===
 
-->}}<!-- End Switch (2) logic
 
...
 
--></b></div><!-- end_div3/-DV03--></div><!-- end_div1/-DV01--></div><!--
 
...    Congratulations!!! 
 
...    You've reached beyond the display to the category tagging
 
...    outside the display part of the template.
 
... --><includeonly><!--
 
Common code Begins here:
 
-->{{<!-- display this Work In Progress tracking category only when wanted.
 
-->#if: {{IWCG showcategory}}<!--
 
-->|<!--
 
    -->[[Category:Wikipedia categories matching with Wikimedia Commons categories]]<!--
 
    -->[[Category:Categories matching sister projects categories]] <!--
 
-->}}<!--
 
--></includeonly><!--
 
... COMMON LOGIC Ends
 
...
 
-->
 
<noinclude><br style="clear:both;" />
 
{{Left60|BG=#def|98|B=1|M=0}}
 
 
 
<hr>
 
 
 
{{FixHTML|beg}}
 
{{Commoncats|Architecture|Objects}}
 
{{FixHTML|mid}}
 
{{Commoncats|!|Objects}}
 
{{FixHTML|end}}
 
 
 
;Purpose
 
:Template:Commoncats replaces a large number of templates formerly used to link between category pages between the English Wikipedia and the multilingual environment of {{wpd|Wikimedia Commons}} ("The Commons").
 
# Unlike it's rivals (sic) it usually replaces multiple templates ('''{{tl|Catmore}} ''and'' {{tl|Commons cat}}''', or other variant of 'commons cat'), can link to multiple commons categories, and displays the main article for the en.wikipedia category... usually without anything but the template name: <code><nowiki>{{Commoncats}}</nowiki></code>.
 
##The exception is those '''main articles''' where by the naming conventions the article is singular case, and the main category is plural. {{i}}{{Bull}}These are <code>handled identically to {{tl|catmore}}</code>, which is to say {{i}}{{Bull}}by specifying the article name as the first argument (the numbered parameter <code> <tt><nowiki>{{{1}}}</nowiki> </code> {{i}}{{Bull}}or the (named parameter) argument <code>'1A='</tt> ''something''</code> {{i}}{{Bull}}two other named parameters arguments <code>'|2A= ''something-2'' ' & '|3A= ''something-3'' '</tt> </code> ''can be specified'' to link upto three related article pages. (Say a list article, and two related topics sharing the category)
 
## Unlike requiring a ''''explict link name''' call form'' such as {{tl2|Commons cat|Teaching illustrations}}, in all the foregoing, the template was also linking to the commons category of the same category name like some of the earlier templates it replaces that also linked to both types of pages.  {{i}}{{Bull}}To use in the small percentage of case where there is no appropriate main article for a category, {{Tlx|Commoncats|!}} will replicate the ''only-the-category-linking' of {{tl2|Commons cat|<nowiki>{{PAGENAME}}</nowiki>}}... again, without needing to specify the page name (See magic word: [[M:Help:Magic words|<nowiki>{{PAGENAME}}</nowiki>]])
 
## Like {{Tl|Commons cat}}, you can also indeed specify an entirely different commons page name:{{I}}"{{tlx|Commoncats|!|Objects}}" (shown above and right)
 
 
 
;further modes
 
 
 
* The Command meta characters <code><tt> (<big>''''!', '$', or '#''''</big>) </tt></code> are used as placeholders in either or both <nowiki>{{Commoncats|{{{1}}}|{{{2}}} }}</nowiki> for <br/> Skipping a category or article link in place of the default <nowiki>{{PAGENAME}}</nowiki>.<br/>
 
 
 
* The Command meta characters <code><tt> (<big>''''@', '"', or ' ''''</big>) </tt></code> are used as placeholders in either or both <nowiki>{{Commoncats|{{{1}}}|{{{2}}} }}</nowiki> for explicitly directing a category or article link be made with the default <nowiki>{{PAGENAME}}</nowiki>.<br/>
 
For further usage, see: {{wpd|template:commoncats/doc|commoncats/doc}}<!--
 
 
 
-->{{Left60|BG=#def|98|B=1|M=0|END=1}}
 
</noinclude>
 

Revision as of 11:52, 27 November 2008