forked from outofcontrol/mediawiki-to-gfm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.php
executable file
·53 lines (46 loc) · 1.06 KB
/
convert.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env php
<?php
/**
* Convert converts Mediawiki format to Github Flavoured Markdown format
*
* Current Author
* @author James Riordon <[email protected]>
* @link https://github.com/outofcontrol/mediawiki-to-gfm
* Original Author
* @author Philip Ashlock <[email protected]>
* @link https://github.com/philipashlock/mediawiki-to-markdown
* @license MIT License https://opensource.org/licenses/MIT
*/
if (is_file(__DIR__.'/vendor/autoload.php') === true) {
require_once 'vendor/autoload.php';
} else {
exit("Please run 'composer update --no-dev' first." . PHP_EOL);
}
$args = getopt(
'',
[
'filename:',
'output::',
'format::',
'addmeta::',
'flatten::',
'indexes::',
'version::',
'help::'
]
);
$convert = new App\Convert($args);
if (isset($args['help'])) {
$convert->help();
exit;
}
if (isset($args['version'])) {
$convert->getVersion();
exit;
}
try {
$convert->run();
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
exit(1);
}