Template:Userscript/doc: Difference between revisions

Content deleted Content added
No edit summary
Line 1:
{{Documentation subpage}}
{{intricate template}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
 
Line 7 ⟶ 8:
<code><nowiki>{{userscript |code= [.js address] |name= [script name] |doc= [documentation page address] }}</nowiki></code>
 
* The name will be linked to the documentation page, and the code page will be linked from a separate "(source)" link.
Either <code>|code</code>, ''' - or - ''' <code>|name</code> + <code>|doc</code>, are required. If you enter only name and doc without a code address, make sure the documentation page contains complete installation instructions, along with any page addresses required.
* The name will be linked to the documentation page.
* The code page will be linked from a separate "(source)" link.
 
* All parameters are optional. The template will attempt to fill in defaults for the missing information. Enter any explicit parameters to override defaults.
== Defaults ==
* '''Check to make sure the links are accurate after placing this template!''' If any defaults are inaccurate, enter the necessary parameters explicitly.
If you enter a code address and no name, the name defaults to the code page's name, without its path or ".js".
* You can make up any name for the <code>|name</code> parameter. It is just for display purposes, and does not need to match any actual page address.
* Example: Entering <code>|code=User:TheDJ/'''sharebox'''.js</code> defaults to "'''sharebox'''".
 
If you enter a code address and no doc, and a documentation page exists with a name that matches the code page name (without its .js extension), that documentation page will be linked by default.
=== Logic ===
* Example: Entering <code>|code='''User:TheDJ/Sharebox'''.js</code> will look for a page named '''User:TheDJ/Sharebox''', and if found, will be linked as the documentation page.
* The template will add .js to the documentation page name to get a default code page, or remove .js from the code page name to get a default documentation page.
You can override the default name and/or documentation page defaults by entering those parameters explicitly.
* If the default pages don't actually exist, they won't be linked (so no red links should be produced).
* If no name is entered, a default name will be produced from the code or doc page name (whichever is entered).
 
== Examples ==
All* parameters specified:Entering <code><nowiki>{{userscript|name=Sharebox|code='''User:TheDJ/shareboxSharebox'''.js|doc=</code> will look for a page named '''User:TheDJ/Sharebox}}</nowiki></code>''', and if found, will be linked as the documentation page.
* Example: Entering <code>|codedoc='''User:TheDJ/Sharebox'''.js</code> will look for a page named '''User:TheDJ/Sharebox<span style="color:red">.js</span>''', and if found, will be linked as the documentationcode page.
*Produces: {{userscript|name=Sharebox|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Sharebox}}
 
Name + doc specified: <code><nowiki>{{userscript|name=Sharebox|doc=User:TheDJ/Sharebox}}</nowiki></code>
*ProducesAll parameters specified: <code><nowiki>{{userscript|name=Shareboxsharebox!!!!!|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Shareboxsharebox}}</nowiki></code>
*Produces: {{userscript|name=Shareboxsharebox!!!!!|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Shareboxsharebox}}
Name + doc specified: <code><nowiki>{{userscript|name=Shareboxsharebox!!!!!|doc=User:TheDJ/Shareboxsharebox}}</nowiki></code>
*Produces: {{userscript|name=sharebox!!!!!|doc=User:TheDJ/sharebox}}
Code only: <code><nowiki>{{userscript|code=User:TheDJ/sharebox.js}}</nowiki></code>
*Produces: {{userscript|code=User:TheDJ/sharebox.js}}
Doc only: <code><nowiki>{{userscript|doc=User:TheDJ/sharebox}}</nowiki></code>
*Produces: {{userscript|doc=User:TheDJ/sharebox}}
 
== Additional parameter ==