philip          Tue Jul 27 02:24:12 2004 EDT

  Modified files:              
    /phpdoc/howto       working.xml 
  Log:
  Added draft for new doc skeleton style, in the form of an example.
  Please review, this is simply a draft (do not implement!)
  
  
http://cvs.php.net/diff.php/phpdoc/howto/working.xml?r1=1.41&r2=1.42&ty=u
Index: phpdoc/howto/working.xml
diff -u phpdoc/howto/working.xml:1.41 phpdoc/howto/working.xml:1.42
--- phpdoc/howto/working.xml:1.41       Wed Jul 21 03:41:32 2004
+++ phpdoc/howto/working.xml    Tue Jul 27 02:24:12 2004
@@ -640,6 +640,154 @@
    mailing list</link>. If you have any suggestions for more skeletons do not
    hesitate.
   </para>
+  <para>
+   And we're introducing a new doc skeleton where multiple refsect1's are
+   used, as well as a lot more entities.  Names in ALLCAPS would be changed
+   so for example RETURNTYPE would instead be bool, string, etc.  Here's a 
+   draft using example_func() as an example.  <emphasis>Do not implement this 
+   style yet!</emphasis>  There are also reftitles for classes, constructors, 
+   and methods.  An OOP doc skeleton will be written in the future.  
+   reftitles are located in <filename>language-defs.ent</filename>.
+  </para>
+  <para>
+   <example>
+    <title>An example example using refsect1's and reftitle entities</title>
+    <programlisting>
+&lt;refentry id="function.example-func"&gt;
+ &lt;refnamediv&gt;
+  &lt;refname&gt;example_func&lt;/refname&gt;
+  &lt;refpurpose&gt;Displays how to write a function man page, no ending period 
here&lt;/refpurpose&gt;
+ &lt;/refnamediv&gt;
+ &lt;refsect1&gt;
+  &amp;reftitle.description;
+  &lt;methodsynopsis&gt;
+   
&lt;type&gt;RETURNTYPE&lt;/type&gt;&lt;methodname&gt;example_func&lt;/methodname&gt;
+   
&lt;methodparam&gt;&lt;type&gt;ARGTYPE1&lt;/type&gt;&lt;parameter&gt;ARGNAME1&lt;/parameter&gt;&lt;/methodparam&gt;
+   
&lt;methodparam&gt;&lt;type&gt;ARGTYPE2&lt;/type&gt;&lt;parameter&gt;ARGNAME2&lt;/parameter&gt;&lt;/methodparam&gt;
+   &lt;!-- parameter takes on a referenced variable --&gt;
+   
&lt;methodparam&gt;&lt;type&gt;ARGTYPE2&lt;/type&gt;&lt;parameter&gt;&amp;amp;ARGNAME2&lt;/parameter&gt;&lt;/methodparam&gt;
+   &lt;!-- optional parameter --&gt;
+   &lt;methodparam 
choice='opt'&gt;&lt;type&gt;ARGTYPE3&lt;/type&gt;&lt;parameter&gt;ARGNAME3&lt;/parameter&gt;&lt;/methodparam&gt;
+   &lt;!-- optional parameter with default value, choice='opt' is default in this 
case --&gt;
+   &lt;methodparam&gt; 
+    &lt;type&gt;ARGTYPE3&lt;/type&gt; 
+    &lt;parameter&gt;ARGNAME3&lt;/parameter&gt;   
+    &lt;initializer&gt;DEFAULTVALUE&lt;/initializter&gt;
+   &lt;/methodparam&gt;
+   &lt;!-- Or, use &lt;void /&gt; if the function has no parameters at all --&gt;
+  &lt;/methodsynopsis&gt;
+  &lt;simpara&gt;
+   We are still in the description section.  The description includes
+   information about the function, like what it does.  This document is no 
+   more than 78 characters in width except for the methodsynopsis.  No tabs!  
+   And only use unix-style line endings.
+  &lt;/simpara&gt;
+  &lt;para&gt;
+   To continue on with our description we document parameter changes although 
+   this may have it's own section in the near future.
+  &lt;/para&gt;
+ &lt;/refsect1&gt;
+
+ &lt;refsect1&gt;
+  &amp;reftitle.returnvalues;
+  &lt;simpara&gt;
+   This section describes return values.  If the function simply returns
+   TRUE on success and FALSE on failure, simply use the &amp;return.success;
+   entity here (this entity does not contain it's own para) otherwise describe
+   what the function returns in all cases.  Also, there are &amp;true; and
+   &amp;false; entities.
+  &lt;/simpara&gt;
+ &lt;/refsect1&gt;
+
+ &lt;refsect1&gt;
+  &amp;reftitle.examples;
+  &lt;para&gt;
+   Words may go here, but most likely not.  Your example must meet the PEAR 
+   Coding standards.
+   &lt;example&gt;
+    &lt;title&gt;An &lt;function&gt;example_func&lt;function&gt;example&lt;/title&gt;
+    &lt;programlisting role="php"&gt;
+&lt;![CDATA[
+&lt;?php
+/* Use a role="php" only for PHP codes. See &lt;screen&gt;
+ * and other DocBook elements to express other
+ * types of listings. Use other role attributes for
+ * other type of programlistings, like: sql, httpd, ini,
+ * shell or http, as dictated by the example type.
+ */
+
+/* Do all indentation with spaces, not tabs, just to be sure.
+ * Don't try pushing the code to the right by adding spaces in
+ * front, this is the style sheet's job.
+ *
+ * All examples must meet the PEAR Coding Standard
+ */
+ 
+// a function example
+function some_code($foo)
+{
+    // use four spaces of indentation
+}
+
+// an example of bracket usage and spacing, always use
+// brackets, even when they are physically not needed
+if (some_code($foo) == 'foo') {
+    echo 'foo';
+} elseif (some_code($foo) == 'bar') {
+    echo 'bar';
+} else {
+    echo 'No foo, no bar';
+}
+?&gt;
+]]&gt;
+    &lt;/programlisting&gt;
+   &lt;/example&gt;
+   Words may go here, but most likely not.  Notice the use of the &amp;listendand; 
+   entity below, and how the functions are listed as one function per line.  
+   There are no ending periods for see also's (or are there?).
+  &lt;/para&gt;
+ &lt;/refsect1&gt;
+
+ &lt;refsect1&gt;
+  &amp;reftitle.seealso;
+  &lt;simpara&gt;
+   &lt;function&gt;somefunc&lt;/function&gt;,
+   &lt;function&gt;someother_func&lt;/function&gt;&amp;listendand;
+   &lt;function&gt;yetanotherfunc&lt;/function&gt;
+  &lt;/simpara&gt;
+ &lt;/refsect1&gt;
+&lt;/refentry&gt;
+
+&lt;!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+--&gt;
+    </programlisting>
+   </example>
+  </para>
+  <para>
+   For parts we have no skeleton here, please look at existing files in the
+   <filename>phpdoc</filename> CVS module. If you are not sure a specific file
+   is good for a start, please ask on the <link linkend="chapter-maillist">phpdoc
+   mailing list</link>. If you have any suggestions for more skeletons do not
+   hesitate.
+  </para>
  </chapter>
 
  <chapter id="chapter-translation">
@@ -1412,4 +1560,4 @@
 vim600: syn=xml fen fdm=syntax fdl=2 si
 vim: et tw=78 syn=sgml
 vi: ts=1 sw=1
--->
+-->
\ No newline at end of file

Reply via email to