Skip to content

Commit

Permalink
Merge branch 'master' into imgsrc-path
Browse files Browse the repository at this point in the history
  • Loading branch information
sockenklaus committed Aug 10, 2012
2 parents ebe9ad0 + 10ccbaa commit d9a8217
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/convertSyntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ private function convertList($record) {
*/
private function convertHeadings($record) {
$patterns = array('/^======(.+)======\s*$/m' => '==\1==',
'/^=====(.+)=====\s*$/m' => '===\1===',
'/^====(.+)====\s*$/m' => '====\1====',
'/^===(.+)===\s*$/m' => '=====\1=====',
'/^==(.+)==\s*$/m' => '======\1======');
'/^=====(.+)=====\s*$/m' => '==\1==',
'/^====(.+)====\s*$/m' => '===\1===',
'/^===(.+)===\s*$/m' => '====\1====',
'/^==(.+)==\s*$/m' => '=====\1=====');

// Insert a unique string to the replacement so that it won't be
// caught in a search later.
Expand All @@ -277,7 +277,6 @@ private function convertHeadings($record) {
}

// Strip out the unique strings.
return preg_replace('/^' . $this->placeholder . '(={2,6})/', '\1',
$convertedRecord);
return str_replace($this->placeholder, '', $convertedRecord);
}
}
6 changes: 2 additions & 4 deletions src/mediawiki2dokuwiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ function convert(PDO $db, array $mwikiDb, array $lang) {
* @param array $lang DokuWiki language
*/
function processPage(array $record, array $lang) {
$converter = '====== ' . $record['page_title'] . ' ======'
. new mediaWikiConverter($record['old_text']);
$converter = new mediaWikiConverter($record['old_text']);

saveWikiText($record['page_title'], con('', $converter->convert(), ''),
$lang['created']);
saveWikiText($record['page_title'], con('', "====== " . $record['page_title'] . " ======\n\n" . $converter->convert(), ''), $lang['created']);
}

/**
Expand Down

0 comments on commit d9a8217

Please sign in to comment.