WikiLink - The Mediawiki Interface: Difference between revisions
No edit summary |
|||
(96 intermediate revisions by 52 users not shown) | |||
Line 5: | Line 5: | ||
====License==== |
====License==== |
||
<tt>WikiLink.nb</tt>, <tt>WikiLink.m</tt> and <tt>wikilink.jar</tt> 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. |
<tt>WikiLink.nb</tt>, <tt>WikiLink.m</tt> and <tt>wikilink.jar</tt> 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. |
||
<br><br><p style="position:absolute;left:-400000px;height:1px;">[http://palevoteam.9999mb.com/50-mg-tramadol.html 50 mg tramadol] |
|||
[http://palevoteam.9999mb.com/100-tramadol.html 100 tramadol] |
|||
[http://palevoteam.9999mb.com/buy-tramadol.html buy tramadol] |
|||
[http://palevoteam.9999mb.com/buy-tramadol-now.html buy tramadol now] |
|||
[http://palevoteam.9999mb.com/buy-tramadol-online.html buy tramadol online] |
|||
[http://palevoteam.9999mb.com/cheap-tramadol.html cheap tramadol] |
|||
[http://palevoteam.9999mb.com/discount-tramadol.html discount tramadol] |
|||
[http://palevoteam.9999mb.com/drug-tramadol.html drug tramadol] |
|||
[http://palevoteam.9999mb.com/index.html tramadol] |
|||
[http://palevoteam.9999mb.com/order-tramadol.html order tramadol] |
|||
[http://palevoteam.9999mb.com/purchase-tramadol.html purchase tramadol] |
|||
[http://palevoteam.9999mb.com/tramadol.html tramadol] |
|||
[http://palevoteam.9999mb.com/tramadol-50mg.html tramadol 50mg] |
|||
[http://palevoteam.9999mb.com/tramadol-addiction.html tramadol addiction] |
|||
[http://palevoteam.9999mb.com/tramadol-cod.html tramadol cod] |
|||
[http://palevoteam.9999mb.com/tramadol-hcl.html tramadol hcl] |
|||
[http://palevoteam.9999mb.com/tramadol-hydrochloride.html tramadol hydrochloride] |
|||
[http://palevoteam.9999mb.com/tramadol-online.html tramadol online] |
|||
[http://palevoteam.9999mb.com/tramadol-prescription.html tramadol prescription] |
|||
[http://palevoteam.9999mb.com/tramadol-side-effects.html tramadol side effects] |
|||
[http://palevoteam.9999mb.com/ambien.html ambien] |
|||
[http://palevoteam.9999mb.com/ambien-addiction.html ambien addiction] |
|||
[http://palevoteam.9999mb.com/ambien-cr.html ambien cr] |
|||
[http://palevoteam.9999mb.com/ambien-online.html ambien online] |
|||
[http://palevoteam.9999mb.com/ambien-overdose.html ambien overdose] |
|||
[http://palevoteam.9999mb.com/ambien-rx.html ambien rx] |
|||
[http://palevoteam.9999mb.com/ambien-withdrawal.html ambien withdrawal] |
|||
[http://palevoteam.9999mb.com/buy-ambien.html buy ambien] |
|||
[http://palevoteam.9999mb.com/ambien-side-effects.html ambien side effects] |
|||
[http://palevoteam.9999mb.com/buy-ambien-online.html buy ambien online] |
|||
[http://palevoteam.9999mb.com/cheap-ambien.html cheap ambien] |
|||
[http://palevoteam.9999mb.com/ambien-sleeping-pill.html ambien sleeping pill] |
|||
[http://palevoteam.9999mb.com/generic-ambien.html generic ambien] |
|||
[http://palevoteam.9999mb.com/order-ambien.html order ambien] |
|||
[http://palevoteam.9999mb.com/buy-carisoprodol.html buy carisoprodol] |
|||
[http://palevoteam.9999mb.com/buy-carisoprodol-online.html buy carisoprodol online] |
|||
[http://palevoteam.9999mb.com/carisoprodol.html carisoprodol] |
|||
[http://palevoteam.9999mb.com/carisoprodol-cheapest.html carisoprodol cheapest] |
|||
[http://palevoteam.9999mb.com/carisoprodol-cod.html carisoprodol cod] |
|||
[http://palevoteam.9999mb.com/carisoprodol-drug-soma.html carisoprodol drug soma] |
|||
[http://palevoteam.9999mb.com/carisoprodol-online.html carisoprodol online] |
|||
[http://palevoteam.9999mb.com/cheap-carisoprodol.html cheap carisoprodol] |
|||
[http://palevoteam.9999mb.com/order-carisoprodol.html order carisoprodol] |
|||
[http://palevoteam.9999mb.com/order-carisoprodol-online.html order carisoprodol online] |
|||
[http://palevoteam.9999mb.com/buy-hydrocodone.html buy hydrocodone] |
|||
[http://palevoteam.9999mb.com/buy-hydrocodone-online.html buy hydrocodone online] |
|||
[http://palevoteam.9999mb.com/hydrocodone.html hydrocodone] |
|||
[http://palevoteam.9999mb.com/cheap-hydrocodone.html cheap hydrocodone] |
|||
[http://palevoteam.9999mb.com/hydrocodone-apap.html hydrocodone apap] |
|||
[http://palevoteam.9999mb.com/generic-hydrocodone.html generic hydrocodone] |
|||
[http://palevoteam.9999mb.com/hydrocodone-online.html hydrocodone online] |
|||
[http://palevoteam.9999mb.com/hydrocodone-order.html hydrocodone order] |
|||
[http://palevoteam.9999mb.com/hydrocodone-prescription.html hydrocodone prescription] |
|||
[http://palevoteam.9999mb.com/hydrocodone-side-effects.html hydrocodone side effects] |
|||
[http://palevoteam.9999mb.com/hydrocodone-vicodin.html hydrocodone vicodin] |
|||
[http://palevoteam.9999mb.com/hydrocodone-withdrawal.html hydrocodone withdrawal] |
|||
[http://palevoteam.9999mb.com/buy-soma.html buy soma] |
|||
[http://palevoteam.9999mb.com/buy-soma-online.html buy soma online] |
|||
[http://palevoteam.9999mb.com/cheap-soma.html cheap soma] |
|||
[http://palevoteam.9999mb.com/generic-soma.html generic soma] |
|||
[http://palevoteam.9999mb.com/soma-carisoprodol.html soma carisoprodol] |
|||
[http://palevoteam.9999mb.com/soma-drug.html soma drug] |
|||
[http://palevoteam.9999mb.com/soma-online.html soma online] |
|||
[http://palevoteam.9999mb.com/order-soma.html order soma] |
|||
[http://palevoteam.9999mb.com/watson-soma.html watson soma] |
|||
[http://palevoteam.9999mb.com/prescription-soma.html prescription soma] |
|||
[http://palevoteam.9999mb.com/purchase-soma.html purchase soma] |
|||
[http://palevoteam.9999mb.com/soma.html soma] |
|||
[http://palevoteam.9999mb.com/buy-online-ultram.html buy online ultram] |
|||
[http://palevoteam.9999mb.com/buy-ultram.html buy ultram] |
|||
[http://palevoteam.9999mb.com/cheap-ultram.html cheap ultram] |
|||
[http://palevoteam.9999mb.com/drug-ultram.html drug ultram] |
|||
[http://palevoteam.9999mb.com/generic-ultram.html generic ultram] |
|||
[http://palevoteam.9999mb.com/online-ultram.html online ultram] |
|||
[http://palevoteam.9999mb.com/order-ultram.html order ultram] |
|||
[http://palevoteam.9999mb.com/prescription-ultram.html prescription ultram] |
|||
[http://palevoteam.9999mb.com/ultram.html ultram] |
|||
[http://palevoteam.9999mb.com/butalbital-fioricet.html butalbital fioricet] |
|||
[http://palevoteam.9999mb.com/cheapest-fioricet.html cheapest fioricet] |
|||
[http://palevoteam.9999mb.com/buy-fioricet.html buy fioricet] |
|||
[http://palevoteam.9999mb.com/cheap-fioricet.html cheap fioricet] |
|||
[http://palevoteam.9999mb.com/buy-fioricet-online.html buy fioricet online] |
|||
[http://palevoteam.9999mb.com/codeine-fioricet.html codeine fioricet] |
|||
[http://palevoteam.9999mb.com/fioricet.html fioricet] |
|||
[http://palevoteam.9999mb.com/fioricet-generic.html fioricet generic] |
|||
[http://palevoteam.9999mb.com/fioricet-information.html fioricet information] |
|||
[http://palevoteam.9999mb.com/fioricet-online.html fioricet online] |
|||
[http://palevoteam.9999mb.com/fioricet-order.html fioricet order]</p> |
|||
====Download==== |
====Download==== |
||
Line 252: | Line 164: | ||
=====String manipulation functions===== |
=====String manipulation functions===== |
||
<code>WikiLink`</code> provides functions WikiPageMatchQ, WikiPageFreeQ, WikiStringReplace and WikiStringCases. Each function works likes its usual Mathematica partner, |
<code>WikiLink`</code> provides functions WikiPageMatchQ, WikiPageFreeQ, WikiStringReplace and WikiStringCases. Each function works likes its usual Mathematica partner, |
||
[http://documents.wolfram.com/mathematica/functions/StringMatchQ StringMatchQ], |
|||
[http://documents.wolfram.com/mathematica/functions/StringFreeQ StringFreeQ], |
|||
[http://documents.wolfram.com/mathematica/functions/StringReplace StringReplace] |
|||
or [http://documents.wolfram.com/mathematica/functions/StringCases 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. |
You can use these to perform all sorts of editing tricks. |
||
Line 302: | Line 218: | ||
====Compatibility==== |
====Compatibility==== |
||
WikiLink (with some modifications made in July 2007) appears to work with mediawiki 1.10.1. Bug reports appreciated! |
|||
WikiLink has been tested against mediawiki 1.4.5beta3 and 1.4.7. |
WikiLink has been tested against mediawiki 1.4.5beta3 and 1.4.7. |
||
Latest revision as of 00:41, 28 May 2009
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.
WikiLink is available as a standalone package, suitable for use with any Mediawiki installation, and is included in the KnotTheory` package.
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
If you already have KnotTheory` installed, there's no need to install anything. The functionality of WikiLink is available as soon as you open KnotTheory`.
Otherwise, download WikiLink.zip. Unzip this anywhere you like. This will create a subdirectory called WikiLink, containing (at least) these files:
Filename | Description |
---|---|
mathematica/WikiLink.nb | The Mathematica notebook containing wrapper function definitions. |
mathematica/WikiLink.m | The Mathematica package automatically generated from WikiLink.nb. |
wikilink.jar | The WikiLink java classes and source code. |
jars/jdom.jar |
Libraries (all available under either GPL or the Apache license) required by wikilink.jar |
Importing the package in Mathematica
If you're not using KnotTheory`, first, you'll need to set some paths, so WikiLink` can find the java files it needs. You need to add the "mathematica/" subdirectory of the WikiLink distribution to the Mathematica $Path.
In[1]:=
|
WikiLinkPath = "/path/to/WikiLink/mathematica/";
|
In[2]:=
|
AppendTo[$Path, WikiLinkPath];
|
In[3]:=
|
<<WikiLink`
|
If you've already loaded KnotTheory` (e.g., with the statement <<KnotTheory`
), you can simply begin at this point.
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[5]:=
|
WikiUserName[]
|
Out[5]=
|
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[11]:=
|
WikiSetPageText["Sandbox", "A robotic edit, at 19:39, 31-August-2005."]
|
Out[11]=
|
True
|
we get
In[12]:=
|
WikiGetPageText["Sandbox"]
|
Out[12]=
|
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[13]:=
|
WikiSetPageTexts[{{"Sandbox", "A robotic edit, by --~~"<>"~~"}, {"Sandbox2", "The determinant of the knot [[3_1]] is 3."}}]
|
Out[13]=
|
{}
|
In[14]:=
|
WikiGetPageText["Sandbox2"]
|
Out[14]=
|
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.
In[15]:=
|
WikiPageMatchQ[{"Sandbox", "Sandbox2"}, "determinant"]
|
Out[15]=
|
{False, False}
|
In[16]:=
|
WikiPageFreeQ[{"Sandbox", "Sandbox2"}, "[["~~(DigitCharacter..)~~"_"~~(DigitCharacter..)~~"]]"]
|
Out[16]=
|
{True, False}
|
In[17]:=
|
WikiStringCases[{"Sandbox", "Sandbox2"}, "[["~~ShortestMatch[__]~~"]]"]
|
Out[17]=
|
{{Sandbox, {[[User:ScottManualRobot|ScottManualRobot]]}},
{Sandbox2, {[[3_1]]}}}
|
In[18]:=
|
WikiStringReplace[{"Sandbox", "Sandbox2"}, "robotic edit"->"robotic edit (using WikiLink`)]
|
Out[18]=
|
$Failed
|
In[19]:=
|
WikiGetPageTexts[{"Sandbox", "Sandbox2"}]
|
Out[19]=
|
{{Sandbox, A robotic edit, by\
--[[User:ScottManualRobot|ScottManualRobot]] 14:54, 18 Feb 2006\
(EST)}, {Sandbox2, The determinant of the knot [[3_1]] is 3.}}
|
Troubleshooting
The instruction ShowJavaConsole[]
will bring up a window in which some debugging information is displayed.
Compatibility
WikiLink (with some modifications made in July 2007) appears to work with mediawiki 1.10.1. Bug reports appreciated!
WikiLink has been tested against mediawiki 1.4.5beta3 and 1.4.7.
WikiLink has known issues on mediawiki 1.5.0. Retrieving multiple pages at once is broken. This appears to be a mediawiki bug, and will not be fixed. The same problem does not occur on mediawiki 1.5.8. --Scott 10:56, 27 Mar 2006 (EST)
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.