Difference between revisions of "Template:Find sources multi/linkinfo"

From blackwiki
Jump to navigation Jump to search
imported>Mr. Stradivarius
(Add documentation)
imported>Elegie
(Use HTTPS for link to Thibbs' custom Google Search)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{<includeonly>safesubst:</includeonly>#switch: {{{1}}}
+
<noinclude><!--
 +
===========================================================================================
 +
This template provides information about the link subtemplates of {{find sources multi}}.
 +
Please stick to the example format shown below when updating the links. Also, if you are
 +
adding link number 21, please contact [[User:Mr. Stradivarius]] (or if he's not around,
 +
someone who knows advanced template coding) as some changes will need to be made to the
 +
template's back-end before your new data can be used.
 +
===========================================================================================
 +
--></noinclude>{{<includeonly>safesubst:</includeonly>#switch: {{{1}}}
  
 
  | <!-- linkn --> | <!-- ln --> | <!-- code --> = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | <!-- linkn --> | <!-- ln --> | <!-- code --> = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = <!-- the main link code; this must be the exact subpage name of the link template -->
+
     | code           = <!-- the main link code; this must be the exact subpage name of the link template -->
 
     | alias1          = <!-- alias1 to alias4 are aliases for the main link code -->
 
     | alias1          = <!-- alias1 to alias4 are aliases for the main link code -->
 
     | alias2          =  
 
     | alias2          =  
Line 16: Line 24:
  
 
  | link1 | l1 | g = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link1 | l1 | g = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = g
+
     | code           = g
 
     | alias1          = google
 
     | alias1          = google
 
     | alias2          =  
 
     | alias2          =  
Line 30: Line 38:
  
 
  | link2 | l2 | gnews = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link2 | l2 | gnews = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = gnews
+
     | code           = gnews
 
     | alias1          = gn
 
     | alias1          = gn
 
     | alias2          =  
 
     | alias2          =  
Line 40: Line 48:
 
     | shortcut2      = fsmulti/gn
 
     | shortcut2      = fsmulti/gn
 
     | shortcut3      =  
 
     | shortcut3      =  
     | notes          = Can be used with {{para|free|yes}} to return free results only.
+
     | notes          = Can be used with {{para|free|yes}} to return free results only. {{red|1=Google News search [//en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28miscellaneous%29&oldid=586050946#Google_news_archive_search.3F does not work] as of December 2013.}}
 
   }}
 
   }}
  
 
  | link3 | l3 | gbooks = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link3 | l3 | gbooks = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = gbooks
+
     | code           = gbooks
 
     | alias1          = gb
 
     | alias1          = gb
 
     | alias2          =  
 
     | alias2          =  
Line 58: Line 66:
  
 
  | link4 | l4 | gscholar = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link4 | l4 | gscholar = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = gscholar
+
     | code           = gscholar
 
     | alias1          = gs
 
     | alias1          = gs
 
     | alias2          =  
 
     | alias2          =  
Line 73: Line 81:
  
 
  | link5 | l5 | jstor = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link5 | l5 | jstor = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = jstor
+
     | code           = jstor
 
     | alias1          =  
 
     | alias1          =  
 
     | alias2          =  
 
     | alias2          =  
Line 87: Line 95:
  
 
  | link6 | l6 | gfreeimages = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link6 | l6 | gfreeimages = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = gfreeimages
+
     | code           = gfreeimages
 
     | alias1          = gfi
 
     | alias1          = gfi
 
     | alias2          =  
 
     | alias2          =  
Line 101: Line 109:
  
 
  | link7 | l7 | archive = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link7 | l7 | archive = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = archive
+
     | code           = archive
 
     | alias1          = ia
 
     | alias1          = ia
 
     | alias2          =  
 
     | alias2          =  
Line 115: Line 123:
  
 
  | link8 | l8 | bing = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link8 | l8 | bing = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = bing
+
     | code           = bing
 
     | alias1          = msbooks
 
     | alias1          = msbooks
 
     | alias2          = msacademic
 
     | alias2          = msacademic
Line 129: Line 137:
  
 
  | link9 | l9 | gnewsrecent = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link9 | l9 | gnewsrecent = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = gnewsrecent
+
     | code           = gnewsrecent
 
     | alias1          = gnr
 
     | alias1          = gnr
 
     | alias2          =  
 
     | alias2          =  
Line 143: Line 151:
  
 
  | link10 | l10 | nyt = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link10 | l10 | nyt = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = nyt
+
     | code           = nyt
 
     | alias1          = nytrecent
 
     | alias1          = nytrecent
 
     | alias2          = nytold
 
     | alias2          = nytold
Line 157: Line 165:
  
 
  | link11 | l11 | wrs = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link11 | l11 | wrs = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = wrs
+
     | code           = wrs
 
     | alias1          =  
 
     | alias1          =  
 
     | alias2          =  
 
     | alias2          =  
Line 171: Line 179:
  
 
  | link12 | l12 | ddg = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 
  | link12 | l12 | ddg = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
     | code | #default = ddg
+
     | code           = ddg
 
     | alias1          =  
 
     | alias1          =  
 
     | alias2          =  
 
     | alias2          =  
Line 180: Line 188:
 
     | shortcut1      = findddg
 
     | shortcut1      = findddg
 
     | shortcut2      = fsmulti/ddg
 
     | shortcut2      = fsmulti/ddg
 +
    | shortcut3      =
 +
    | notes          =
 +
  }}
 +
 +
| link13 | l13 | vgrs = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 +
    | code            = vgrs
 +
    | alias1          =
 +
    | alias2          =
 +
    | alias3          =
 +
    | alias4          =
 +
    | t_description  = This template provides a search link to [[User:Thibbs|Thibbs]]' [https://www.google.com/cse/home?cx=003516479746865699832:leawcwkqifq Google RS], a [[custom Google search engine]] that limits the search to sites listed in [[Wikipedia:WikiProject Video games/Sources]].
 +
    | se_description  = [[User:Thibbs|Thibbs]]' [http://www.google.com/cse/home?cx=003516479746865699832:leawcwkqifq Google RS], a [[custom Google search engine]] that limits the search to sites listed in [[Wikipedia:WikiProject Video games/Sources]].
 +
    | shortcut1      = findvgrs
 +
    | shortcut2      = fsmulti/vgrs
 +
    | shortcut3      =
 +
    | notes          =
 +
  }}
 +
 +
| link14 | l14 | gnewspapers = {{<includeonly>safesubst:</includeonly>#switch: {{{2}}}
 +
    | code            = gnewspapers
 +
    | alias1          = gnewspaper
 +
    | alias2          = gnp
 +
    | alias3          =
 +
    | alias4          =
 +
    | t_description  = This template provides a search link to Google's newspaper archive search.
 +
    | se_description  = Google Newspapers, a search of Google's digital archive of print newspapers.
 +
    | shortcut1      = findgnewspapers
 +
    | shortcut2      = fsmulti/gnewspapers
 
     | shortcut3      =  
 
     | shortcut3      =  
 
     | notes          =  
 
     | notes          =  
Line 193: Line 229:
 
The template takes two positional parameters.
 
The template takes two positional parameters.
  
* The first positional parameter specifies the subtemplate for which data is requested. It may take the value of the subpage name of the link template (e.g. <code>gnews</code>), a value of ''linkn'' (<code>link1</code>, <code>link2</code>, etc.), or its alias ''ln'' (<code>l1</code>, <code>l2</code>, etc.). If this parameter is not specified, or the value is not valid, the template outputs a null value.
+
* The first positional parameter specifies the subtemplate for which data is requested. It may take the value of the subpage name of the link template (e.g. <code>gnews</code>), a value of ''linkn'' (<code>link1</code>, <code>link2</code>, etc.), or its alias ''ln'' (<code>l1</code>, <code>l2</code>, etc.).
 
* The second positional parameter specifies what type of data is requested. It can take the following values:
 
* The second positional parameter specifies what type of data is requested. It can take the following values:
 
** <code>code</code> - The main link code. This is the same as the subpage name of the link template.
 
** <code>code</code> - The main link code. This is the same as the subpage name of the link template.
Line 207: Line 243:
 
** <code>notes</code> - Notes about of the link template.
 
** <code>notes</code> - Notes about of the link template.
  
If the first positional parameter has a valid value, but the second positional parameter is absent or has an invalid value, the template will output the main link code for the link template specified by the first positional parameter. If both the first and second positional parameters have valid values, but no data is found, the template will output a null value.
+
The template will only output data if the following three conditions are all true:
 +
# The first positional parameter has a valid value.
 +
# The second positional parameter has a valid value.
 +
# The data field specified by the first and second positional parameters is not empty.
 +
Otherwise, the template will return a null value.
  
 
== Examples ==
 
== Examples ==
Line 252: Line 292:
 
:produces:
 
:produces:
 
:{{find sources multi/linkinfo|nonexistentvalue|code}}
 
:{{find sources multi/linkinfo|nonexistentvalue|code}}
 +
 +
== Adding new entries ==
 +
 +
Adding new entries should be fairly self-explanatory - just keep the format the same as previous entries. However, if you are adding link number 21, please contact [[User:Mr. Stradivarius]] (or if he's not around, someone who knows advanced template coding) as some changes will need to be made to the template's back-end before your new data can be used.
  
 
}}
 
}}
 +
 +
[[Category:Find sources multi subtemplates|{{PAGENAME}}]]
 +
</noinclude>

Latest revision as of 23:07, 9 September 2016

Template documentation

This template stores data about the various search link subtemplates of {{find sources multi}}.

Usage

The template takes two positional parameters.

  • The first positional parameter specifies the subtemplate for which data is requested. It may take the value of the subpage name of the link template (e.g. gnews), a value of linkn (link1, link2, etc.), or its alias ln (l1, l2, etc.).
  • The second positional parameter specifies what type of data is requested. It can take the following values:
    • code - The main link code. This is the same as the subpage name of the link template.
    • alias1 - An alias for the main link code. The subpage of Template:Find sources multi with this value is a redirect to the link template.
    • alias2 - Another alias for the main link code.
    • alias3 - A third alias for the main link code.
    • alias4 - A fourth alias for the main link code.
    • t_description - A short description of the template.
    • se_description - A short description of the search engine that the template uses.
    • shortcut1 - A template shortcut for the link template.
    • shortcut2 - A second template shortcut for the link template.
    • shortcut3 - A third template shortcut for the link template.
    • notes - Notes about of the link template.

The template will only output data if the following three conditions are all true:

  1. The first positional parameter has a valid value.
  2. The second positional parameter has a valid value.
  3. The data field specified by the first and second positional parameters is not empty.

Otherwise, the template will return a null value.

Examples

Example 1
{{find sources multi/linkinfo|link1}}
produces:
Example 2
{{find sources multi/linkinfo|link1|code}}
produces:
g
Example 3
{{find sources multi/linkinfo|ddg|code}}
produces:
ddg
Example 4
{{find sources multi/linkinfo|link1|t_description}}
produces:
This template provides a search link to Google to help find sources for articles.
Example 5
{{find sources multi/linkinfo|ddg|se_description}}
produces:
DuckDuckGo, a search engine that uses information from crowd-sourced websites (such as Wikipedia) to provide its results.
Example 6
{{find sources multi/linkinfo|link1|nonexistentvalue}}
produces:
Example 7
{{find sources multi/linkinfo|nonexistentvalue|code}}
produces:

Adding new entries

Adding new entries should be fairly self-explanatory - just keep the format the same as previous entries. However, if you are adding link number 21, please contact User:Mr. Stradivarius (or if he's not around, someone who knows advanced template coding) as some changes will need to be made to the template's back-end before your new data can be used.