frankgeerlings / refill

Wikipedia tool that expands bare references

Home Page:https://tools.wmflabs.org/fengtools/reflinks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reFill Build Status Code Climate 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 backward compatibility, the source code of the tool still refers to the tool as "Reflinks". This is intentional.

Setting up

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

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

The complete source code of reFill is now cloned in the reflinks directory. cd into it, and:

php composer.phar install
bower install

This will fetch the required libraries for you. That's it, you now have a working copy of reFill!

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 extend the default footer. Create rlBanner() and rlFooter() and return the content in them.

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 ran with PHPUnit. Please help cover untested code by adding new tests.

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!

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 of this program:

Bower dependencies of this program:

About

Wikipedia tool that expands bare references

https://tools.wmflabs.org/fengtools/reflinks/

License:BSD 2-Clause "Simplified" License


Languages

Language:PHP 86.2%Language:JavaScript 5.5%Language:HTML 5.0%Language:CSS 3.3%