|
From: Geoffrey T. D. <da...@us...> - 2001-03-02 03:47:23
|
Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv25794/lib
Modified Files:
Tag: release-1_2-branch
stdlib.php transform.php
Log Message:
Some fixes to clean-up generated HTML.
See comments made on SF Task# 26974 for details about problems
which remain.
Index: stdlib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v
retrieving revision 1.21.2.1
retrieving revision 1.21.2.2
diff -C2 -r1.21.2.1 -r1.21.2.2
*** stdlib.php 2001/02/08 18:28:31 1.21.2.1
--- stdlib.php 2001/03/02 03:48:47 1.21.2.2
***************
*** 219,225 ****
} elseif ($level > $stack->cnt()) {
! // we add the diff to the stack
! // stack might be zero
! while ($stack->cnt() < $level) {
$retvar .= "<$tag>\n";
$stack->push($tag);
--- 219,234 ----
} elseif ($level > $stack->cnt()) {
! // Test for and close top level elements which are not allowed to contain
! // other block-level elements.
! if ($stack->cnt() == 1 and
! preg_match('/^(p|pre|h\d)$/i', $stack->top()))
! {
! $closetag = $stack->pop();
! $retvar .= "</$closetag>";
! }
!
! // we add the diff to the stack
! // stack might be zero
! while ($stack->cnt() < $level) {
$retvar .= "<$tag>\n";
$stack->push($tag);
Index: transform.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/transform.php,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -r1.8 -r1.8.2.1
*** transform.php 2001/01/04 18:34:15 1.8
--- transform.php 2001/03/02 03:48:47 1.8.2.1
***************
*** 137,142 ****
$tmpline = str_replace('<', '<', $tmpline);
- // four or more dashes to <hr>
- $tmpline = ereg_replace("^-{4,}", '<hr>', $tmpline);
// %%% are linebreaks
--- 137,140 ----
***************
*** 233,236 ****
--- 231,241 ----
$html .= SetHTMLOutputMode($heading, ZERO_LEVEL, 0);
+ } elseif (preg_match('/^-{4,}\s*(.*?)\s*$/', $tmpline, $matches)) {
+ // four or more dashes to <hr>
+ // <hr> can not be contained in a
+ $html .= SetHTMLOutputMode('', ZERO_LEVEL, 0) . "<hr>\n";
+ if ( ($tmpline = $matches[1]) != '' ) {
+ $html .= SetHTMLOutputMode('p', ZERO_LEVEL, 0);
+ }
} else {
// it's ordinary output if nothing else
***************
*** 238,241 ****
--- 243,249 ----
}
+ // These are still problems as far as generating correct HTML is
+ // concerned. Paragraph (<p>) elements are not allowed to contain
+ // other block-level elements (like <form>s).
$tmpline = str_replace('%%Search%%', $quick_search_box, $tmpline);
$tmpline = str_replace('%%Fullsearch%%', $full_search_box, $tmpline);
|