Wiki edits with wikian

| | [C]olor

Want to be a happier Wikipedian? Then you want Wikian, which lets you edit Wikipedia pages locally, with your favorite text editor. To install it:

$ gem install wikian

To use it create a Wikipedia account, then define and export the WIKI_USER and SECRET_WIKI_PASS variables in your .bashrc:

export WIKI_USER='Example_wiki_user_name'
export SECRET_WIKI_PASS='example_wiki_password'

Wikian works across Wikimedia sites and follows the file naming convention:

<article_name>.<site>.wiki

Some valid file names:

Spider_Man.en.wikipedia.org.wiki
Spider_Man.es.wikipedia.org.wiki
excelsior.es.wiktionary.org.wiki
User:Example_User.www.mediawiki.org.wiki

Examples

To append some text to your Wiktionary user profile:

$ cat User:$WIKI_USER.en.wikitionary.org.wiki

== Last section==
testing

$ wi post -a User:$WIKI_USER.en.wikitionary.org.wiki
Article uploaded

To get an article's wikitext:

$ wi get -t
Creating template wiki.yml

$ wi g https://en.wikipedia.org/wiki/Wikipedia:Sandbox
Writing to Wikipedia:Sandbox.en.wikipedia.org.json
Writing to Wikipedia:Sandbox.en.wikipedia.org.wiki

Then edit the article and upload it:

$ wi post Wikipedia:Sandbox.en.wikipedia.org.wiki
Article uploaded

To append wikitext to section 2:

$ wi post -s 2 Wikipedia:Sandbox.en.wikipedia.org.wiki
Article uploaded

To search for a term in Wikipedia:

$ wi s Mr. Fixit
Writing to Mr. Fixit.json

To get your last 10 Wikipedia contributions:

$ wi c
Writing to User:Example_User.contributions.en.wikipedia.org.json

To tune the request parameters create a config file with any of these:

$ wi g -t

$ wi c -t

$ wi s -t

Vim users should try mediawiki.vim which adds syntax highlighting and abbreviations for wikitext files.