WikiLink - The Mediawiki Interface: Difference between revisions
No edit summary |
No edit summary |
||
Line 33: | Line 33: | ||
First, you'll need to set some paths, so WikiLink` can find the java files it needs. |
First, you'll need to set some paths, so WikiLink` can find the java files it needs. |
||
<!--$$KnotAtlasPath = "c:\\scott\\math.berkeley.edu\\Work\\Mathematica\\KnotAtlas\\";$$ |
<!--$$KnotAtlasPath = "c:\\scott\\math.berkeley.edu\\Work\\Mathematica\\KnotAtlas\\";$$--> |
||
<!-- |
<!--Robot Land, no human edits to "END"--> |
||
{{In| |
|||
⚫ | |||
n = 1 | |
|||
⚫ | |||
in = <nowiki>KnotAtlasPath = "c:\\scott\\math.berkeley.edu\\Work\\Mathematica\\KnotAtlas\\";</nowiki>}} |
|||
⚫ | |||
<!--END--> |
|||
<!--$$AppendTo[$Path, KnotAtlasPath];$$--> |
|||
<!--Robot Land, no human edits to "END"--> |
|||
{{In| |
|||
n = 2 | |
|||
in = <nowiki>AppendTo[$Path, KnotAtlasPath];</nowiki>}} |
|||
<!--END--> |
|||
⚫ | |||
<!--Robot Land, no human edits to "END"--> |
|||
{{In| |
|||
n = 3 | |
|||
in = <nowiki>SetDirectory[KnotAtlasPath];</nowiki>}} |
|||
<!--END--> |
|||
⚫ | |||
<!--Robot Land, no human edits to "END"--> |
|||
{{In| |
|||
n = 4 | |
|||
in = <nowiki><< "WikiLink\\WikiLink.m"</nowiki>}} |
|||
<!--END--> |
|||
⚫ | |||
<!--Robot Land, no human edits to "END"--> |
|||
{{In| |
|||
n = 5 | |
|||
in = <nowiki>SetJarPath[KnotAtlasPath <> "WikiLink\\"];</nowiki>}} |
|||
<!--END--> |
|||
We then try to connect to the wiki. Executing this line will prompt you for a username and password. |
We then try to connect to the wiki. Executing this line will prompt you for a username and password. |
||
Line 44: | Line 69: | ||
wikiUserName=InputString["Enter Your Username:"], |
wikiUserName=InputString["Enter Your Username:"], |
||
InputString["Enter Your Password"] |
InputString["Enter Your Password"] |
||
]$$ |
]$$--> |
||
<!--Robot Land, no human edits to "END"--> |
|||
{{In| |
|||
n = 6 | |
|||
in = <nowiki>CreateWikiConnection[ |
|||
"http://katlas.math.toronto.edu/w/index.php", |
|||
wikiUserName=InputString["Enter Your Username:"], |
|||
InputString["Enter Your Password"] |
|||
]</nowiki>}} |
|||
<!--END--> |
|||
The function <code>WikiUserName[]</code> checks that we're logged in |
The function <code>WikiUserName[]</code> checks that we're logged in |
||
<!--$$?WikiUserName$$ |
<!--$$?WikiUserName$$--> |
||
<!--Robot Land, no human edits to "END"--> |
|||
⚫ | |||
{{HelpLine| |
|||
n = 7 | |
|||
in = <nowiki>WikiUserName</nowiki> | |
|||
out= <nowiki>WikiUserName[] returns either the name of the user you are logged in as, or $Failed if you appear to be not logged in.</nowiki>}} |
|||
<!--END--> |
|||
⚫ | |||
<!--Robot Land, no human edits to "END"--> |
|||
{{InOut| |
|||
n = 8 | |
|||
in = <nowiki>wikiUserName==WikiUserName[]</nowiki> | |
|||
out= <nowiki>True</nowiki>}} |
|||
<!--END--> |
|||
====Usage==== |
====Usage==== |
Revision as of 14:03, 31 August 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, whie 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 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",
wikiUserName=InputString["Enter Your Username:"],
InputString["Enter Your Password"]
]
|
The function WikiUserName[]
checks that we're logged in
|
In[8]:=
|
wikiUserName==WikiUserName[]
|
Out[8]=
|
True
|
Usage
Compatibility
WikiLink has been tested against mediawiki 1.4.5beta3 and 1.4.7.