1 | =pod
|
---|
2 |
|
---|
3 | =head1 INTRODUCTION
|
---|
4 |
|
---|
5 | You can read this document better with:
|
---|
6 |
|
---|
7 | perldoc README
|
---|
8 |
|
---|
9 | Otherwise, please just ignore the funny characters.
|
---|
10 |
|
---|
11 | =head1 NAME
|
---|
12 |
|
---|
13 | WIKI2XML - Wikitext to XML converter
|
---|
14 |
|
---|
15 | =head1 INSTALLATION
|
---|
16 |
|
---|
17 | =head2 Download/Checkout
|
---|
18 |
|
---|
19 | Check out the current release from SVN:
|
---|
20 |
|
---|
21 | svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/wiki2xml
|
---|
22 |
|
---|
23 | =head2 Extension or cgi-bin?
|
---|
24 |
|
---|
25 | There are two ways to install wiki2xml:
|
---|
26 |
|
---|
27 | As extension: Special::Wiki2XML
|
---|
28 | As cgi-bin: http://example.com/wiki/wiki2xml/w2x
|
---|
29 |
|
---|
30 | The former should be prefered.
|
---|
31 |
|
---|
32 | =head2 As Extension
|
---|
33 |
|
---|
34 | To enable wiki2xml as extension, put all files in the C<< php >> directory into a
|
---|
35 | C<< wiki2xml >> subdirectory of your MediaWiki extensions directory.
|
---|
36 |
|
---|
37 | htdocs
|
---|
38 | \- wiki
|
---|
39 | \- extensions
|
---|
40 | \- wiki2xml <-- create this directory
|
---|
41 | \- w2x.php <-- copy files here
|
---|
42 | \- wiki2xml.php etc.
|
---|
43 |
|
---|
44 | Then add
|
---|
45 |
|
---|
46 | require_once ("extensions/wiki2xml/extension.php");
|
---|
47 |
|
---|
48 | to your C<< LocalSettings.php >>. The extension can then be accessed as
|
---|
49 | C<< [[Special:Wiki2XML]] >>.
|
---|
50 |
|
---|
51 | =head2 cgi-bin - Copy files
|
---|
52 |
|
---|
53 | The alternative method is to install wiki2xml as cgi-bin script:
|
---|
54 |
|
---|
55 | Copy the subdirectory C<< ./php/ >> to your server's C<< wiki/ >>
|
---|
56 | directory as a subdirectory named C<< w2x >>:
|
---|
57 |
|
---|
58 | htdocs
|
---|
59 | \- wiki
|
---|
60 | \- w2x <-- here
|
---|
61 | \- w2x.php
|
---|
62 | \- wiki2xml.php etc
|
---|
63 |
|
---|
64 | Access it as C<< http://example.com/wiki/w2x/w2x.php >>.
|
---|
65 |
|
---|
66 | =head2 Configuration
|
---|
67 |
|
---|
68 | The configuration is stored in C<< default.php >> and C<< local.php >>.
|
---|
69 |
|
---|
70 | There is a C<< sample_local.php >> file, copy it to C<< local.php >>
|
---|
71 | and then edit it to match your configuration.
|
---|
72 |
|
---|
73 | On a Unix/Linux server the following can be used as a starting point:
|
---|
74 |
|
---|
75 | # Directory for temporary files:
|
---|
76 | $xmlg["temp_dir"] = "/tmp";
|
---|
77 |
|
---|
78 | # Path to the zip/unzip programs; can be omitted if in default
|
---|
79 | # executable path:
|
---|
80 | #$xmlg["zip_odt_path"] = "";
|
---|
81 |
|
---|
82 | # Command to zip directory $1 to file $2:
|
---|
83 | $xmlg["zip_odt"] = 'zip -r9 $1 $2';
|
---|
84 |
|
---|
85 | # Command to unzip file $1 to directory $2:
|
---|
86 | $xmlg["unzip_odt"] = 'unzip -x $1 -d $2';
|
---|
87 |
|
---|
88 | =head1 USAGE
|
---|
89 |
|
---|
90 | Open the correct URL (depending on install type, see above) in your browser.
|
---|
91 |
|
---|
92 | Wiki2xml should present you with a form with a textarea and several buttons.
|
---|
93 |
|
---|
94 | =head2 Using URL parameters
|
---|
95 |
|
---|
96 | Parameters:
|
---|
97 |
|
---|
98 | doit=1
|
---|
99 | text=lines_of_text_or_titles
|
---|
100 | whatsthis=wikitext/articlelist
|
---|
101 | site=en.wikipedia.org/w
|
---|
102 | output_format=xml/text/xhtml/docbook_xml/odt_xml/odt
|
---|
103 |
|
---|
104 | Optional:
|
---|
105 |
|
---|
106 | use_templates=all/none/these/notthese
|
---|
107 | templates=lines_of_templates
|
---|
108 | document_title=
|
---|
109 | add_gfdl=1
|
---|
110 | keep_categories=1
|
---|
111 | keep_interlanguage=1
|
---|
112 |
|
---|
113 |
|
---|
114 |
|
---|
115 | =head1 TROUBLESHOOTING
|
---|
116 |
|
---|
117 | If you get errors like the following:
|
---|
118 |
|
---|
119 | Warning: fopen(/tmp/ODD6Rq1qt-DIR/content.xml): failed to open stream:
|
---|
120 | No such file or directory in /.../wiki/wiki2xml/w2x.php on line 112
|
---|
121 |
|
---|
122 | then make sure that the tmp directory you selected is really writable by
|
---|
123 | your webserver.
|
---|
124 |
|
---|
125 | =head2 OpenOffice Output
|
---|
126 |
|
---|
127 | For OpenOffice output, the converter will extract a file called C<< template.odt >>
|
---|
128 | into the temp directory. It will then replace/modify the files in it, zip it
|
---|
129 | up again and then offer the browser the resulting file as a download.
|
---|
130 |
|
---|
131 | =head1 AUTHOR
|
---|
132 |
|
---|
133 | Copyright 2005-2006 by Magnus Manske <[email protected]>
|
---|
134 |
|
---|
135 | Released under the GPL.
|
---|
136 |
|
---|
137 | =cut
|
---|
138 |
|
---|