Skip to content

Commit

Permalink
Move content from wiki pages to markdown files (#5194)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwiernik authored Feb 3, 2021
1 parent 018304c commit e0e977c
Show file tree
Hide file tree
Showing 6 changed files with 698 additions and 7 deletions.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ The CSL style repository is the central location on the web for collecting and m
Software products like Zotero, Mendeley, and Papers all draw their styles from our repository.

We welcome style submissions (and corrections), and are particularly interested in styles for journals and published style guides.
If you wish to submit a different type of style, please first check our [Criteria for Accepting Styles](https://github.com/citation-style-language/styles/wiki/Criteria-for-Accepting-Styles).
If you wish to submit a different type of style, please first check our [Criteria for Accepting Styles](https://github.com/citation-style-language/styles/blob/master/README.md#criteria-for-inclusion).

To submit a style, please follow the following steps (for locale files, follow the same steps in the [locales](https://github.com/citation-style-language/locales) repository):

#### 1. Check that your style meets all our [style requirements](https://github.com/citation-style-language/styles/wiki/Style-Requirements)
#### 1. Check that your style meets all our [style requirements](https://github.com/citation-style-language/styles/blob/master/STYLE_REQUIREMENTS.md)

#### 2. [Validate](https://validator.citationstyles.org/) your style against the CSL schema, and correct any validation errors

Expand All @@ -20,15 +20,15 @@ To start, create a GitHub account and sign in.
##### 3a. Submitting a new style

1. Visit https://github.com/citation-style-language/styles and click the "Create new file" button.
When submitting a [dependent style](https://github.com/citation-style-language/styles/wiki/Requesting-Styles#dependent-styles), first navigate to the [dependent](https://github.com/citation-style-language/styles/tree/master/dependent) subdirectory.
When submitting a [dependent style](https://github.com/citation-style-language/styles/blob/master/REQUESTING.md#dependent-styles), first navigate to the [dependent](https://github.com/citation-style-language/styles/tree/master/dependent) subdirectory.
2. Type in the file name of the style in the "Name your file..." text field at the top.
Don't forget to add the ".csl" extension (e.g., "journal-of-results.csl" instead of just "journal-of-results")!
3. Paste the style code into the "<> Edit new file" tab below.
4. Click the "Propose new file" button.
5. In the next window, click the "Create pull request" button.
Describe the changes you've made, and click the "Create pull request" button once more.

(for more help, see GitHub's instructions on [Creating new files](https://help.github.com/articles/creating-new-files))
(For more help, see GitHub's instructions on [Creating new files](https://help.github.com/articles/creating-new-files).)

##### 3b. Submitting changes to an existing style

Expand All @@ -41,7 +41,7 @@ To start, create a GitHub account and sign in.
5. In the next window, click the "Create pull request" button.
Describe the changes you've made, and click the "Create pull request" button once more.

(for more help, see GitHub's instructions on [Editing files in another user's repository](https://help.github.com/articles/editing-files-in-another-user-s-repository))
(For more help, see GitHub's instructions on [Editing files in another user's repository](https://help.github.com/articles/editing-files-in-another-user-s-repository).)

Instead of relying solely on the GitHub website, you can also use a git client, such as [GitHub Desktop](https://desktop.github.com/) for Mac and Windows, or [SmartGit](http://www.syntevo.com/smartgit/).
When using a client, [fork](https://help.github.com/articles/fork-a-repo/) the [style repository](https://github.com/citation-style-language/styles), create a branch off of "master", commit your changes, and then create a [pull request](https://help.github.com/articles/using-pull-requests/).
Expand Down
194 changes: 194 additions & 0 deletions QUALITY_CONTROL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# CSL Style Quality Control

We love the CSL style repository, and wish to keep it in tip-top shape.
Because we have thousands of styles and hundreds of contributors, we rely heavily on automated quality control and periodic maintenance.
This page describes our best practices.

## Forks and Pull Requests

The "master" branch of the style repository stores the styles for the most recent CSL release.
To allow changes to be reviewed before they end up in "master", we try to avoid committing changes directly to "master" as much as possible.

Instead, we rely heavily on forks, branches, and pull requests.
Only our maintainers have direct commit access to the repository.
Contributors can fork the repository, make their changes in their copy of the repository (ideally in a branch), and create a pull request.
This allows us to review your changes, and merge them into the official repository.

## Travis CI

[Travis CI](https://travis-ci.org/) is a Continuous Integration service that runs a series of checks on every commit made to the "master" branch, and on every commit in incoming pull requests.
Each Travis test run is called a "build".

If Travis doesn't detect any problems in your pull request, it will report that the build passed.
Otherwise the build fails, and you will find a link to the build report that shows which tests failed.
Add a new commit to your pull request, and Travis will start a new build and run all tests again.
Only pull requests that pass all the Travis tests can be accepted into the repository.

The tests are stored in the style repository itself.
Among other things, they make sure that:

* there are no styles with the same file name, title, or ISSN
* all styles are named correctly, and have style IDs and "self" links matching the file names
* all styles validate against the CSL schema
* all styles have the correct license
* all "template" and "independent-parent" links point to existing independent styles
* all style macros are defined and used
* the root directory contains all independent styles, and the "dependent" subdirectory all dependent styles

It is possible to [run the tests locally](#Test-Environment) on your computer, which is especially useful to frequent contributors.

## Indentation, Ordering, and Escaping

To keep styles consistently formatted, we manually run a [Python script](https://github.com/citation-style-language/utilities/blob/master/csl-reindenting-and-info-reordering.py) every few weeks or so.
The script does the following:

* reindent the XML code, using 2 spaces per indentation level
* put the elements in the `</info>` section in a standard order
* escape characters that are hard to identify by eye (such as the various dashes and spaces)

## Extra-strict Validation

Every so often, we also manually run a [bash script](https://github.com/citation-style-language/utilities/blob/master/style-qc.sh) that validates the styles against a [customized CSL schema](https://github.com/citation-style-language/schema/blob/master/csl-repository.rnc) that is extra strict, and includes requirements specific to our repository.

## Repairing Problematic Code Patterns

_Here we keep track of problematic CSL code patterns we have observed in the wild, and provide information on how they can be detected and corrected._

### Superscript on citation-number instead of whole citation

In numeric styles where superscripted numbers are used, it's important to superscript the entire citation so that any punctuation is also superscripted, and e.g. use:

```xml
<layout delimiter="," vertical-align="sup">
<text variable="citation-number"/>
</layout>
```

instead of:

```xml
<layout delimiter=",">
<text variable="citation-number" vertical-align="sup"/>
</layout>
```

**History**

2016-10: [#2256](https://github.com/citation-style-language/styles/issues/2256) : 47 hits

### Spaces if second field is flushed

If the second field in the bibliography is flushed, then it should not have a space as a prefix.

**Search patterns**

<bibliography[^>]*second-field-align="flush"[^>]*>.*<layout[^>]*>\r\n\s*<text variable="citation-number"[^>]*/>\r\n\s*<text[^>]*prefix=" "

**Fix**

Delete `prefix=" "` by hand, but it seems possible to automatically delete the last prefix attribute in this pattern.
No, critical case found.
Moreover, no case with a different prefix beginning with a space found.

**History**

2015-01: [#1349](https://github.com/citation-style-language/styles/pull/1349) and [#1346](https://github.com/citation-style-language/styles/pull/1346) : ca. 39 matches


### Adjacent spaces from suffix and prefix

**Search Pattern**

<[^/>]*suffix="[^"/>]* "[^/>]*/?>\s*\r\n\s*<[^/>]*prefix=" [^"/>]*"[^/>]*/?>

**Fix**

Manually look at every case and either
(i) delete the space in suffix,
(ii) delete the space in the prefix,
(iii) use a group with `delimiter=" "`, or
(iv) rewritte some parts of the style.
This can take some time in order to not change the punctation.
It may be possible to restrict the search pattern more, in order to obtain smaller sets of the same/similar replacements.

**History**

2015-01: [#1301](https://github.com/citation-style-language/styles/issues/1301) : ca. 300 hits in 230 files


## Test Environment

[![Build Status](https://secure.travis-ci.org/citation-style-language/styles.png?branch=master)](http://travis-ci.org/citation-style-language/styles)

To maintain the quality of the styles in the official repository, we have set up an environment for quality-control testing in the repository's [master branch](https://github.com/citation-style-language/styles/tree/master).
After every commit to this branch, the tests will be executed on [Travis CI](http://travis-ci.org/#!/citation-style-language/styles) in order to alert us should new (or newly updated) styles break any of the quality control rules.

If you are a style author, maintainer or would like to contribute to an existing style, you are advised to install the test environment on your computer in order to run the tests while you're working on a style and to make sure all tests are still passing before you commit any changes to the repository.

### Installation

Before installing the test environment, please make sure that Ruby is available on you computer.
If Ruby is not installed, please follow the [official instructions](http://www.ruby-lang.org/en/downloads/) on how to install it on your operating-system.
The test environment should work on all current releases of Ruby and is backwards compatible with version 1.8.7.
Some of our tests involve RelaxNG schema validation; these tests are based on [libxml](http://www.xmlsoft.org/) via [Nokogiri](http://nokogiri.org/).
Please see these [operating-system specific instructions](http://nokogiri.org/tutorials/installing_nokogiri.html) if you have any problems installing the test setup because of these requirements.

**Note: it seems in Ruby 1.8.7 you can get some failures with [] and {} comparison failing**

Once Ruby is installed on your computer, it is easy to setup the test environment.
First, clone into the official repository (if you have previously cloned the repository you can skip this step):

$ git clone https://github.com/citation-style-language/styles.git
$ cd styles

You should work directly on the master branch.

Next, we will install all requirements using [Bundler](http://gembundler.com/) (run `[sudo] gem install bundler` to make sure you have the latest version installed).
Please note that depending on how Ruby is installed on your system you might need administrator privileges to install Ruby Gems, therefore, we have prefixed the commands with an optional `[sudo]`:

$ [sudo] bundle install

### Usage

Once your bundle is installed there are two ways to run the tests.
You can use rake:

$ rake

Or you can run the tests using `rspec`:

$ bundle exec rspec spec

The latter is useful if you would like to pass special parameters.
For example, if your Terminal does not support colors, the output may be illegible.
In this case try running the tests with:

$ bundle exec rspec spec --no-color

Or, if you would like a more verbose output of all tests, you can switch to a different format, for example:

$ bundle exec rspec spec --format documentation

Will print a summary of all tests for each style.

#### Testing styles in isolation

With the growing number of styles and tests available in the repository the number of test cases to execute has risen into the range of 100,000 – for obvious reasons, execution may take up to a few minutes on your computer.
In order to allow for quicker feedback-loops when working on styles, you can set the environment variable CSL_TEST to control which styles to include in the test.

The CSL_TEST variable may contain a list of file names (separated by spaces) of styles to include;
please note that the name should be the file's full base-name including the '.csl' extension.
However, for additional flexibility, you can include regular expression wildcards as well.

$ CSL_TEST="apa.csl vancouver.csl" bundle exec rspec spec

$ CSL_TEST="chicago.*" bundle exec rspec spec

Finally, you can set the CSL_TEST variable to the special value 'git';
by doing that you can limit the styles to be included in the test run to those styles which are currently marked as modified in your local git repository.

$ CSL_TEST="git" bundle exec rspec spec

#### Windows

For colored output of the test results on Windows, [see this guide](http://softkube.com/blog/ansi-command-line-colors-under-windows/).
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The primary components of the CSL ecosystem are:
This README describes our official curated repository of CSL styles, hosted at https://github.com/citation-style-language/styles/.
CSL locale files, which provide default localization data for CSL styles (such as translations and date formats), can be found at https://github.com/citation-style-language/locales.

For more information about CSL and CSL styles, check out https://citationstyles.org/ and the [repository wiki](https://github.com/citation-style-language/styles/wiki).
For more information about CSL and CSL styles, check out https://citationstyles.org/ and the information files in this repository ([Style Requirements](https://github.com/citation-style-language/styles/blob/master/STYLE_REQUIREMENTS.md), [Style Development](https://github.com/citation-style-language/styles/blob/master/STYLE_DEVELOPMENT.md), [Requesting Styles](https://github.com/citation-style-language/styles/blob/master/REQUESTING.md), [Contributing Styles](https://github.com/citation-style-language/styles/blob/master/CONTRIBUTING.md), and [Quality Control](https://github.com/citation-style-language/styles/blob/master/QUALITY_CONTROL.md)).

Criteria for inclusion
----------------------
Expand All @@ -29,7 +29,7 @@ The official CSL style repository is the only repository of its kind, is used by
The popularity of this repository is in large part due to its crowd-sourced nature, and, we believe, also due to our careful curation.
While we evaluate style submissions on a case-by-case basis, we generally use the following criteria for inclusion in the CSL style repository:

* Styles must be of sufficient quality and meet our [Style Requirements](https://github.com/citation-style-language/styles/wiki/Style-Requirements).
* Styles must be of sufficient quality and meet our [style requirements](https://github.com/citation-style-language/styles/blob/master/STYLE_REQUIREMENTS.md).
While we may be able to assist with this, its ultimately the submitter's responsibility to provide a style that meets our standards.
* Styles should be based on an official style guide (and link to the style guide in online or printed form).
* Styles should be of interest to a wider audience.
Expand Down
Loading

0 comments on commit e0e977c

Please sign in to comment.