cvs: phd /formats xhtml.php
| From: | Hannes Magnusson | Date: | Sat, 29 Sep 2007 15:46:37 +0000 |
| Subject: | cvs: phd /formats xhtml.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-96@lists.php.net to get a copy of this message | ||
bjori Sat Sep 29 15:46:37 2007 UTC
Modified files:
/phd/formats xhtml.php
Log:
Implemented: initializer, procedure, seg, segmentedlist, seglistitem, segtitle & step
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.27&r2=1.28&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.27 phd/formats/xhtml.php:1.28
--- phd/formats/xhtml.php:1.27 Sat Sep 29 14:37:16 2007
+++ phd/formats/xhtml.php Sat Sep 29 15:46:37 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: xhtml.php,v 1.27 2007/09/29 14:37:16 bjori Exp $ */
+/* $Id: xhtml.php,v 1.28 2007/09/29 15:46:37 bjori Exp $ */
class XHTMLPhDFormat extends PhDFormat {
protected $elementmap = array( /* {{{ */
@@ -84,6 +84,7 @@
'info' => 'div',
'informalexample' => 'div',
'informaltable' => 'table',
+ 'initializer' => 'format_initializer',
'itemizedlist' => 'ul',
'listitem' => array(
/* DEFAULT */ 'li',
@@ -122,6 +123,7 @@
'partintro' => 'div',
'personname' => 'span',
'preface' => 'format_chunk',
+ 'procedure' => 'format_procedure',
'productname' => 'span',
'programlisting' => 'format_programlisting',
'propname' => 'span',
@@ -147,6 +149,10 @@
'sect4' => 'format_chunk',
'sect5' => 'format_chunk',
'section' => 'format_chunk',
+ 'seg' => 'format_seg',
+ 'segmentedlist' => 'format_segmentedlist',
+ 'seglistitem' => 'format_seglistitem',
+ 'segtitle' => 'format_suppressed_tags',
'set' => 'format_chunk',
'setindex' => 'format_chunk',
'simplelist' => 'ul', /* FIXME: simplelists has few
attributes that need to be implemented */
@@ -157,6 +163,7 @@
'entry' => 'span',
'example' => 'format_example_content',
),
+ 'step' => 'format_step',
'systemitem' => 'format_systemitem',
'synopsis' => 'pre',
'tag' => 'code',
@@ -177,6 +184,7 @@
),
'legalnotice' => 'h4',
'note' => 'format_note_title',
+ 'procedure' => 'b',
'refsect1' => 'h3',
'refsect2' => 'h4',
'refsect3' => 'h5',
@@ -184,6 +192,7 @@
'sect1' => 'h2',
'sect2' => 'h3',
'sect3' => 'h4',
+ 'segmentedlist' => 'strong',
'table' => 'format_bold_paragraph',
),
'type' => 'span',
@@ -199,6 +208,7 @@
'year' => 'span',
); /* }}} */
protected $textmap = array(
+ 'segtitle' => 'format_segtitle_text',
);
@@ -233,6 +243,10 @@
public function TEXT($str) {
return htmlspecialchars($str, ENT_QUOTES, "UTF-8");
}
+ public function format_suppressed_tags($open, $name, $attrs) {
+ /* Ignore it */
+ return "";
+ }
public function format_copyright($open, $name, $attrs) {
if ($open) {
@@ -338,7 +352,12 @@
return ' <tt class="parameter">$';
}
return "</tt>";
-
+ }
+ public function format_initializer($open, $name, $attrs) {
+ if ($open) {
+ return '<span class="'.$name.'">=';
+ }
+ return '</span>';
}
public function format_parameter($open, $name, $attrs) {
if ($open) {
@@ -388,6 +407,50 @@
}
return "</var>\n";
}
+
+ public function format_segmentedlist($open, $name, $attrs) {
+ $this->tmp["segmentedlist"] = array("segtitle" => array());
+ if ($open) {
+ return '<div class="'.$name.'">';
+ }
+ return '</div>';
+ }
+ public function format_segtitle_text($value, $tag) {
+
$this->tmp["segmentedlist"]["segtitle"][count($this->tmp["segmentedlist"]["segtitle"])]
= $value;
+ /* Suppress the text */
+ return "";
+ }
+ public function format_seglistitem($open, $name, $attrs) {
+ if ($open) {
+ $this->tmp["segmentedlist"]["seglistitem"] = 0;
+ return '<div class="'.$name.'">';
+ }
+ return '</div>';
+ }
+ public function format_seg($open, $name, $attrs) {
+ if ($open) {
+ return '<div class="seg"><strong><span
class="segtitle">'
.$this->tmp["segmentedlist"]["segtitle"][$this->tmp["segmentedlist"]["seglistitem"]++].
':</span></strong>';
+ }
+ return '</div>';
+ }
+ public function format_procedure($open, $name, $attrs) {
+ $this->tmp["procedure"] = false;
+ if ($open) {
+ return '<div class="'.$name.'">';
+ }
+ return '</ol></div>';
+ }
+ public function format_step($open, $name, $attrs) {
+ if ($open) {
+ $ret = "";
+ if (!$this->tmp["procedure"]) {
+ $this->tmp["procedure"] = true;
+ $ret = '<ol type="1">';
+ }
+ return $ret . "<li>";
+ }
+ return '</li>';
+ }
public function format_variablelist($open, $name, $attrs) {
if ($open) {
return "<dl>\n";