Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-08-03 07:07:25


Author: danieljames
Date: 2008-08-03 07:07:25 EDT (Sun, 03 Aug 2008)
New Revision: 47960
URL: http://svn.boost.org/trac/boost/changeset/47960

Log:
Improve the code for stripping out the header table.
Text files modified:
   website/public_html/beta/common/code/boost_archive.php | 27 +++++++++++----------------
   1 files changed, 11 insertions(+), 16 deletions(-)

Modified: website/public_html/beta/common/code/boost_archive.php
==============================================================================
--- website/public_html/beta/common/code/boost_archive.php (original)
+++ website/public_html/beta/common/code/boost_archive.php 2008-08-03 07:07:25 EDT (Sun, 03 Aug 2008)
@@ -325,23 +325,18 @@
         }
         
         # nasty code, because (?!fubar) causes an ICE...
- preg_match('@<table_at_i',$text,$table_begin,PREG_OFFSET_CAPTURE);
+ preg_match('@<table[^<>]*>?@i',$text,$table_begin,PREG_OFFSET_CAPTURE);
         preg_match('@</table>@i',$text,$table_end,PREG_OFFSET_CAPTURE);
- if (isset($table_begin[0]) && isset($table_end[0]) &&
- strpos(substr($text,0,$table_end[0][1]),'boost.png',$table_begin[0][1]) !== FALSE)
- {
- $text = substr($text,$table_end[0][1]+strlen($table_end[0][0]));
- }
-
- preg_match('@<h[12]@i',$text,$h1_begin,PREG_OFFSET_CAPTURE);
- preg_match('@</h[12]>@i',$text,$h1_end,PREG_OFFSET_CAPTURE);
- preg_match('@<table_at_i',$text,$table_begin,PREG_OFFSET_CAPTURE);
- preg_match('@</table>@i',$text,$table_end,PREG_OFFSET_CAPTURE);
- if (isset($h1_begin[0]) && isset($table_end[0]) &&
- $table_begin[0][1] < $h1_begin[0][1] && $h1_begin[0][1] < $table_end[0][1]+8)
- {
- $text = substr($text,$h1_begin[0][1],
- $h1_begin[0][1]-$h1_end[0][1]+5) . substr($text,$table_end[0][1]+8);
+ if (isset($table_begin[0]) && isset($table_end[0])) {
+ $table_contents_start = $table_begin[0][1] + strlen($table_begin[0][0]);
+ $table_contents = substr($text, $table_contents_start,
+ $table_end[0][1] - $table_contents_start);
+ if(strpos($table_contents, 'boost.png') !== FALSE) {
+ preg_match('@<td[^<>]*>?([^<]*<(h[12]|p).*?)</td>@is', $table_contents,
+ $table_contents_header, PREG_OFFSET_CAPTURE);
+ $text = (isset($table_contents_header[1]) ? $table_contents_header[1][0] : '').
+ substr($text, $table_end[0][1] + 8);
+ }
         }
         #else
         #{


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk