cvs: pear /PEAR_Frontend_Gtk/Gtk WidgetHTML.php
| From: | Alan Knowles | Date: | Tue, 11 Jun 2002 11:04:33 +0000 |
| Subject: | cvs: pear /PEAR_Frontend_Gtk/Gtk WidgetHTML.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4544@lists.php.net to get a copy of this message | ||
alan_k Tue Jun 11 07:04:33 2002 EDT
Modified files:
/pear/PEAR_Frontend_Gtk/Gtk WidgetHTML.php
Log:
added slightly better comment handling
Index: pear/PEAR_Frontend_Gtk/Gtk/WidgetHTML.php
diff -u pear/PEAR_Frontend_Gtk/Gtk/WidgetHTML.php:1.13
pear/PEAR_Frontend_Gtk/Gtk/WidgetHTML.php:1.14
--- pear/PEAR_Frontend_Gtk/Gtk/WidgetHTML.php:1.13 Tue Jun 11 06:47:08 2002
+++ pear/PEAR_Frontend_Gtk/Gtk/WidgetHTML.php Tue Jun 11 07:04:33 2002
@@ -24,10 +24,27 @@
$tok = strtok('<');
$a[] = $tok;
}
-
+ $in_comment = '';
$this->_tokens = array();
foreach($a as $i=>$b) {
if (trim($b) === '') continue;
+
+ if ((substr($b,0,3) == '!--') &&
!preg_match('/-->/m',$b)) {
+ $in_comment = $b;
+ continue;
+ }
+ if ($in_comment)
+ if (preg_match("/\-\-\>/m",$b)) {
+ $tmp = explode('-->',$b);
+ $this->_tokens[] = array('<!--',$in_comment.$tmp[0]);
+ $this->_tokens[] = $tmp[1];
+ $in_comment = '';
+ continue;
+ } else {
+ $in_comment .= $b;
+ continue;
+ }
+
$l = strlen($b)-1;
if ($b{$l} == '>') {
if (($s = strcspn($b," \n")) == strlen($b)) {