Jump to content

User:Frietjes/templatecompare

From Wikipedia, the free encyclopedia

Why does this script exist?

[edit]

It may be useful to compare the parameters used by two (or three) different templates. Note that this only works for templates which explicitly use template arguments, and not for LUA-based templates where the template parameters are passed implicitly.

How to install

[edit]
  1. Open your common.js script page in edit mode.
  2. Paste the following line:
    importScript('User:Frietjes/templatecompare.js'); // [[User:Frietjes/templatecompare]]
    
  3. Reload the script page (press ctrl+R or the equivalent for your browser).

To install on another Wikipedia, use

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Frietjes/templatecompare.js&action=raw&ctype=text/javascript');

How to use

[edit]
  1. Navigate to Special:TemplateCompare. The page should briefly say "No such special page" before changing to "Template compare tool". If continues to say "No such special page", something went wrong.
  2. Add the names of two (or three) templates in the top text window, with each template on a separate line and including the Template: prefix.
  3. Press the "Compare" button
    • You will see a pop-up alert when the script finishes processing each template
    • You will see a pop-up alert with the script finishes processing the last template
  4. A table showing the comparison of parameters will show below the "Compare" button along with cut-and-paste wikitext for the table.

Caveats

[edit]

If you get a "Did not finish processing" warning, report this on the talk page and ping Frietjes so it can be fixed (or a reason can be given for not fixing it).

Do not assume that the list of parameters generated by this tool is a full list of working, supported parameters for a given template. This tool looks for instances of parameters used in the template. A parameter that is used may not actually be supported by the template; the parameter name may exist only in template code that checks for the existence of deprecated or no-longer-supported parameters, for example.