cvs: phd(PHD_0_4) / package.xml /formats xhtml.php
| From: | Christian Weiske | Date: | Tue, 05 May 2009 19:10:34 +0000 |
| Subject: | cvs: phd(PHD_0_4) / package.xml /formats xhtml.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-3967@lists.php.net to get a copy of this message | ||
cweiske Tue May 5 19:10:34 2009 UTC
Modified files: (Branch: PHD_0_4)
/phd package.xml
/phd/formats xhtml.php
Log:
MFH: Support <tag> classes
http://cvs.php.net/viewvc.cgi/phd/package.xml?r1=1.74.2.19.2.63&r2=1.74.2.19.2.64&diff_format=u
Index: phd/package.xml
diff -u phd/package.xml:1.74.2.19.2.63 phd/package.xml:1.74.2.19.2.64
--- phd/package.xml:1.74.2.19.2.63 Mon May 4 05:42:54 2009
+++ phd/package.xml Tue May 5 19:10:34 2009
@@ -41,7 +41,7 @@
<active>yes</active>
</developer>
- <date>2009-03-07</date>
+ <date>2009-05-05</date>
<version>
<release>0.4.7</release>
<api>0.4.6</api>
@@ -56,6 +56,7 @@
* Danish
* Swedish
- Support <token> (Christian)
+ - Properly support <tag> classes (Christian)
</notes>
<contents>
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.67.2.2.2.28&r2=1.67.2.2.2.29&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.67.2.2.2.28 phd/formats/xhtml.php:1.67.2.2.2.29
--- phd/formats/xhtml.php:1.67.2.2.2.28 Mon May 4 05:42:22 2009
+++ phd/formats/xhtml.php Tue May 5 19:10:34 2009
@@ -1,5 +1,5 @@
<?php
-/* $Id: xhtml.php,v 1.67.2.2.2.28 2009/05/04 05:42:22 cweiske Exp $ */
+/* $Id: xhtml.php,v 1.67.2.2.2.29 2009/05/05 19:10:34 cweiske Exp $ */
class XHTMLPhDFormat extends PhDFormat {
protected $elementmap = array( /* {{{ */
@@ -232,7 +232,7 @@
'systemitem' => 'format_systemitem',
'symbol' => 'span',
'synopsis' => 'pre',
- 'tag' => 'code',
+ 'tag' => 'format_tag',
'table' => 'format_table',
'term' => 'format_term',
'tfoot' => 'format_th',
@@ -1166,6 +1166,45 @@
return "</b></caption>";
}
+ /**
+ * Renders a <tag class=""> tag.
+ *
+ * @return string HTML code
+ */
+ public function format_tag($open, $name, $attrs, $props)
+ {
+ static $arFixes = array(
+ 'attribute' => array('', ''),
+ 'attvalue' => array('"', '"'),
+ 'comment' => array('<!--', '-->'),
+ 'element' => array('', ''),
+ 'emptytag' => array('<', '/>'),
+ 'endtag' => array('</', '>'),
+ 'genentity' => array('&', ';'),
+ 'localname' => array('', ''),
+ 'namespace' => array('', ''),
+ 'numcharref' => array('&#', ';'),
+ 'paramentity' => array('%', ';'),
+ 'pi' => array('<?', '?>'),
+ 'prefix' => array('', ''),
+ 'starttag' => array('<', '>'),
+ 'xmlpi' => array('<?', '?>'),
+ );
+ if ($props['empty']) {
+ return '';
+ }
+ $class = $attrs['class'];
+ if (!isset($arFixes[$class])) {
+ trigger_error('Unknown tag class "' . $class . '"',
E_USER_WARNING);
+ $class = 'starttag';
+ }
+ if (!$open) {
+ return $arFixes[$class][1] . '</code>';
+ }
+
+ return '<code>' . $arFixes[$class][0];
+ }
+
public function format_mediaobject($open, $name, $attrs) {
$this->cchunk["mediaobject"] = $this->dchunk["mediaobject"];
if ($open) {