From: Geoffrey T. D. <da...@us...> - 2002-09-17 15:23:37
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv25414/lib Modified Files: stdlib.php InlineParser.php Log Message: Add $markup parameter to TransformInline() so that it can be used to transform old-style inline markup as well as new. Index: stdlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v retrieving revision 1.123 retrieving revision 1.124 diff -u -2 -b -p -d -r1.123 -r1.124 --- stdlib.php 17 Sep 2002 02:35:31 -0000 1.123 +++ stdlib.php 17 Sep 2002 15:23:32 -0000 1.124 @@ -489,8 +489,12 @@ function ExtractLinks($content) { * Convert old page markup to new-style markup. * - * @param $text string Old-style wiki markup. + * @param string $text Old-style wiki markup. * - * @param $just_links bool Only convert old-style links. - * (Really this only converts escaped old-style links.) + * @param string $markup_type + * One of: <dl> + * <dt><code>"block"</code> <dd>Convert all markup. + * <dt><code>"inline"</code> <dd>Convert only inline markup. + * <dt><code>"links"</code> <dd>Convert only link markup. + * </dl> * * @return string New-style wiki markup. @@ -498,5 +502,5 @@ function ExtractLinks($content) { * @bugs FIXME: footnotes and old-style tables are known to be broken. */ -function ConvertOldMarkup ($text, $just_links = false) { +function ConvertOldMarkup ($text, $markup_type = "block") { static $orig, $repl, $link_orig, $link_repl; @@ -542,8 +546,10 @@ function ConvertOldMarkup ($text, $just_ - if ($just_links) - return preg_replace($link_orig, $link_repl, $text); - else + if ($markup_type == "block") { return preg_replace($orig, $repl, $text); + } + else { + return preg_replace($link_orig, $link_repl, $text); + } } Index: InlineParser.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/InlineParser.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -2 -b -p -d -r1.12 -r1.13 --- InlineParser.php 16 Sep 2002 22:12:48 -0000 1.12 +++ InlineParser.php 17 Sep 2002 15:23:33 -0000 1.13 @@ -452,5 +452,5 @@ class LinkTransformer extends InlineTran } -function TransformInline($text) { +function TransformInline($text, $markup = 2.0) { static $trfm; @@ -459,4 +459,8 @@ function TransformInline($text) { } + if ($markup < 2.0) { + $text = ConvertOldMarkup($text, 'inline'); + } + return $trfm->parse($text); } @@ -469,6 +473,7 @@ function TransformLinks($text, $markup = } - if ($markup < 2.0) + if ($markup < 2.0) { $text = ConvertOldMarkup($text, 'links'); + } return $trfm->parse($text); |