diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2007-04-14 08:47:59 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2007-04-14 08:47:59 +0000 |
| commit | fbb73af3de169163dfb88cf40f1b38fd1f42ab24 (patch) | |
| tree | cde3f53ef939acb487c397caef98f18caf52cc10 | |
| parent | 7524d1be2512c70efce89337ea8de204bfb62ee5 (diff) | |
| download | liberty-fbb73af3de169163dfb88cf40f1b38fd1f42ab24.tar.gz liberty-fbb73af3de169163dfb88cf40f1b38fd1f42ab24.tar.bz2 liberty-fbb73af3de169163dfb88cf40f1b38fd1f42ab24.zip | |
change parser to allow headings and lists on the same line as the beginning of a box start.
e.g.: this is now possible:
^!heading
text^
| -rw-r--r-- | plugins/format.tikiwiki.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/format.tikiwiki.php b/plugins/format.tikiwiki.php index c260e4d..2af8e22 100644 --- a/plugins/format.tikiwiki.php +++ b/plugins/format.tikiwiki.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.91 $ + * @version $Revision: 1.92 $ * @package liberty */ global $gLibertySystem; @@ -912,8 +912,8 @@ class TikiWikiParser extends BitBase { } */ - // Replace boxes - $data = preg_replace("/\^([^\^]+)\^/", "<div class=\"bitbox\">$1</div>", $data); + // Replace boxes - add a new line that we can have something like: ^!heading^ without the need for a \n after the initial ^ - \n will be removed below + $data = preg_replace("/\^([^\^]+)\^/", "<div class=\"bitbox\"><!-- bitremovebr -->\n$1</div>", $data); // Replace colors ~~color:text~~ $data = preg_replace("/\~\~([^\:]+):([^\~]+)\~\~/", "<span style=\"color:$1;\">$2</span>", $data); // Replace background colors ++color:text++ @@ -1401,7 +1401,7 @@ class TikiWikiParser extends BitBase { if (($listate == '+' || $listate == '-') && !($litype == '*' && !strstr(current($listbeg), '</ul>') || $litype == '#' && !strstr(current($listbeg), '</ol>'))) { $thisid = 'id' . microtime() * 1000000; - $data .= '<br/><a id="flipper' . $thisid . '" href="javascript:flipWithSign(\'' . $thisid . '\')">[' . ($listate == '-' ? '+' : '-') . ']</a>'; + $data .= '<br /><a id="flipper' . $thisid . '" href="javascript:flipWithSign(\'' . $thisid . '\')">[' . ($listate == '-' ? '+' : '-') . ']</a>'; $listyle = ' id="' . $thisid . '" style="display:' . ($listate == '+' ? 'block' : 'none') . ';"'; $addremove = 1; } @@ -1422,7 +1422,7 @@ class TikiWikiParser extends BitBase { if (($listate == '+' || $listate == '-')) { $thisid = 'id' . microtime() * 1000000; - $data .= '<br/><a id="flipper' . $thisid . '" href="javascript:flipWithSign(\'' . $thisid . '\')">[' . ($listate == '-' ? '+' : '-') . ']</a>'; + $data .= '<br /><a id="flipper' . $thisid . '" href="javascript:flipWithSign(\'' . $thisid . '\')">[' . ($listate == '-' ? '+' : '-') . ']</a>'; $listyle = ' id="' . $thisid . '" style="display:' . ($listate == '+' ? 'block' : 'none') . ';"'; $addremove = 1; } @@ -1450,7 +1450,7 @@ class TikiWikiParser extends BitBase { $liclose = '<li>'; } else - $liclose = '<br/>'; + $liclose = '<br />'; } else $liclose = ''; @@ -1522,7 +1522,7 @@ class TikiWikiParser extends BitBase { } else { // Usual paragraph. if ($inTable == 0 && !preg_match("/\{maketoc.*?\}/i",$line)) { - $line .= '<br/>'; + $line .= '<br />'; } } } @@ -1559,10 +1559,12 @@ class TikiWikiParser extends BitBase { $data = $handler($data); } + $data = str_replace( "<!-- bitremovebr --><br />", "", $data ); + global $gLibertySystem; // create a table of contents for this page // this function is called manually, since it processes the HTML code - if( preg_match( "/\{maketoc.*?\}/i", $data ) && @$gLibertySystem->mPlugins['datamaketoc']['is_active'] == 'y' ) { + if( preg_match( "/\{maketoc.*?\}/i", $data ) && $gLibertySystem->isPluginActive( 'datamaketoc' )) { $data = data_maketoc($data); } |
