Wikipedia tool that expands bare references
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
messages
src
templates
tests/Reflinks
web
.bowerrc
.gitignore
.gitmodules
.travis.yml
LICENSE
Procfile
README.md
bower.json
composer.json
composer.lock
phpunit.xml.dist

README.md

reFill Build Status Coverage Status

reFill (formerly Reflinks) is a tool for Wikipedia that adds information (page title, work/website, author and publication date, etc.) to bare references semi-automatically. This is a rewrite of the closed-source original tool by Dispenser. A live version is running on WMF Labs, and there is also an experimental version, automatically pulled from the latest commit.

For backwards compatibility, the source code of the tool still refers to itself as "Reflinks". This is intentional.

Setting up

Setting up your reFill instance is fairly simple. You will need Composer to install the dependencies. First, clone this repo with:

git clone --recursive https://github.com/zhaofengli/refill.git

The complete source code of reFill will be cloned in the refill directory. cd into it, and:

php composer.phar install

This will fetch the required libraries for you. That's it, you now have a working copy of reFill! Fire up a server in web and start hacking!

Configuring

After setting up reFill, you may wish to add your local wiki for testing. To do so, create config/config.php and insert:

<?php
$config['wikis']['mywiki'] = array(
	"identifiers" => array( // A list of wikis of this type
		"wmflike", "baremw",
	),
	"api" => "http://localhost/%id%/api.php",
	"indexphp" => "http://localhost/%id%/index.php",
);

Now wmflike and baremw should appear on the main page, pointing at http://localhost/wmflike/ and http://localhost/baremw respectively.

For some simple customizations, use:

// Default edit summary for the generated edit
// Use %numfixed% to show how many references are fixed, and %numskipped% for skipped.
$config['summary'] = "Filled in %numfixed% bare reference(s) with reFill";

You can also add a banner to notify users about updates, as well as to extend the default footer. Implement global functions rlBanner() and/or rlFooter() which return the HTML code of the banner/footer.

There are more configuations available, please check out src/config.default.php for details.

Making it local

By default, the tool uses the wDiff library from Cacycle's user page on English Wikipedia. For easy offline development, you may want to download a copy of the script from the above link and store it in scripts/diff.js. This file is ignored by git. Beware though, you won't get updates of wDiff automatically in this way. To enable the local version, insert this into config/config.php:

$config['wdiff'] = "scripts/diff.js";

Unit tests

The program includes an incomplete set of unit tests under tests, which can be run with PHPUnit. Please help cover untested code by adding new tests.

Tool Labs-specific configurations

The Tool Labs version uses its own set of configurations, which reside on zhaofengli/refill-labsconf. You can require_once() the stable.php, test.php or citoid.php in the repo from your config.php to replicate the Tool Labs configurations on your local instance.

Reporting bugs

If you have found a bug, please report it on Wikipedia or create an issue on GitHub.

Contributing

Patches are always welcome! To contribute, simply create a fork of the repo, make your changes and submit a pull request. Thank you for your contributions!

Localisation of the tool is powered by Intuition and handled on translatewiki.net. To start translating the tool, please register at translatewiki.net and request to become a Translator. You can also submit your translations manually via GitHub pull requests or even on-wiki.

Licensing

reFill is licensed under the BSD 2-Clause License. See LICENSE for details.

External libraries

This program uses wDiff by Cacycle, released into public domain.

The Bootstrap theme used is Yeti.

Open Sans is a font by Steve Matteson.

Composer dependencies

You may want to run composer licenses to list the licenses of all Composer dependencies.

Bower dependencies

External links