WikiLink - The Mediawiki Interface: Difference between revisions
(jebino.com) |
m (Reverted edit of 193.188.69.18, changed back to last version by 128.134.33.230) |
||
Line 186: | Line 186: | ||
<!--END--> |
<!--END--> |
||
====Troubleshooting==== |
|||
<a href="http://free-poker.jozka.com">free poker</a> <br /> |
|||
The instruction <code>ShowJavaConsole[]</code> will bring up a window in which some debugging information is displayed. |
|||
<a href="http://party-poker.jozka.com">party poker</a> <br /> |
|||
<a href="http://poker-room.jozka.com">poker room</a> <br /> |
|||
<a href="http://poker-game.jozka.com">poker game</a> <br /> |
|||
<a href="http://poker-star.jozka.com">poker star</a> <br /> |
|||
====Todo==== |
|||
<a href="http://football-gambling.jozka.com">football gambling</a> <br /> |
|||
I'd love to [http://ant.apache.org/manual/develop.html#writingowntask create an Ant task] which allows uploading a file to a wiki. We could then use this in build scripts for KnotTheory, etc. --[[User:Scott|Scott]] 04:07, 17 Sep 2005 (EDT) |
|||
<a href="http://gambling-game.jozka.com">gambling game</a> <br /> |
|||
<a href="http://gambling-problem.jozka.com">gambling problem</a> <br /> |
|||
<a href="http://gambling-weblog.com.jozka.com">gambling weblog.com</a> <br /> |
|||
<a href="http://gambling-site.jozka.com">gambling site</a> <br /> |
|||
====See Also==== |
====See Also==== |
Revision as of 07:26, 1 May 2007
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.
<a href="http://forum.org-gambling.jozka.com">forum.org gambling</a>
<a href="http://pathological-gambling.jozka.com">pathological gambling</a>
<a href="http://gambling-software.jozka.com">gambling software</a>
<a href="http://gambling-bonus.jozka.com">gambling bonus</a>
<a href="http://gambling-strategy.jozka.com">gambling strategy</a>
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.
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.<a href="http://gaming-online.jozka.com">gaming online</a>
<a href="http://online-poker.jozka.com">online poker</a>
<a href="http://strip-poker.jozka.com">strip poker</a>
<a href="http://poker-chips.jozka.com">poker chips</a>
<a href="http://poker-table.jozka.com">poker table</a>