Difference between revisions of "Template:Display class icon"

From Wikispooks
Jump to navigation Jump to search
(fix)
(better fallback icon for pages without templates (namespace aware))
Line 1: Line 1:
<noinclude>[[category:Semantic Utility Templates]]'''This is a semantic utility template to return the plaintext name of an image corresponding to the argument's [[Property:Has objectClass|Has objectClass]] property.'''</noinclude>{{#if: {{{1|}}}|File:{{#show: {{{1}}}|?Has objectClass2}}.png}}
+
<noinclude>[[category:Semantic Utility Templates]]'''This is a semantic utility template to return the plaintext name of an icon for the page.'''<br/>
 +
The logic is:
 +
* If the page has a [[Property:Has objectClass|Has objectClass]] property, then use that.
 +
* Else look at the namespace, and use that.</noinclude><includeonly>{{#if: {{{1|}}}|File:{{#if: {{#show: {{{1}}}|Has objectClass2}}|{{#show: {{{1}}}|?Has objectClass2}}.png|{{#switch: {{NAMESPACE:{{{1|}}}}}
 +
| =Main.png
 +
| Talk = Talk.png
 +
| User = User.png
 +
| User talk =User_talk.png
 +
| Project =WikispooksPage.png
 +
| Project talk=WikispooksPage_talk.png
 +
| File = File.png
 +
| File talk=File_talk.png
 +
| MediaWiki = Property.png
 +
| MediaWiki talk = Property.png
 +
| Help = Help.png
 +
| Help talk=Help_png.png
 +
| Category =Category.png
 +
| Category talk=Category_talk.png
 +
| Template =Template.png
 +
| Template talk=Template_talk.png
 +
| Property = Property.png
 +
| Property talk = Property_talk.png
 +
| Type
 +
| Type talk
 +
| Form
 +
| Form talk
 +
| Concept
 +
| Concept talk = Template.png
 +
| Document = Document.png
 +
| Document talk = Document_talk.png
 +
| Wikipedia = Property.png
 +
| Wikipedia talk = Property.png
 +
| Test = Test.png
 +
| Test talk = Test_talk.png
 +
| Widget
 +
| Widget talk
 +
| Layer
 +
| Layer talk
 +
| Module
 +
| Module talk = Template.png
 +
}}}}}}</includeonly>

Revision as of 18:02, 15 July 2015

This is a semantic utility template to return the plaintext name of an icon for the page.
The logic is:

  • If the page has a Has objectClass property, then use that.
  • Else look at the namespace, and use that.