techtonik Sat Oct 30 08:55:22 2004 EDT
Modified files: /phpdoc/htmlhelp filter_files.php Log: fix inserting first div to make document invisible by default add error reporting for this operation http://cvs.php.net/diff.php/phpdoc/htmlhelp/filter_files.php?r1=1.6&r2=1.7&ty=u Index: phpdoc/htmlhelp/filter_files.php diff -u phpdoc/htmlhelp/filter_files.php:1.6 phpdoc/htmlhelp/filter_files.php:1.7 --- phpdoc/htmlhelp/filter_files.php:1.6 Fri Oct 29 05:58:18 2004 +++ phpdoc/htmlhelp/filter_files.php Sat Oct 30 08:55:21 2004 @@ -116,19 +116,24 @@ // Add divisions for skin support // Make the document invisible by default, adding a new first div - $content = preg_replace( - '!(<div class="(\w+)">)!Us', - '<div id="pageContent" style="display:none;">\1<div id="pageHeaders">', - $content, - 1 - ); + $bodystart_regex = '!(<div class="(\w+)"( lang=\"\w+\")?>)!Us'; + if (preg_match($bodystart_regex, $content)) { + $content = preg_replace( + $bodystart_regex, + '<div id="pageContent" style="display:none;">\1<div id="pageHeaders">', + $content, + 1 + ); - // Put there the end of this pageContent - $content = str_replace( - '</body></html>', - '</div></body></html>', - $content - ); + // Put there the end of this pageContent + $content = str_replace( + '</body></html>', + '</div></body></html>', + $content + ); + } else { + echo "Can't add first div. No match.\n"; + } // For headers we have several possibilities if (strpos($content, '<div class="refnamediv">') !== FALSE) { @@ -200,7 +205,7 @@ "formatPre", $content ); - + //------------------------------------------------------------------ // Put <p> tags after all </ul> or </div> or </table> close tags to // enable CSS support for those paragraphs (these break a <p>)