philip          Mon Jan  3 15:21:27 2005 EDT

  Modified files:              
    /phpdoc/scripts     xml_proto.php 
  Log:
  Implemented the new doc style
  
  
http://cvs.php.net/diff.php/phpdoc/scripts/xml_proto.php?r1=1.18&r2=1.19&ty=u
Index: phpdoc/scripts/xml_proto.php
diff -u phpdoc/scripts/xml_proto.php:1.18 phpdoc/scripts/xml_proto.php:1.19
--- phpdoc/scripts/xml_proto.php:1.18   Sun Jan  2 15:40:01 2005
+++ phpdoc/scripts/xml_proto.php        Mon Jan  3 15:21:26 2005
@@ -16,7 +16,7 @@
   | Authors:   Brad House <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
  
-  $Id: xml_proto.php,v 1.18 2005/01/02 20:40:01 didou Exp $
+  $Id: xml_proto.php,v 1.19 2005/01/03 20:21:26 philip Exp $
 */
 
 /*
@@ -52,9 +52,10 @@
                 - Requires PHP 4.3.0-pre1 or higher now
                 - Usage is totally different
    05/06/04 v2.1 - Corrected filenames for OO functions
+   01/03/05 v2.2 - Implemented the new doc style
 */
 
-$version="2.1";
+$version="2.2";
 
 $funclist=array();
 $num_funcs=0;
@@ -137,8 +138,8 @@
     return(0);
   }
 
-  fwrite($fp, "<?xml version='1.0' encoding='iso-8859-1'?>\n" .
-       "<!-- $" . "Revision: 1.1 " . "$ -->\n" .
+  fwrite($fp, '<?xml version="1.0" encoding="iso-8859-1"?>'."\n" .
+       '<!-- $Revision: 1.19 $ -->'."\n" .
        "<!-- Generated by xml_proto.php v" . $version . ". Found in /scripts 
directory of phpdoc. -->\n" .
        "<reference id=\"ref." . $extension_name . "\">\n" .
        " <title>$extension_name Functions</title>\n" .
@@ -152,17 +153,28 @@
        "    currently only lists the proto definitions.\n" .
        "   </para>\n" .
        "  </section>\n" .
-       "  <section id=\"" . $extension_name . ".installation\">\n" .
-       "   &reftitle.install;\n" .
+       "  <section id=\"" . $extension_name . ".requirements\">\n" .
+       "   &reftitle.required;\n" .
+       "   <para>\n" .
+       "    To be written. For example what external libraries are required\n" 
.
+       "   </para>\n" .
+       "  </section>\n\n" .
+       "  <!-- Information found in configure.xml -->\n" .
+       "  &reference.".$extension_name.".configure\n" .
+       "  <!-- Information found in ini.xml -->\n" .
+       "  &reference.".$extension_name.".ini\n\n" .
+       "  <section id=\"" . $extension_name . ".resources\">\n" .
+       "   &reftitle.resources;\n" .
        "   <para>\n" .
-       "    To be written. Probably running configure with the\n" .
-       "    <option role=\"configure\">--with-" . $extension_name . 
"</option>\n" .
-       "    will properly enable this module.\n" .
+       "    Type of resource types (link id, etc.) this extension returns.\n" .
+       "    &no.resources;\n" .
        "   </para>\n" .
        "  </section>\n" .
+       "  <!-- Information found in constants.xml -->\n" .
+       "  &references.".$extension_name."constants\n" .
        " </partintro>\n" .
        " &reference." . $extension_name . ".functions;\n" .
-       "</reference>\n" .
+       "</reference>\n\n" .
        "<!-- Keep this comment at the end of the file\n" .
        "Local variables:\n" .
        "mode: sgml\n" .
@@ -209,8 +221,8 @@
     $purpose  = trim($funclist[$i]["purpose"]);
     $functype = trim($funclist[$i]["function_type"]);
 
-    fwrite($fp, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n" .
-               "<!-- $" . "Revision: 1.1 $ -->\n" .
+    fwrite($fp, '<?xml version="1.0" encoding="iso-8859-1"?>'."\n" .
+               '<!-- $Revision: 1.19 $ -->'."\n" .
                "<!-- Generated by xml_proto.php v" . $version . ". Found in 
/scripts directory of phpdoc. -->\n" .
                "<refentry id=\"function." . $fixname . "\">\n" .
                " <refnamediv>\n" .
@@ -224,6 +236,7 @@
                "  <methodsynopsis>\n" .
                "   
<type>$functype</type><methodname>$funcname</methodname>\n");
 
+    $argnames = array();
     for ($j=0; $j<$funclist[$i]["num_args"]; $j++) {
       $argtype = $funclist[$i]["args"][$j]["type"];
       $argname = $funclist[$i]["args"][$j]["variable"];
@@ -233,6 +246,7 @@
       }
       $isopt=$funclist[$i]["args"][$j]["isopt"];
       fwrite($fp, "   <methodparam" . ($isopt ? " choice=\"opt\"" : "") . 
"><type>$argtype</type><parameter" . ($isref ? " role=\"reference\"" : "") . 
">$argname</parameter></methodparam>\n");
+      $argnames[] = $argname;
 
     }
     if ($funclist[$i]["num_args"] == 0){
@@ -242,28 +256,138 @@
     fwrite($fp, "  </methodsynopsis>\n\n" .
                "  &warn.undocumented.func;\n\n" .
                " </refsect1>\n" .
-               "</refentry>\n" .
-               "\n" .
-               "<!-- Keep this comment at the end of the file\n" .
-               "Local variables:\n" .
-               "mode: sgml\n" .
-               "sgml-omittag:t\n" .
-               "sgml-shorttag:t\n" .
-               "sgml-minimize-attributes:nil\n" .
-               "sgml-always-quote-attributes:t\n" .
-               "sgml-indent-step:1\n" .
-               "sgml-indent-data:t\n"; .
-               "indent-tabs-mode:nil\n" .
-               "sgml-parent-document:nil\n" .
-               "sgml-default-dtd-file:\"../../../../manual.ced\"\n" .
-               "sgml-exposed-tags:nil\n" .
-               "sgml-local-catalogs:nil\n" .
-               "sgml-local-ecat-files:nil\n" .
-               "End:\n" .
-               "vim600: syn=xml fen fdm=syntax fdl=2 si\n" .
-               "vim: et tw=78 syn=sgml\n" .
-               "vi: ts=1 sw=1\n" .
-               "-->\n");
+               " <refsect1 role=\"parameters\">\n" .
+               "  &reftitle.parameters;\n" .
+               "  <para>\n"
+    );
+    if (count($argnames) > 0) {
+        $tmp = "   <variablelist>\n";
+        foreach ($argnames as $argname) {
+            $tmp .= '' .
+            "    <varlistentry>\n" .
+            "     <term><parameter>{$argname}</parameter></term>\n" .
+            "      <listitem>\n" .
+            "       <para>\n" .
+            "        Its description\n" .
+            "       </para>\n" .
+            "      </listitem>\n" .
+            "     </varlistentry>\n";
+        }
+        $tmp .= "   </variablelist>\n  </para>\n </refsect1>\n";
+        fwrite($fp, $tmp);
+    }
+    fwrite($fp, 
+        " <refsect1 role=\"returnvalues\">\n" .
+        "  &reftitle.returnvalues;\n" .
+        "  <para>\n" .
+        "   What the function returns, first on success, then on failure. 
See\n" .
+        "   also the &return.success; entity\n" .
+        "  </para>\n" .
+        " </refsect1>\n"
+    );
+    fwrite($fp,
+        "\n <!-- Use when EXCEPTIONS exist\n" .
+        " <refsect1 role=\"exceptions\">\n" .
+        "  &reftitle.exceptions;\n" .
+        "  <para>\n" .
+        "   When does this function throw exceptions?\n" .
+        "  </para>\n" .
+        " </refsect1>\n" .
+        " -->\n\n"
+    );
+    fwrite($fp,
+        "\n <!-- Use when a CHANGELOG exists\n" .
+        " <refsect1 role=\"changelog\">\n" .
+        "  &reftitle.changelog;\n" .
+        "  <para>\n" .
+        "   <informaltable>\n" .
+        "    <tgroup cols=\"2\">\n" .
+        "     <thead>\n" .
+        "      <row>\n" .
+        "       <entry>&Version;</entry>\n" .
+        "       <entry>&Description</entry>\n" .
+        "      </row>\n" .
+        "     </thead>\n" .
+        "     <tbody>\n" .
+        "      <row>\n" .
+        "       <entry>Enter the PHP version of change here\n" .
+        "       <entry>Description of change\n" .
+        "      </row>\n" .
+        "     </tbody>\n" .
+        "    </tgroup>\n" .
+        "   </informaltable>\n" .
+        "  </para>\n" .
+        " </refsect1>\n" .
+        " -->\n\n"
+    );
+    fwrite($fp,
+        "\n <!-- Use when examples exist\n" .
+        " <refsect1 role=\"examples\">\n" .
+        "  &reftitle.examples;\n" .
+        "  <para>\n" .
+        "   <example>\n" .
+        "    <title><function>A " . $fixname . " example</title>\n" .
+        "    <para>\n" .
+        "     Any text that describes the purpose of the example, or\n" .
+        "     what goes on in the example should go here (inside the\n" .
+        "     <example> tag, not out\n" .
+        "    </para>\n" .
+        "    <programlisting role=\"php\">\n" .
+        "<![CDATA[\n" .
+        "<?php\n" .
+        "if (\$anexample === true) {\n" .
+        "    echo 'Use the PEAR Coding Standards';\n" .
+        "}\n" .
+        "?>\n" .
+        "]]>\n" .
+        "    </programlisting>\n" .
+        "    &example.outputs;\n" .
+        "    <screen>\n" .
+        "<!CDATA[\n" .
+        "Use the PEAR Coding Standards\n" .
+        "]]>\n" .
+        "    </screen>\n" .
+        "   </example>\n" .
+        "  </para>\n" .
+        " </refsect1>\n" .
+        " -->\n\n"
+    );
+    fwrite($fp,
+        "\n <!-- Use when adding See Also links\n" .
+        " <refsect1 role=\"seealso\">\n" .
+        "  &reftitle.seealso;\n" .
+        "  <para>\n" .
+        "   <simplelist>\n" .
+        "    <member><function></function></member>\n" .
+        "    <member>Or <link linkend=\"somethingelse\">something 
else</link></member>\n" .
+        "   </simplelist>\n" .
+        "  </para>\n" .
+        " </refsect1>\n" .
+        " -->\n\n"
+    );
+    fwrite($fp,
+        "\n</refentry>\n\n" .
+        "<!-- Keep this comment at the end of the file\n" .
+        "Local variables:\n" .
+        "mode: sgml\n" .
+        "sgml-omittag:t\n" .
+        "sgml-shorttag:t\n" .
+        "sgml-minimize-attributes:nil\n" .
+        "sgml-always-quote-attributes:t\n" .
+        "sgml-indent-step:1\n" .
+        "sgml-indent-data:t\n"; .
+        "indent-tabs-mode:nil\n" .
+        "sgml-parent-document:nil\n" .
+        "sgml-default-dtd-file:\"../../../../manual.ced\"\n" .
+        "sgml-exposed-tags:nil\n" .
+        "sgml-local-catalogs:nil\n" .
+        "sgml-local-ecat-files:nil\n" .
+        "End:\n" .
+        "vim600: syn=xml fen fdm=syntax fdl=2 si\n" .
+        "vim: et tw=78 syn=sgml\n" .
+        "vi: ts=1 sw=1\n" .
+        "-->\n"
+    );
     fclose($fp);
     echo "Wrote: $filename\n";
   }

Reply via email to