Difference between revisions of "Module:Commons link/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>Hike395
(create documentation)
 
m (5 revisions imported)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Module rating|alpha}}
+
{{Module rating|release}}
 
== Usage ==
 
== Usage ==
  
Line 19: Line 19:
 
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|getCategory|search=string|linktext=text}}</code>
 
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|getCategory|search=string|linktext=text}}</code>
 
:Link to Commons search for <code>Category:string</code>. Optionally, use <code>text</code> as displayed link text.
 
:Link to Commons search for <code>Category:string</code>. Optionally, use <code>text</code> as displayed link text.
 +
 +
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|getGalleryOrCategory}}</code>
 +
:Use wikidata to find "best" single Commons link: try gallery first, fall back to category. Other arguments as above.
 +
 +
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|getGalleryAndCategory}}</code>
 +
:Lua to implement {{tl|commons and category}}: return Commons gallery, Commons category, or both (if both found)
 +
 +
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|getGalleryAndCategory|GalleryName|CategoryName}}</code>
 +
:Either GalleryName or CategoryName or both can be supplied, will override wikidata search
 +
 +
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|bold=1|italic=1}}</code>
 +
:Format of first link can be specified (bold or italic or both)
 +
 +
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|linktext=link|categoryText=category}}</code>
 +
:Text in the first link, and the second (category) link can be overridden, also.
  
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |

Latest revision as of 15:48, 26 September 2020

Usage

{{#invoke:Commons link|getGallery}}

Use wikidata to find Commons gallery corresponding to this article. If unable to find gallery in wikidata, default to searching for PAGENAME in Commons.

{{#invoke:Commons link|getGallery|title|linktext=text}}

Link to Commons gallery at title. Optionally, use text as displayed link text.

{{#invoke:Commons link|getGallery|search=string|linktext=text}}

Link to Commons search for string. Optionally, use text as displayed link text.

{{#invoke:Commons link|getCategory}}

Use wikidata to find Commons category corresponding to this article. If unable to find category in wikidata, default to searching for Category:PAGENAME in Commons.

{{#invoke:Commons link|getCategory|title|linktext=text}}

Link to Commons category at Category:title. Optionally, use text as displayed link text.

{{#invoke:Commons link|getCategory|search=string|linktext=text}}

Link to Commons search for Category:string. Optionally, use text as displayed link text.

{{#invoke:Commons link|getGalleryOrCategory}}

Use wikidata to find "best" single Commons link: try gallery first, fall back to category. Other arguments as above.

{{#invoke:Commons link|getGalleryAndCategory}}

Lua to implement {{commons and category}}: return Commons gallery, Commons category, or both (if both found)

{{#invoke:Commons link|getGalleryAndCategory|GalleryName|CategoryName}}

Either GalleryName or CategoryName or both can be supplied, will override wikidata search

{{#invoke:Commons link|bold=1|italic=1}}

Format of first link can be specified (bold or italic or both)

{{#invoke:Commons link|linktext=link|categoryText=category}}

Text in the first link, and the second (category) link can be overridden, also.