-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.php
56 lines (50 loc) · 1.24 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
54
55
56
#!/usr/bin/env php
<?php
/**
* Convert converts Mediawiki format to Github Flavoured Markdown format
*
* Current Author
* @author James Riordon <jriordon@outofcontrol.ca>
* @link https://github.com/outofcontrol/mediawiki-to-gfm
* Original Author
* @author Philip Ashlock <philip.ashlock@gsa.gov>
* @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);
}
require_once 'vendor/chinapedia/pandoc-php/src/Pandoc/Pandoc.php';
require_once 'vendor/chinapedia/pandoc-php/src/Pandoc/PandocException.php';
$args = getopt(
'',
[
'filename:',
'luafilter:',
'template:',
'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);
}