Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 570

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- How to Build OTP like documentation</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/erl_docgen-0.3.3.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Erl_Docgen</strong><br><strong>User's Guide</strong><br><small>Version 0.3.3</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Chapters</strong></small></p>
<ul class="flipMenu" imagepath="../../../../doc/js/flipmenu">
<li id="loadscrollpos" title="How to Build OTP like documentation" expanded="true">How to Build OTP like documentation<ul>
<li><a href="doc-build.html">
              Top of chapter
            </a></li>
<li title="Utilities to prepare XML files"><a href="doc-build.html#id63368">Utilities to prepare XML files</a></li>
<li title="Use xsltproc to generate different output formats"><a href="doc-build.html#id61175">Use xsltproc to generate different output formats</a></li>
</ul>
</li>
<li id="no" title="Overview OTP DTDs" expanded="false">Overview OTP DTDs<ul>
<li><a href="overview.html">
              Top of chapter
            </a></li>
<li title="DTD Suite"><a href="overview.html#id64762">DTD Suite</a></li>
<li title="Basic Tags"><a href="overview.html#id68138">Basic Tags</a></li>
</ul>
</li>
<li id="no" title="User's Guide DTDs" expanded="false">User's Guide DTDs<ul>
<li><a href="user_guide_dtds.html">
              Top of chapter
            </a></li>
<li title="The part DTD"><a href="user_guide_dtds.html#id60222">The part DTD</a></li>
<li title="&lt;part&gt;"><a href="user_guide_dtds.html#id60510">&lt;part&gt;</a></li>
<li title="&lt;description&gt;"><a href="user_guide_dtds.html#id68097">&lt;description&gt;</a></li>
<li title="&lt;include&gt;"><a href="user_guide_dtds.html#id60627">&lt;include&gt;</a></li>
<li title="The chapter DTD"><a href="user_guide_dtds.html#id68049">The chapter DTD</a></li>
<li title="&lt;chapter&gt;"><a href="user_guide_dtds.html#id63655">&lt;chapter&gt;</a></li>
<li title="&lt;section&gt;"><a href="user_guide_dtds.html#id62101">&lt;section&gt;</a></li>
<li title="&lt;title&gt;"><a href="user_guide_dtds.html#id62142">&lt;title&gt;</a></li>
</ul>
</li>
<li id="no" title="Reference Manual DTDs" expanded="false">Reference Manual DTDs<ul>
<li><a href="refman_dtds.html">
              Top of chapter
            </a></li>
<li title="The application DTD"><a href="refman_dtds.html#id64613">The application DTD</a></li>
<li title="&lt;application&gt;"><a href="refman_dtds.html#id64497">&lt;application&gt;</a></li>
<li title="The appref DTD"><a href="refman_dtds.html#id67949">The appref DTD</a></li>
<li title="The comref DTD"><a href="refman_dtds.html#id63005">The comref DTD</a></li>
<li title="The cref DTD"><a href="refman_dtds.html#id65218">The cref DTD</a></li>
<li title="The erlref DTD"><a href="refman_dtds.html#id65347">The erlref DTD</a></li>
<li title="The fileref DTD"><a href="refman_dtds.html#id65477">The fileref DTD</a></li>
<li title="&lt;description&gt;"><a href="refman_dtds.html#id65618">&lt;description&gt;</a></li>
<li title="&lt;section&gt;"><a href="refman_dtds.html#id65651">&lt;section&gt;</a></li>
<li title="&lt;funcs&gt;"><a href="refman_dtds.html#id65692">&lt;funcs&gt;</a></li>
<li title="&lt;func&gt;"><a href="refman_dtds.html#id65718">&lt;func&gt;</a></li>
<li title="&lt;name&gt;"><a href="refman_dtds.html#id65761">&lt;name&gt;</a></li>
<li title="&lt;fsummary&gt;"><a href="refman_dtds.html#id65831">&lt;fsummary&gt;</a></li>
<li title="&lt;type&gt;"><a href="refman_dtds.html#id65859">&lt;type&gt;</a></li>
<li title="&lt;v&gt;"><a href="refman_dtds.html#id65891">&lt;v&gt;</a></li>
<li title="&lt;d&gt;"><a href="refman_dtds.html#id65907">&lt;d&gt;</a></li>
<li title="&lt;desc&gt;"><a href="refman_dtds.html#id65934">&lt;desc&gt;</a></li>
<li title="&lt;authors&gt;"><a href="refman_dtds.html#id65964">&lt;authors&gt;</a></li>
<li title="&lt;aname&gt;"><a href="refman_dtds.html#id66000">&lt;aname&gt;</a></li>
<li title="&lt;email&gt;"><a href="refman_dtds.html#id66016">&lt;email&gt;</a></li>
</ul>
</li>
<li id="no" title="Header Tags" expanded="false">Header Tags<ul>
<li><a href="header_tags.html">
              Top of chapter
            </a></li>
<li title="&lt;header&gt;"><a href="header_tags.html#id66099">&lt;header&gt;</a></li>
<li title="&lt;copyright&gt;"><a href="header_tags.html#id66115">&lt;copyright&gt;</a></li>
<li title="&lt;legalnotice&gt;"><a href="header_tags.html#id66159">&lt;legalnotice&gt;</a></li>
<li title="&lt;title&gt;"><a href="header_tags.html#id66188">&lt;title&gt;</a></li>
<li title="&lt;shorttitle&gt;"><a href="header_tags.html#id66219">&lt;shorttitle&gt;</a></li>
<li title="&lt;prepared&gt;"><a href="header_tags.html#id66234">&lt;prepared&gt;</a></li>
<li title="&lt;responsible&gt;"><a href="header_tags.html#id66250">&lt;responsible&gt;</a></li>
<li title="&lt;docno&gt;"><a href="header_tags.html#id66266">&lt;docno&gt;</a></li>
<li title="&lt;approved&gt;"><a href="header_tags.html#id66297">&lt;approved&gt;</a></li>
<li title="&lt;checked&gt;"><a href="header_tags.html#id66313">&lt;checked&gt;</a></li>
<li title="&lt;date&gt;"><a href="header_tags.html#id66328">&lt;date&gt;</a></li>
<li title="&lt;rev&gt;"><a href="header_tags.html#id66344">&lt;rev&gt;</a></li>
<li title="&lt;file&gt;"><a href="header_tags.html#id66376">&lt;file&gt;</a></li>
</ul>
</li>
<li id="no" title="Block Tags" expanded="false">Block Tags<ul>
<li><a href="block_tags.html">
              Top of chapter
            </a></li>
<li title="&lt;br&gt; - Line Break"><a href="block_tags.html#id66498">&lt;br&gt; - Line Break</a></li>
<li title="&lt;code&gt; - Code Example"><a href="block_tags.html#id66536">&lt;code&gt; - Code Example</a></li>
<li title="&lt;codeinclude&gt; - Code Inclusion"><a href="block_tags.html#id66589">&lt;codeinclude&gt; - Code Inclusion</a></li>
<li title="&lt;erleval&gt; - Erlang Evaluation"><a href="block_tags.html#id66663">&lt;erleval&gt; - Erlang Evaluation</a></li>
<li title="&lt;list&gt; - List"><a href="block_tags.html#id66698">&lt;list&gt; - List</a></li>
<li title="&lt;marker&gt; - Marker"><a href="block_tags.html#id66782">&lt;marker&gt; - Marker</a></li>
<li title="&lt;p&gt; - Paragraph"><a href="block_tags.html#id66808">&lt;p&gt; - Paragraph</a></li>
<li title="&lt;note&gt; - Note"><a href="block_tags.html#id66849">&lt;note&gt; - Note</a></li>
<li title="&lt;pre&gt; - Pre-formatted Text"><a href="block_tags.html#id66895">&lt;pre&gt; - Pre-formatted Text</a></li>
<li title="&lt;quote&gt; - Quotation"><a href="block_tags.html#id66970">&lt;quote&gt; - Quotation</a></li>
<li title="&lt;taglist&gt; - Definition List"><a href="block_tags.html#id67018">&lt;taglist&gt; - Definition List</a></li>
<li title="&lt;warning&gt; - Warning"><a href="block_tags.html#id67121">&lt;warning&gt; - Warning</a></li>
<li title="&lt;image&gt; - Image"><a href="block_tags.html#id67173">&lt;image&gt; - Image</a></li>
<li title="&lt;table&gt; - Table"><a href="block_tags.html#id67236">&lt;table&gt; - Table</a></li>
</ul>
</li>
<li id="no" title="Inline Tags" expanded="false">Inline Tags<ul>
<li><a href="inline_tags.html">
              Top of chapter
            </a></li>
<li title="&lt;br&gt; - Line Break"><a href="inline_tags.html#id67434">&lt;br&gt; - Line Break</a></li>
<li title="&lt;c&gt; - Code"><a href="inline_tags.html#id67460">&lt;c&gt; - Code</a></li>
<li title="&lt;em&gt; - Emphasis"><a href="inline_tags.html#id67508">&lt;em&gt; - Emphasis</a></li>
<li title="&lt;marker&gt; - Marker"><a href="inline_tags.html#id67549">&lt;marker&gt; - Marker</a></li>
<li title="&lt;seealso&gt; - Local Cross Reference"><a href="inline_tags.html#id67607">&lt;seealso&gt; - Local Cross Reference</a></li>
<li title="&lt;url&gt; - Non-Local Cross Reference"><a href="inline_tags.html#id67687">&lt;url&gt; - Non-Local Cross Reference</a></li>
<li title="&lt;term&gt;, &lt;termdef&gt; - Glossary"><a href="inline_tags.html#id67726">&lt;term&gt;, &lt;termdef&gt; - Glossary</a></li>
<li title="&lt;cite&gt;, &lt;citedef&gt; - Bibliography"><a href="inline_tags.html#id67790">&lt;cite&gt;, &lt;citedef&gt; - Bibliography</a></li>
</ul>
</li>
<li id="no" title="Character Entities" expanded="false">Character Entities<ul>
<li><a href="character_entities.html">
              Top of chapter
            </a></li>
<li title="Added Latin 1"><a href="character_entities.html#id67860">Added Latin 1</a></li>
</ul>
</li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<h1>1 How to Build OTP like documentation</h1>
  

  <h3><a name="id63368">1.1 
        Utilities to prepare XML files</a></h3>
    
    <h4>Create XML files from code</h4>
      
      <p>
	If there are EDoc comments in a module, the escript <span class="code">xml_from_edoc.escript</span>
	can be used to generate an XML file according to the <span class="code">erlref</span> DTD 
	for this module.
      </p>
      <p>
	Example:
      </p>
      <div class="example"><pre>

	1&gt; escript $(ERL_TOP)/lib/erl_docgen/priv/bin/xml_from_edoc.escript ex1.erl
      </pre></div>
    
    <h4>Include code in XML</h4>
      
      <p>If there are OTP DTD codeinclude tags in the source XML file, the escript
          <span class="code">codeline_preprocessing.escript</span> can be used to include the code and produce
	  an XML file according to the OTP DTDs. 
      </p>
      <p>
	Example:
      </p>
      <div class="example"><pre>

	1&gt; escript $(ERL_TOP)/lib/erl_docgen/priv/bin/codeline_preprocessing.escript ex1.xmlsrc ex1.xml
      </pre></div>
    
  

  <h3><a name="id61175">1.2 
        Use xsltproc to generate different output formats</a></h3>
    

    <h4>Parameters used in all the the XSL transformations</h4>
      
      <p>
	These parameters to <span class="code">xsltproc</span> are used for all the supported output formats.
      </p>
      <dl>
	<dt><strong><span class="code">docgen</span></strong></dt>
	<dd>
	  Path to erl_docgen's top directory.
	</dd>
	<dt><strong><span class="code">gendate</span></strong></dt>
	<dd>
	  The date string that will be used in the documentation.
	</dd>
	<dt><strong><span class="code">appname</span></strong></dt>
	<dd>
	  The name of the application.&gt;
	</dd> 
	<dt><strong><span class="code">appver</span></strong></dt>
	<dd>
	  The version of the application.
	</dd>
     </dl>
    

    <h4>Generate HTML output</h4>
      
      <p>
	When generating HTML one also needs these three pramaters to <span class="code">xsltproc</span>.
      </p> 
      <dl>
	<dt><strong><span class="code">outdir</span></strong></dt>
	<dd>
	  Output directory for the produced html files.
	</dd>
 	<dt><strong><span class="code">topdocdir</span></strong></dt>
	<dd>
	  If one builds a standalone documentation for an application this should be set to ".".
	</dd>
	<dt><strong><span class="code">pdfdir</span></strong></dt>
	<dd>
	  Relative path from the html directory to where the pdf file are placed.
	</dd>
      </dl>
      <p>
	Example:
      </p>
      <div class="example"><pre>
	
	1&gt; xsltproc --noout --stringparam outdir /tmp/myhtmldoc \
	      --stringparam docgen $(ERL_TOP)/lib/erl_docgen \
              --stringparam topdocdir . \
              --stringparam pdfdir "$(PDFDIR)" \
              --xinclude \
	      --stringparam gendate "December 5 2011" \
              --stringparam appname MyApp \
              --stringparam appver 0.1 \
              -path $ERL_TOP/lib/erl_docgen/priv/dtd \
              -path $ERL_TOP/lib/erl_docgen/priv/dtd_html_entities \
	      $ERL_TOP/lib/erl_docgen/priv/xsl/db_html.xsl mybook.xml
      </pre></div>
    

    <h4>Generate PDF</h4>
      
      <p>
	The generation of the PDF file is done in two steps. First is <span class="code">xsltproc</span> used to generate a <span class="code">.fo</span> file 
	which is used as input to the <span class="code">fop</span> command to produce th PDF file.
      </p>
      <p>
	Example:
      </p>
      <div class="example"><pre>

	1&gt; xsltproc --output MyApp.fo \
             --stringparam docgen $ERL_TOP/lib/erl_docgen \
	     --stringparam gendate  "December 5 2011" \
             --stringparam appname MyApp \
             --stringparam appver 0.1 \
             --xinclude \
             -path $ERL_TOP/lib/erl_docgen/priv/dtd \
             -path $ERL_TOP/lib/erl_docgen/priv/dtd_html_entities \
	     $ERL_TOP/lib/erl_docgen/priv/xsl/db_pdf.xsl mybook.xml


        2&gt; fop -fo MyApp.fo -pdf MyApp.pdf
      </pre></div>
    

    <h4>Generate man pages</h4>
      
      <p>
	Unix man pages can be generated with <span class="code">xsltproc</span> from XML files written according to 
	the different OTP ref type DTDs. 
      </p>
      <p>
	Example:
      </p>
      <div class="example"><pre>

	1&gt; xsltproc --output  my_module.3\
	      --stringparam docgen $ERL_TOP/lib/erl_docgen \
	      --stringparam gendate  "December 5 2011" \
	      --stringparam appname MyApp \
	      --stringparam appver 0.1 \
	      --xinclude -path $ERL_TOP/lib/erl_docgen/priv/dtd  \
              -path $ERL_TOP/lib/erl_docgen/priv/dtd_man_entities \
              $ERL_TOP/lib/erl_docgen/priv/xsl/db_man.xsl my_refpage.xml
      </pre></div>
    

    <h4>Upcomming changes</h4>
      
      <p>
	The output from the <span class="code">erl_docgen</span> documentation build process is now just the OTP style. 
	But in a near future we will for example add the possibility to change logo, color in the PDF and 
	style sheet for the HTML.
      </p>
    

  
</div>
<div class="footer">
<hr>
<p>Copyright © 2004-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>