Skip to content

Commit

Permalink
simplified conversion of single files
Browse files Browse the repository at this point in the history
  • Loading branch information
anselmdk committed Mar 21, 2013
1 parent 4103a5a commit dedbf26
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
/en
/output
/run.bat
/run.bat
/input
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@
Tools to convert the DokuWiki syntax to Markdown syntax.
Please note it has some specific Liquibase regular expressions in `scripts/DocuwikiToMarkdownExtra.php`.

## Usage

## Convert single files

Place a file in the input dir, and run:
`php convert.php input/myfile.txt`

This will convert your file, and place a `myfile.md` next to your file.


## Advanced usage (not yet tested)


### Import an entire wiki

Expand All @@ -14,7 +24,7 @@ Please note it has some specific Liquibase regular expressions in `scripts/Docuw
### Convert to Markdown files

cd scripts
php TranslateSSDocs.php ../input <../output> < template.txt>
php Translate.php ../input <../output> < template.txt>

`../output` - if output is not supplied it will print the conversion to `stdout`.

Expand Down
2 changes: 2 additions & 0 deletions convert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
include 'scripts/Translate.php';
8 changes: 6 additions & 2 deletions scripts/TranslateSSDocs.php → scripts/Translate.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* php TranslateSSDocs.php <inputfile|inputdir> <outputdir>
* php Translate.php <inputfile|inputdir> <outputdir>
*
* If no <outputdir> is given, writes to stdout.
*
Expand All @@ -12,7 +12,11 @@

$args = @$_SERVER['argv'];
$inputDir = (isset($args[1])) ? realpath($args[1]) : "../input/";
$outputDir = (isset($args[2])) ? realpath($args[2]) : false;
//NOTE (Anselm March 2013): There seems to be an inconsistency in the script, so that when
//single files are converted, they are always placed in the input dir nomatter what the settings are.
//Thus I just changed the default to true, so they'll alway be placed there anyway
$outputDir = (isset($args[2])) ? realpath($args[2]) : true;

echo "Output Path " , $outputDir, "\n";
$template = (isset($args[3])) ? file_get_contents(realpath($args[3])) : false;

Expand Down

0 comments on commit dedbf26

Please sign in to comment.