Jump to content

Module:Citation/CS1/doc/Importing the Module:Citation/CS1 suite to your wiki

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MGA73 (talk | contribs) at 19:22, 31 January 2022 (Module:Citation/CS1/Identifiers: No modifications should be needed.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

According to Help:Citation Style 1: "Citation Style 1 (CS1) is a collection of reference citation templates that can be modified to create different styles for different referenced materials. Its purpose is to provide a set of default formats for references on Wikipedia. It includes a series of templates that in turn use Module:Citation/CS1."

As an example of a template see {{Cite web}}. The template is written in Lua and it calls Module:Citation/CS1 and a number of (sub)modules.

Basicly to make this work on another wiki you need

  1. To import/copy the 9 (sub)modules etc. listed on Module:Citation/CS1/doc
  2. One or more of the templates listed on Help:Citation_Style_1#Templates
  3. Modify the modules to work on your wiki

This page will try to tell you how to modify the module. Examples from the Danish Wikipedia is used but if/when other wikis also have examples please add them at the relevant place.

Module:Citation/CS1

Module:Citation/CS1 contains rendering and support functions. <Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.>

What to modify in ~CS1 on your wiki

<examples from Danish Wikipedia pending>

Module:Citation/CS1/Configuration

Module:Citation/CS1/Configuration contains translation tables; error and identifier handlers. <Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.>

What to modify in ~Configuration on your wiki

<examples from Danish Wikipedia pending>

Module:Citation/CS1/Whitelist

Module:Citation/CS1/Whitelist contains lists of active and deprecated CS1|2 parameters. <Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.>

What to modify in ~Whitelist on your wiki

<examples from Danish Wikipedia pending>

Module:Citation/CS1/Date validation

Module:Citation/CS1/Date validation contains date format validation functions. <Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.

For example I'm thinking it would be good to explain yMd and the other use of letters related to dates.>

What to modify in ~Date validation on your wiki

<examples from Danish Wikipedia pending>

Module:Citation/CS1/Identifiers

Module:Citation/CS1/Identifiers contains functions that support the named identifiers (ISBN, DOI, PMID, etc.). <Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.>

The module does a number of check to see if the identifiers are in a valid format.

Below is an example how it will look an |sbn= is incorrect (both during preview and when saved):

  • "Example of a datum as parameter". ISBN 123456. {{cite web}}: Check |isbn= value: length (help)

What to modify in ~Identifiers on your wiki

No modifications should be needed.

Module:Citation/CS1/Utilities

Module:Citation/CS1/Utilities contains common functions and tables. <Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.>

One of the things the module does is to convert a hyphen ( - or ‐ ) to a dash ( – ) if used in |pages= and |issue=. So instead of pp. 6–7 it makes the template show pp. 6-7.

What to modify in ~Utilities on your wiki

In Danish Wikipedia a hyphen is used instead of a dash. So to make the code work correctly the code have to be reversed.

It was done like this in the Danish sandbox: da:Special:Diff/11031253 (instead of just changing the code the original enwiki code was commented).

No other modifications should be needed.

Module:Citation/CS1/COinS

Module:Citation/CS1/COinS coontains functions that render a CS1|2 template's metadata used for COinS. <Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.>

What to modify in ~COinS on your wiki

No modifications should be needed.

Module:Citation/CS1/styles.css

Module:Citation/CS1/styles.css contains CSS styles applied to the CS1|2 templates.

<Please add more text. Remember it may be used by by someone that is not an expert in coding and not a native English user. So better to add extra info and help links than to assume reader will know/understand.>

Here you can define how it should look depending on wether websites are free, requires registration etc.

See more help/info on Template:Cite_web/doc#Subscription_or_registration_required. On how it looks.

What to modify in ~styles.css on your wiki

If you are happy with the same format as used on English Wikipedia no changes are needed. Danish Wikipedia have made no changes.

But if you for example want to change the red lock to some bills and coins you can change this line (# 59 when this text was written)

url(/media/wikipedia/commons/a/aa/Lock-red-alt-2.svg)

<Other examples of what to change and how?>

Module:Citation/CS1/Suggestions

Module:Citation/CS1/Suggestions contains lists that maps common erroneous parameter names to valid parameter names.

The lists are in the form ['incorrect'] = 'correct', like this:

['doibroken'] = 'doi-broken-date', -- This is an example of a parameter no longer used

['datum'] = 'date', -- This is an example of a parameter in another language (German)

['langauge'] = 'language', -- This is an example of a misspelling of the parameter

Below is an example how it will look if suggestions is used (both during preview and when saved):

What to modify in ~Suggestions on your wiki

It would be a good idea to add typical misspellings in your language here to make it easy for users to find the right name. If users often copy templates from another wiki to your wiki you could also add the foreign names to the list.

There are no examples from Danish Wikipedia because they have chosen to make parameters in a number of languages valid instead of using suggestions. So instead of adding for example German or Norwegian parameters to ~Suggestions they have been added to ~Whitelist. That makes it easy to copy cite templates from other wikis but it also have some issues.

See also

  • Lua - an page on how Lua works.
  • Lua patterns.
  • <link to relevant help pages>