According to : "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 ."
As an example of a template see . The template is written in Lua and it calls and a number of (sub)modules.
Basicly to make this work on another wiki you need
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.
contains rendering and support functions.
The module checks if has text like p. pp. etc. before the number. Some variants are accepted and some are not.
If you change the name of the submodules or uses sandboxes you have to change the path/name so the module knows where to look for the submodules. Danish Wikipedia have not changed the names but the Danish word for "Sandbox" is "Sandkasse" so that was updated with .
The module also tells that if some parameters like is only meant to be shown if or is used. In Danish Wikipedia the local name for the 2 parameters are and . So those 2 were added with . A few more should be added too.
As mentioned above the module checks if has text and if local wiki wants it can add local variants or remove the English variant.
contains translation tables; error and identifier handlers.
It has several sections among which are:
If editors are copying this Module to another wiki using a language other than English, then they should translate each of the values in the translation tables into that language.
Some translated text is directly visible in the text and other translated text is only relevant to make it possible to use a parameter in a local language.
The first bundle of changes in Danish Wikipedia was related to visible text (or at least that was the intent). So we translated namespaces, various text, month names etc. with these edits + and . The plan was to translate all in one diff but a few things was forgotten. Examples
['archived-dead'] = 'Archived from $1 on $2',
Was translated to:
['archived-dead'] = 'Arkiveret fra $1 $2',
['pp-prefix'] = "$1 pp. $2",
Was translated to:
['pp-prefix'] = "$1 s. $2",
-- Danish word for page is side and both page and pages is s. in short.
The second bundle on Danish Wikipedia was adding Danish parameter names etc. The changes was made with these edits + and . The plan was to translate all in one diff but a few things was forgotten. Examples
['Language'] = {'language', 'lang'},
Was translated to:
['Language'] = {'language', 'in', 'sprog', 'på', 'språk', 'langue', 'lang', 'Language'},
-- notice it contains old parameters from English Wikipedia, Danish variants and even a Swedish variant. Danish Wikipedia allowed other languages etc. to make it easy to copy templates to dawiki. Not sure it is something to recommend to other wikis to so.
The third bundle on Danish Wikipedia was translating error messages and error categories. The changes was made with this edit . Examples
err_apostrophe_markup = {
message = 'Italic or bold markup not allowed in: <nowiki><code class="cs1-code">|$1=
', -- $1 is parameter name
anchor = 'apostrophe_markup',
category = 'CS1 errors: markup',
hidden = false
},
was translated to
err_apostrophe_markup = {
message = 'Kursiv eller fed markup er ikke tilladt i: <nowiki><code class="cs1-code">|$1=
', -- $1 is parameter name -- This is the message shown on the page.
anchor = 'apostrophe_markup',
category = 'CS1-fejl: markup',
-- This is the category name the page will be categorized in.
hidden = false
},
The fourth bundle on Danish Wikipedia was to make it possible to have a "." (dot) in translated dates. In Danish the date "1 February 2022" would be "1. februar 2022". The change was made like this (ignore the changes next to "['yMd']" and the last comment).
The fifth bundle/change on Danish Wikipedia is whether you like to use redirects in identifiers, use local category names and to translate month-names. The changes are turned on with true/false. The changes was done like this .
Below is an example how it will look an is added:
Notice that the link on ISBN goes to ISBN (identifier) that is a redirect that leads to International Standard Book Number. English Wikipedia uses that to make it possible to separate pages where ISBN is used in the text with an wikilink and where the mentioning is in a ref.
contains lists of active and deprecated CS1|2 parameters.
This module contains a list of all parameters that knows about. Each parameter is assigned a state.
The basic_arguments
table is supported by all templates. The other tables are only used for some templates
If you add new parameters to your local wiki you should also add them to ~Whitelist.
In Danish Wikipedia Danish, Swedish, Norwegian was added with . So far they were added in a block and not sorted alphabetically. So far it has not given any problems.
However the list should be complete and Danish Wikipedia have not yet done a cleanup and made sure that there is a match between ~Configuration and ~Whitelist. That should be done.
At there is a notice on how to clean up such problems. Here are the commands:
=p.aliases
– returns the list of parameters and their associated meta parameter from the ~/Configuration module
=p.aliases_dups
– returns a list of parameters that appear in more than one meta parameter (not necessarily a bad thing depending on the version of the cs1|2 module suite)
=p.whitelist
– returns the list of parameters from the ~/Whitelist module
=p.alias_params_not_in_whitelist
– returns a list of parameters found in the ~/Configuration module but not found in the ~/Whitelist module
=p.wh_params_not_in_aliases
– returns a list of parameters found in the ~/Whitelist module but not found in the ~/Configuration module
contains date format validation functions.
The module understand dates like 1 February 2022 and seasons like spring, easter etc.
The module will try to understand the date and then test if it is a valid date.
Examples
Once a date is checked the module can reformat it if the template has provided the code for that
|df=ymd
The module uses identifier letters: 'd' (day), 'm' (month), 'a' (anchor year), 'y' (year); second day, month, year have a '2' suffix. When a month is written with digits it is named 'm' and when the month is written with letters it is named 'M'. Since days and years are always written with digits there is no 'D' or 'Y'.
So
['ymd'] =
2022-02-01
['Mdy'] =
February 1, 2022
['Md-Mdy'] =
January 20 – February 1, 2022
The first thing to be changes in Danish Wikipedia is that in Danish a "." (dot) is used in dates. So in Danish February 1, 2022 would be written as "1. februar 2022" (with a dot after the day and with a small letter in month name).
There is no pattern for Danish dates so
['d.My'] =
1. februar 2022
and other variants using "d."etc. have to be created. See (ignore the comments next to "['yMd']").
The diff above also contain a modification of the way hyphen and (n)dash is used. Danish Wikipedia does it differently than on English Wikipedia. However, the code added on Danish Wikipedi changes the hyphen/dash correctly but it leaves a message that something was changed even when it was not changed. So the code has to be changed.
The second thing to change is that c. is written as ca. and nd (no date) would be u.å. (uden år). Changed with this diff .
contains functions that support the named identifiers (ISBN, DOI, PMID, etc.).
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 is incorrect (both during preview and when saved):
No modifications should be needed.
contains common functions and tables.
One of the things the module does is to convert a hyphen (- or ‐) to a dash (–) if used in and . So instead of pp. 6–7 it makes the template show pp. 6-7.
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: (instead of just changing the code the original enwiki code was commented).
No other modifications should be needed.
coontains functions that render a CS1|2 template's metadata used for COinS.
No modifications should be needed.
contains CSS styles applied to the CS1|2 templates.
Here you can define how it should look depending on wether websites are free, requires registration etc.
See more help/info on . On how it looks.
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(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)
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):
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.
Your wiki should have categories like and subcategories for the pages with errors. Each category should have a text to help users know what the error means and how it can be fixed. The relevant help can also be on a help page like .
Do not forget to add interlanguage links so users can jump to English Wikipedia and look for help too.