cvs: phd(PHD_0_4) /formats xhtml.php
| From: | Hannes Magnusson | Date: | Thu, 01 Jan 2009 23:59:36 +0000 |
| Subject: | cvs: phd(PHD_0_4) /formats xhtml.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2912@lists.php.net to get a copy of this message | ||
bjori Thu Jan 1 23:59:36 2009 UTC
Modified files: (Branch: PHD_0_4)
/phd/formats xhtml.php
Log:
Fixed bug#45318 (table colspec rendering issues)
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.67.2.2.2.12&r2=1.67.2.2.2.13&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.67.2.2.2.12 phd/formats/xhtml.php:1.67.2.2.2.13
--- phd/formats/xhtml.php:1.67.2.2.2.12 Thu Jan 1 23:09:30 2009
+++ phd/formats/xhtml.php Thu Jan 1 23:59:36 2009
@@ -1,5 +1,5 @@
<?php
-/* $Id: xhtml.php,v 1.67.2.2.2.12 2009/01/01 23:09:30 bjori Exp $ */
+/* $Id: xhtml.php,v 1.67.2.2.2.13 2009/01/01 23:59:36 bjori Exp $ */
class XHTMLPhDFormat extends PhDFormat {
protected $elementmap = array( /* {{{ */
@@ -1318,7 +1318,31 @@
$retval .= ' valign="' .$attrs["valign"]. '"';
}
if (isset($attrs["colwidth"])) {
- $retval .= ' width="' .((int)$attrs["colwidth"]).
'"';
+ $width = $attrs["colwidth"];
+ if (is_numeric($width)) {
+ $retval .= ' width="' .((int)$width). '"';
+ }
+ // N*
+ elseif(($pos = strpos($width, "*")) !== false) {
+ $cols = $this->getColCount();
+ $length = 100/$cols;
+ if (substr($width, -1) !== "*") {
+ trigger_error("Mixing proportion and fixed measure not implemented",
E_USER_WARNING);
+ }
+ // Standard length
+ elseif($width == "*" || $width == "1*") {
+ }
+ else {
+ $width = (int)substr($width, 0, $pos);
+ $length *= $width;
+ }
+ $retval = ' width="' .$length. '%"';
+
+ }
+ // Npt or Npx or other weird format
+ else {
+ $retval .= ' width="' .htmlentities($attrs["colwidth"],
ENT_QUOTES, "UTF-8"). '"';
+ }
}
return $retval;
}