cvs: phd /formats xhtml.php

From: Date: Tue, 05 May 2009 19:09:03 +0000
Subject: cvs: phd /formats xhtml.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-3966@lists.php.net to get a copy of this message
cweiske Tue May 5 19:09:03 2009 UTC Modified files: /phd/formats xhtml.php Log: support <tag> classes http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.97&r2=1.98&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.97 phd/formats/xhtml.php:1.98 --- phd/formats/xhtml.php:1.97 Mon May 4 05:43:08 2009 +++ phd/formats/xhtml.php Tue May 5 19:09:03 2009 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.97 2009/05/04 05:43:08 cweiske Exp $ */ +/* $Id: xhtml.php,v 1.98 2009/05/05 19:09:03 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('&lt;!--', '--&gt;'), + 'element' => array('', ''), + 'emptytag' => array('&lt;', '/&gt;'), + 'endtag' => array('&lt;/', '&gt;'), + 'genentity' => array('&amp;', ';'), + 'localname' => array('', ''), + 'namespace' => array('', ''), + 'numcharref' => array('&amp;#', ';'), + 'paramentity' => array('%', ';'), + 'pi' => array('&lt;?', '?&gt;'), + 'prefix' => array('', ''), + 'starttag' => array('&lt;', '&gt;'), + 'xmlpi' => array('&lt;?', '?&gt;'), + ); + 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) {

« previous php.doc.cvs (#3966) next »