Update of /cvsroot/geshi/geshi-1.0.X/src
In directory
sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31241/src
Modified Files:
Tag: RELEASE_1_0_7_STABLE
geshi.php
Log Message:
Fixed add_ids causing odd XHTML (RyanJ).
Index: geshi.php
============================================================
=======
RCS file: /cvsroot/geshi/geshi-1.0.X/src/geshi.php,v
retrieving revision 1.40.2.5
retrieving revision 1.40.2.6
diff -C2 -d -r1.40.2.5 -r1.40.2.6
*** geshi.php 22 Jul 2006 11:30:40 -0000 1.40.2.5
--- geshi.php 30 Jul 2006 06:43:39 -0000 1.40.2.6
***************
*** 579,583 ****
function set_overall_id ($id)
{
! $this->overall_id = $id;
}
--- 579,583 ----
function set_overall_id ($id)
{
! $this->overall_id = $id;
}
***************
*** 2270,2273 ****
--- 2270,2278 ----
$parsed_code =
preg_replace('#<div[^>]+>(\s*)</div>#',
'\\1', $parsed_code);
+ // If we are using IDs for line numbers, there
needs to be an overall
+ // ID set to prevent collisions.
+ if ($this->add_ids &&
!$this->overall_id) {
+ $this->overall_id = 'geshi-' .
substr(md5(microtime()), 0, 4);
+ }
// If we're using line numbers, we insert
<li>s and appropriate
***************
*** 2325,2337 ****
// Are we supposed to use ids? If so, add
them
if ($this->add_ids) {
- //$attr .= "
id=\"{$this->overall_id}-{$i}\"";
$attrs['id'][] =
"$this->overall_id-$i";
}
if ($this->use_classes &&
in_array($i, $this->highlight_extra_lines)) {
- //$attr .= "
class=\"ln-xtra\"";
$attrs['class'][] = 'ln-xtra';
}
if (!$this->use_classes &&
in_array($i, $this->highlight_extra_lines)) {
- //$attr .= "
style=\"{$this->highlight_extra_lines_style}\&qu
ot;";
$attrs['style'][] =
$this->highlight_extra_lines_style;
}
--- 2330,2339 ----
***************
*** 2340,2345 ****
$attr_string = ' ';
foreach ($attrs as $key => $attr) {
! $attr_string .= $key . '="' .
implode(' ', $attr) . '"';
}
$parsed_code .=
"<li$attr_string>$start$line$end</li>$ls&
quot;;
$attrs = array();
--- 2342,2348 ----
$attr_string = ' ';
foreach ($attrs as $key => $attr) {
! $attr_string .= $key . '="' .
implode(' ', $attr) . '" ';
}
+ $attr_string = substr($attr_string, 0,
-1);
$parsed_code .=
"<li$attr_string>$start$line$end</li>$ls&
quot;;
$attrs = array();
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys
-- and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
geshi-cvs mailing list
geshi-cvs lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geshi-cvs
|