Index: trunk/wiki2xml/php/sample_local.php |
— | — | @@ -17,6 +17,9 @@ |
18 | 18 | "dtd" => "file:/c:/docbook/dtd/docbookx.dtd" |
19 | 19 | ) ; |
20 | 20 | |
| 21 | +# On Windows, set |
| 22 | +# $xmlg['is_windows'] = true ; |
| 23 | + |
21 | 24 | ### Uncomment the following to use Special:Export and (potentially) automatic authors list; a little slower, though |
22 | 25 | #$xmlg["use_special_export"] = 1 ; |
23 | 26 | |
Index: trunk/wiki2xml/php/w2x.php |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | } |
95 | 95 | $converter = new MediaWikiConverter ; |
96 | 96 | |
97 | | - $xmlg["book_title"] = $_POST['document_title'] || 'document'; |
| 97 | + $xmlg["book_title"] = $_POST['document_title']; |
98 | 98 | $xmlg["site_base_url"] = $_POST['site'] ; |
99 | 99 | $xmlg["resolvetemplates"] = $_POST['use_templates'] ; |
100 | 100 | $xmlg['templates'] = explode ( "\n" , $_POST['templates'] ) ; |
— | — | @@ -109,6 +109,9 @@ |
110 | 110 | } else { |
111 | 111 | $t = microtime_float() ; |
112 | 112 | $articles = explode ( "\n" , $wikitext ) ; |
| 113 | + if ($xmlg["book_title"] == '') { |
| 114 | + $xmlg["book_title"] = $articles[0]; |
| 115 | + } |
113 | 116 | foreach ( $articles AS $a ) { |
114 | 117 | $wiki2xml_authors = array () ; |
115 | 118 | $a = trim ( $a ) ; |
— | — | @@ -184,10 +187,20 @@ |
185 | 188 | fwrite ( $handle , $out ) ; |
186 | 189 | fclose ( $handle ) ; |
187 | 190 | # Generate temporary ODT file |
188 | | - $out_file = tempnam($dir, "ODT"); |
| 191 | + $out_file = tempnam('', "ODT"); |
189 | 192 | $cmd = $xmlg['zip_odt'] ; |
190 | 193 | $cmd = str_replace ( '$1' , escapeshellarg ( $out_file ) , $cmd ) ; |
191 | | - $cmd = str_replace ( '$2' , escapeshellarg ( $dir . "/" ) , $cmd ) ; |
| 194 | + |
| 195 | + if ( $xmlg['is_windows'] ) { |
| 196 | + $cmd = str_replace ( '$2' , escapeshellarg ( $dir . "/" ) , $cmd ) ; |
| 197 | + } else { |
| 198 | + $cmd = str_replace ( '$2' , escapeshellarg ( './' ) , $cmd ) ; |
| 199 | + # linux/unix zip needs to be in the directory, otherwise it will |
| 200 | + # include needless parts into the directory structure |
| 201 | + chdir ($dir); |
| 202 | + # remove the output if it for some reason already exists |
| 203 | + } |
| 204 | + |
192 | 205 | @unlink ( $out_file ) ; |
193 | 206 | exec ( $cmd ) ; |
194 | 207 | |
Index: trunk/wiki2xml/php/default.php |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | $xmlg["book_title"] = "No title" ; |
7 | 7 | $xmlg['sourcedir'] = "." ; |
8 | 8 | $xmlg["temp_dir"] = "/tmp" ; |
| 9 | +$xmlg['is_windows'] = false ; |
9 | 10 | |
10 | 11 | @include ( "local.php" ) ; |
11 | 12 | |