bjori           Tue Aug  7 20:11:57 2007 UTC

  Modified files:              
    /phd/formats        xhtml.php 
  Log:
  - Implement methodsynopsis
  - Fix simpara in example
  
  
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.12&r2=1.13&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.12 phd/formats/xhtml.php:1.13
--- phd/formats/xhtml.php:1.12  Tue Aug  7 18:03:44 2007
+++ phd/formats/xhtml.php       Tue Aug  7 20:11:57 2007
@@ -1,5 +1,5 @@
 <?php
-/*  $Id: xhtml.php,v 1.12 2007/08/07 18:03:44 bjori Exp $ */
+/*  $Id: xhtml.php,v 1.13 2007/08/07 20:11:57 bjori Exp $ */
 
 class XHTMLPhDFormat extends PhDFormat {
     protected $map = array( /* {{{ */
@@ -103,6 +103,7 @@
             'note'              => 'span',
             'listitem'          => 'span',
             'entry'             => 'span',
+            'example'           => 'format_example_content',
         ),
         'systemitem'            => 'format_systemitem',
         'table'                 => 'format_table',
@@ -209,6 +210,7 @@
         /* We read this element to END_ELEMENT so $open is useless */
         $content = '<div class="methodsynopsis">';
 
+        $opt = $count = 0;
         while($child = PhDFormat::getNextChild($root)) {
             if ($child["type"] == XMLReader::END_ELEMENT) {
                 $content .= "</span>\n";
@@ -216,17 +218,41 @@
             }
             $name = $child["name"];
             switch($name) {
-            case "type":
             case "parameter":
+                $content .= sprintf('<span class="%s">%s$%s</span>', $name, 
$this->readAttribute("role") == "reference" ? "&" : "", 
$this->readContent($name));
+                break;
+            case "type":
+                $content .= sprintf('<span class="%s">%s</span> ', $name, 
$this->readContent($name));
+                break;
             case "methodname":
-                $content .= sprintf('<span class="%s">%s</span>', $name, 
$this->readContent($name));
+                $content .= sprintf('<span class="%s"><b>%s</b></span>', 
$name, $this->readContent($name));
                 break;
 
             case "methodparam":
-                $content .= '<span class="methodparam">';
+                if ($count == 0) {
+                    $content .= " (";
+                }
+                if ($this->readAttribute("choice") == "opt") {
+                    $opt++;
+                    $content .= "[";
+                } else if($opt) {
+                    $content .= str_repeat("]", $opt);
+                    $opt = 0;
+                }
+                if ($count) {
+                    $content .= ",";
+                }
+                $content .= ' <span class="methodparam">';
+                ++$count;
+
                 break;
             }
         }
+        if ($opt) {
+            $content .= str_repeat("]", $opt);
+        }
+        $content .= ")";
+
         $content .= "</div>";
         return $content;
     }
@@ -243,7 +269,7 @@
             }
         }
         
-        return sprintf('<div class="refnamediv"><span 
class="refname">%s</span><span class="refpurpose">%s</span></div>', $refname, 
$refpurpose);
+        return sprintf('<div class="refnamediv"><h1 class="refname">%s</h1><p 
class="refpurpose">%1$s — %s</p></div>', $refname, $refpurpose);
     }
     public function format_variablelist($open, $name) {
         if ($open) {

Reply via email to