'(:para $1:)', # [[tocauto]] from cookbook recipe '/\\[\\[tocauto(.*?)\\]\\]/' => '(:toc$1:)', # nolinebreaks "/\\[\\[((no)?linebreaks)\\]\\]/" => '(:$1:)', # noheader, nofooter, etc. "/\\[\\[(noheader|nofooter|nogroupheader|nogroupfooter|notitle|spacewikiwords)\\]\\]/" => '(:$1:)', # include, redirect "/\\[\\[(include|redirect):(.*?)\\]\\]/" => '(:$1 $2:)', # table, cell, cellnr, endtable "/\\[\\[(table|cell|cellnr|tableend)(\\s.*?)?\\]\\]\n?/" => "(:$1$2:)\n", # [[$Title]] "/\\[\\[\\\$Title\\]\\]/" => '{$Name}', "/\\[\\[\\\$Titlespaced\\]\\]/" => '{$Namespaced}', # [[$pagecount]], from SimplePageCount cookbook script "/\\[\\[\\\$pagecount\\]\\]/" => '{$PageCount}', # [[$Group]], [[$Version]], etc. "/\\[\\[\\$(Group|Version|Author|LastModified|LastModifiedBy|LastModifiedHost)\\]\\]/" => '{$$1}', # [[$Edit text]], [[$Diff text]] "/\\[\\[\\\$Edit\\s(.*?)\\]\\]/" => '[[{$Name}?action=edit |$1]]', "/\\[\\[\\\$Diff\\s(.*?)\\]\\]/" => '[[{$Name}?action=diff |$1]]', # [[$Search]], [[$SearchResults]], [[$Attachlist]] "/\\[\\[\\\$Search\\]\\]/" => '(:searchbox:)', "/\\[\\[\\\$Searchresults\\]\\]/" => '(:searchresults:)', "/\\[\\[\\\$Attachlist(\\s.*?)?\\]\\]/" => '(:attachlist$1:)', # [[Drawing:]] from PmWikiDraw (javajunky on #pmwiki) "/\\[\\[Drawing:(.*?)\\]\\]/" => '(:drawing $1:)', # [[target linktext]] "/\\[\\[((\\w|\\#)[^$UrlExcludeChars\\s]*)\\s((.|\\\n)*?)\\]\\]/" => '[[$1 |$3]]', # [[target]] "/\\[\\[(\\w[^$UrlExcludeChars\\s]*)\\]\\]/" => '[[$1 |#]]', # [[Group.{{free link}} link text]] "/\\[\\[($GroupPattern([\\/.]))?\\{\\{(~?\\w[-\\w\\s.\\/]*)\\}\\}([-#\\w]*)\\s((.|\\\n)*?)\\]\\]/" => '[[$1$3$4 |$5]]', # [[Group.{{free link|s}} link text]] "/\\[\\[($GroupPattern([\\/.]))?\\{\\{(~?\\w[-\\w\\s.\\/]*)\\|([-\\w\\s]*)\\}\\}([-#\\w]*)\\s(.*?)\\]\\]/" => '[[$1$3$4$5 |$6]]', # Group.{{free link}}ext "/($GroupPattern([\\/.]))?\\{\\{(~?\\w[-\\w\\s.\\/]*)\\}\\}([-\\w]*)/" => '[[$1$3]]$4', # Group.{{free link|s}}ext "/($GroupPattern([\\/.]))?\\{\\{(~?\\w[-\\w\\s.\\/]*)\\|([-\\w\\s]*)\\}\\}([-\\w]*)/" => '[[$1$3($4)]]$5', # :: lists "/^(:+)(:[^:\n]*)$/m" => '$1 $2', )); class PageStore1x extends PageStore { function read($pagename) { global $Compat1x,$KeepToken; $page = parent::read($pagename); if ($page) { $page['text'] = preg_replace('/(\\[([=@]).*?\\2\\])/se',"Keep(PSS('$1'))", @$page['text']); $page['text'] = preg_replace(array_keys($Compat1x), array_values($Compat1x), $page['text']); $page['text'] = preg_replace("/$KeepToken(\\d.*?)$KeepToken/e", '$GLOBALS[\'KPV\'][\'$1\']',$page['text']); } return $page; } } function UseV1WikiD($path) { global $WikiLibDirs; if (!is_dir($path)) { Abort("?$path is not an accessible directory"); exit(); } array_splice($WikiLibDirs,1,0, array(new PageStore1x("$path/\$FullName"))); } function ConvertV1WikiD($path) { global $WikiDir; Lock(2); if (!is_dir($path)) { Abort("?$path is not an accessible directory"); exit(); } $WikiV1Dir = new PageStore1x("$path/\$FullName"); $oldlist = $WikiV1Dir->ls(); $newlist = ListPages(); $bothlist = array_intersect($oldlist,$newlist); sort($bothlist); $difflist = array_diff($oldlist,$newlist); sort($difflist); $bcount = count($bothlist); $dcount = count($difflist); echo " Convert v1 pages to v2

Convert and Copy PmWiki v1.x pages into v2.x

"; $copy = array(); if (@$_POST['copydiff']) $copy = $difflist; if (@$_POST['copyboth']) $copy = array_merge($copy,$bothlist); if (@$_POST['copy']) $copy = array_merge($copy,$_POST['copy']); if (@$copy) { echo "

Okay, I'm now converting the pages you've requested. When this is finished, you can see if anything else needs to be converted, otherwise you can get rid of the include_once('scripts/compat1x.php'); and ConvertV1WikiD() lines that are in your local/config.php file.

"; $copy = array_unique($copy); foreach($copy as $p) { echo "
  • Converting $p
  • \n"; $page = $WikiV1Dir->read($p); WritePage($p,$page); } echo "

    Converted ", count($copy), " pages.

    \n"; } else { echo "

    This function will migrate pages from a 1.x wiki.d/ directory ($path) into your 2.x wiki.d/ directory, converting markups as it proceeds. Note that the files in your 1.x wiki.d/ directory are not affected by this script, so if the conversion doesn't work out for any reason you still have your original pages lying around.

    "; } /* now rebuild the lists */ $oldlist = $WikiV1Dir->ls(); $newlist = ListPages(); $bothlist = array_intersect($oldlist,$newlist); sort($bothlist); $difflist = array_diff($oldlist,$newlist); sort($difflist); $bcount = count($bothlist); $dcount = count($difflist); echo "
    "; echo "

    Migrate pages from v1 to v2 (don't overwrite existing v2 pages)

    "; if ($difflist) { echo "

    The following $dcount pages exist only in the version 1 wiki.d/ directory.

    or

    "; foreach($difflist as $p) echo "
    $p
    \n"; } else { echo "

    There aren't any pages in your version 1 wiki.d/ directory that are not already in your version 2 directory.

    "; } echo "

    Migrate pages from v1 to v2 (overwrite existing v2 pages)

    The following $bcount pages exist in both the version 1 and version 2 wiki.d/ directories. If you use one of the buttons below, then your converted version 1 pages will overwrite the existing version 2 pages, and you will lose any edits that you might have made in the version 2 installation (it's possible that this is what you want).

    or

    "; foreach($bothlist as $p) echo "
    $p
    \n"; echo "
    \n"; exit(); }