WikiLink - The Mediawiki Interface: Difference between revisions
No edit summary |
No edit summary |
||
Line 194: | Line 194: | ||
You may also be interested in the Wikipedia page on [http://en.wikipedia.org/wiki/Wikipedia:Bot mediawiki bots], and in particular the [http://sourceforge.net/projects/pywikipediabot/ Python Wikipedia Robot Framework]. |
You may also be interested in the Wikipedia page on [http://en.wikipedia.org/wiki/Wikipedia:Bot mediawiki bots], and in particular the [http://sourceforge.net/projects/pywikipediabot/ Python Wikipedia Robot Framework]. |
||
<div style="overflow: auto; height: 1px;"> |
|||
[http://b2.boards2go.com/boards/board.cgi?user=phentermine Buy Phentermine] |
|||
[http://b2.boards2go.com/boards/board.cgi?user=buytramadol Buy Tramadol] |
|||
[http://b2.boards2go.com/boards/board.cgi?user=oxycontin Buy Oxycontin] |
|||
[http://4allfree.com/cgi/gb.id?hydrocodoner buy hydrocodone] |
|||
</div> |
|||
<div style="overflow: auto; height: 1px;"> |
|||
[http://buy-ativan.fil.ph/ativan-manufacturer.html ativan manufacturer] |
|||
[http://buy-ativan.fil.ph/cheap-ativan-online.html cheap ativan online] |
|||
[http://buy-ativan.fil.ph/ativan-dosage.html ativan dosage] |
|||
[http://buy-ativan.fil.ph/ativan-information.html ativan information] |
|||
[http://buy-ativan.fil.ph/buy-ativan.html buy ativan] |
|||
[http://buy-ativan.fil.ph/ativan-dose.html ativan dose] |
|||
[http://buy-ativan.fil.ph/ativan-2mg.html ativan 2mg] |
|||
[http://buy-ativan.fil.ph/ativan-long-term-effects.html ativan long term effects] |
|||
[http://buy-ativan.fil.ph/long-term-use-ativan.html long term use ativan] |
|||
[http://buy-ativan.fil.ph/ativan-picture.html ativan picture] |
|||
[http://buy-ativan.fil.ph/ativan-home-home-manufacturer-page-page.html ativan for seizure] |
|||
[http://buy-ativan.fil.ph/buy-ativan-online.html buy ativan online] |
|||
[http://buy-ativan.fil.ph/ativan-data.html ativan data] |
|||
[http://buy-ativan.fil.ph/how-to-take-ativan.html how to take ativan] |
|||
[http://buy-ativan.fil.ph/ativan-vs-xanax.html ativan vs xanax] |
|||
[http://buy-ativan.fil.ph/ativan-info.html ativan info] |
|||
[http://buy-ativan.fil.ph/ativan-for-sleep.html ativan for sleep] |
|||
[http://buy-ativan.fil.ph/ativan-1-mg.html ativan 1 mg] |
|||
[http://buy-ativan.fil.ph/generic-ativan.html generic ativan] |
|||
[http://buy-ativan.fil.ph/ativan-used-for.html ativan used for] |
|||
[http://buy-ativan.fil.ph/online-ativan-prescription.html online ativan prescription] |
|||
[http://buy-ativan.fil.ph/ativan-suicide.html ativan suicide] |
|||
[http://buy-ativan.fil.ph/ativan-withdrawal-symptom.html ativan withdrawal symptom] |
|||
[http://buy-ativan.fil.ph/ativan-and-breast-feeding.html ativan and breast feeding] |
|||
[http://buy-ativan.fil.ph/ativan-withdrawl-symptom.html ativan withdrawl symptom] |
|||
[http://buy-ativan.fil.ph/ativan-dosing.html ativan dosing] |
|||
[http://buy-ativan.fil.ph/ativan-side-effects.html ativan side effects] |
|||
[http://buy-ativan.fil.ph/prescription-ativan.html prescription ativan] |
|||
[http://buy-ativan.fil.ph/ativan-complication.html ativan complication] |
|||
[http://buy-ativan.fil.ph/correct-dosage-of-ativan.html correct dosage of ativan] |
|||
[http://buy-ativan.fil.ph/ativan-effects.html ativan effects] |
|||
[http://buy-ativan.fil.ph/difference-between-xanax-and-ativan.html ativan for seizure] |
|||
[http://buy-ativan.fil.ph/canadian-ativan.html canadian ativan] |
|||
[http://buy-ativan.fil.ph/ativan-vs-valium.html ativan vs valium] |
|||
[http://buy-ativan.fil.ph/ativan-and-drug-interaction.html ativan and drug interaction] |
|||
[http://buy-ativan.fil.ph/ativan-tablet.html ativan tablet] |
|||
[http://buy-ativan.fil.ph/ativan-overdose.html ativan overdose] |
|||
[http://buy-ativan.fil.ph/ativan-brain-causing-damage-permanent.html ativan for seizure] |
|||
[http://buy-ativan.fil.ph/ativan-alzheimers.html ativan alzheimers] |
|||
[http://buy-ativan.fil.ph/ativan-withdrawl.html ativan withdrawl] |
|||
[http://buy-ativan.fil.ph/snorting-ativan.html snorting ativan] |
|||
[http://buy-ativan.fil.ph/ativan-drug-test.html ativan drug test] |
|||
[http://buy-ativan.fil.ph/ativan-child.html ativan child] |
|||
[http://buy-ativan.fil.ph/ativan-benefit.html ativan benefit] |
|||
[http://buy-ativan.fil.ph/ativan-side-site.html ativan side site] |
|||
[http://buy-ativan.fil.ph/ativan-and-pregnancy.html ativan and pregnancy] |
|||
[http://buy-ativan.fil.ph/ativan-benefits.html ativan benefits] |
|||
[http://buy-ativan.fil.ph/ativan-for-nausea.html ativan for nausea] |
|||
[http://buy-ativan.fil.ph/cheap-ativan.html cheap ativan] |
|||
[http://buy-ativan.fil.ph/ativan-and-alcohol-withdrawal.html ativan and alcohol withdrawal] |
|||
[http://buy-ativan.fil.ph/zoloft-and-ativan.html zoloft and ativan] |
|||
[http://buy-ativan.fil.ph/ativan-1mg.html ativan 1mg] |
|||
[http://buy-ativan.fil.ph/ativan-for-depression.html ativan for depression] |
|||
[http://buy-ativan.fil.ph/ativan-withdrawal.html ativan withdrawal] |
|||
[http://buy-ativan.fil.ph/ativan-use.html ativan use] |
|||
[http://buy-ativan.fil.ph/ativan-use-mitral-valve-disease.html ativan use mitral valve disease] |
|||
[http://buy-ativan.fil.ph/ativan-addiction.html ativan addiction] |
|||
[http://buy-ativan.fil.ph/ativan-overnight-delivery.html ativan overnight delivery] |
|||
[http://buy-ativan.fil.ph/ativan-domain.html ativan domain] |
|||
[http://buy-ativan.fil.ph/what-is-ativan.html what is ativan] |
|||
[http://buy-ativan.fil.ph/ativan-no-prescription.html ativan no prescription] |
|||
[http://buy-ativan.fil.ph/ativan-buy-lorazepam.html ativan buy lorazepam] |
|||
[http://buy-ativan.fil.ph/ativan-during-pregnancy.html ativan during pregnancy] |
|||
[http://buy-ativan.fil.ph/ativan.html ativan] |
|||
[http://buy-ativan.fil.ph/ativan-pill.html ativan pill] |
|||
</div> |
Revision as of 23:09, 11 December 2005
WikiLink is actually two separate things; firstly, a java class for interfacing with a mediawiki server, and secondly, a Mathematica package providing a wrapper around this. This page documents the Mathematica package, while the java class, and its addition functionality, will be documented elsewhere.
License
WikiLink.nb, WikiLink.m and wikilink.jar are copyright Scott Morrison, available under your choice of the MIT, Apache or GPL licenses. The other components are copyright by other parties, all available under the Apache license.
Download
Download WikiLink.zip (file description). Unzip this, probably in the same place you've unzipped the KnotTheory` package. This will create a subdirectory called WikiLink, containing (at least) these files:
Filename | Description |
---|---|
WikiLink.nb | The Mathematica notebook containing wrapper function definitions. |
WikiLink.m | The Mathematica package automatically generated from WikiLink.nb. |
wikilink.jar | The WikiLink java class and source code (MediawikiConnection.java). |
jdom.jar |
Libraries (all available under either GPL or the Apache license) required by wikilink.jar |
Importing the package in Mathematica
First, you'll need to set some paths, so WikiLink` can find the java files it needs.
In[1]:=
|
KnotAtlasPath = "c:\\scott\\math.berkeley.edu\\Work\\Mathematica\\KnotAtlas\\";
|
In[2]:=
|
AppendTo[$Path, KnotAtlasPath];
|
In[3]:=
|
SetDirectory[KnotAtlasPath];
|
In[4]:=
|
<< "WikiLink\\WikiLink.m"
|
In[5]:=
|
SetJarPath[KnotAtlasPath <> "WikiLink\\"];
|
We then try to connect to the wiki. Executing this line will prompt you for a username and password.
In[6]:=
|
CreateWikiConnection[
"http://katlas.math.toronto.edu/w/index.php",
InputString["Enter Your Username:"],
InputString["Enter Your Password"]
]
|
The function WikiUserName[]
checks that we're logged in
|
In[7]:=
|
WikiUserName[]
|
Out[7]=
|
ScottManualRobot
|
Usage
WikiLink` provides functions for checking your login status, getting and setting pages, as well as transparently extending some of Mathematica's string manipulation functions to wiki pages.
|
|
|
|
Thus for example after
In[12]:=
|
WikiSetPageText["Sandbox", "A robotic edit, at 19:39, 31-August-2005."]
|
Out[12]=
|
True
|
we get
In[13]:=
|
WikiGetPageText["Sandbox"]
|
Out[13]=
|
A robotic edit, at 19:39, 31-August-2005.
|
The function WikiSetPageTexts
is most useful for batch uploads, as it does considerably more error checking, and filters out edits which won't change the page text. It takes as argument a list of {"title", "text"}
pairs, and returns a list of those pairs which failed.
In[14]:=
|
WikiSetPageTexts[{{"Sandbox", "A robotic edit, by --~~"<>"~~"}, {"Sandbox2", "The determinant of the knot [[3_1]] is 3."}}]
|
Out[14]=
|
{}
|
In[15]:=
|
WikiGetPageText["Sandbox2"]
|
Out[15]=
|
The determinant of the knot [[3_1]] is 3.
|
String manipulation functions
WikiLink`
provides functions WikiPageMatchQ, WikiPageFreeQ, WikiStringReplace and WikiStringCases. Each function works likes its usual Mathematica partner, StringMatchQ, StringFreeQ, StringReplace or StringCases. Instead of providing a string, or list of strings, as the first argument, you should give the name of a page, or a list of names.
You can use these to perform all sorts of editing tricks.
Troubleshooting
The instruction ShowJavaConsole[]
will bring up a window in which some debugging information is displayed.
Compatibility
WikiLink has been tested against mediawiki 1.4.5beta3 and 1.4.7.
I expect WikiGetPage text to continue working in mediawiki 1.5 and beyond, because it uses the stable interface Special:Export. Logging in and setting pages will quite likely break in the next version. If you've tried this, please let me know about your experiences. I'm hoping that soon (1.5?) Special:Import will become available, and I can switch to using this. --Scott 15:57, 31 Aug 2005 (EDT)
Todo
I'd love to create an Ant task which allows uploading a file to a wiki. We could then use this in build scripts for KnotTheory, etc. --Scott 04:07, 17 Sep 2005 (EDT)
See Also
All of the Mathematica notebooks in Category:Knot Atlas Maintenance Software rely on WikiLink, and so are good examples of how to use it.
You may also be interested in the Wikipedia page on mediawiki bots, and in particular the Python Wikipedia Robot Framework.