*λ
Ι
ά;c       s    d  Z     h  d d <d d <d d <d d <d	 d
 <d d <d d <d d <Z 1 y 2 e d i d  d Z Wn 3 4 d Z n X9 d k Z > d k Z D d   Z L d e i i f d     YZ	 ] d e i i
 f d     YZ ½ d e i i f d     YZ d S(   s9   Docstring converter for original StructuredText format.

s0   $RCSfile: docstring_ClassicStructuredText.py,v $s   module_namesT   $Id: docstring_ClassicStructuredText.py,v 1.2 2001/10/28 13:40:25 doughellmann Exp $s   rcs_ids(   Doug Hellmann <DougHellmann@bigfoot.com>s   creators   HappyDocs   projects   Wed, 26-Sep-2001 09:52:01 EDTs   createds   $Author: doughellmann $s   authors   $Revision: 1.2 $s   versions   $Date: 2001/10/28 13:40:25 $s   dates    i   s   0.0Nc      s,   D E F h  d d <t  d <g  d <Sd S(   s;   Return information about this module to the dynamic loader.s   ClassicStructuredTexts   names   factorys   filenamePatternListN(   s   ClassicStructuredTextConverter(    (    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys
   entryPointD s   s   ClassicStructuredTextFilec      s&   L d  Z  N O d Z Q e d  Z RS(   s5   External documentation in StructuredText format.
    s   ClassicStructuredTextc    s   Q R d  k  } S | i i i } T | i i i |  V | W |  X | i |  i  } Y t | i d d  |  _ Z d  Sd  S(   Ni    (   s:   happydoclib.docstring.StructuredText.ClassicStructuredTexts   happydoclibs	   docstrings   StructuredTexts   ClassicStructuredTexts   happydocstrings   ExternalDocumentationFileBases   __init__s   selfs   filenames   bodys   _file_contentss   converted_bodys   strs	   structures	   _oneliner(   s   selfs   filenames   bodys   happydoclibs   converted_bodys   StructuredText(    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   __init__Q s   
(   s   __doc__s   _input_types   Nones   __init__(    (    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   ClassicStructuredTextFileL s   		s   ClassicStructuredTextConverterc      sJ   ] d  Z  d f e Z h d g Z j d   Z r d d  Z  d   Z RS(   sΛ   Classic StructuredText format converter.

    This converter supports translating StructuredText (see
    happydoc/hddocstring/StructuredText/ClassicStructuredText.py)
    input to HTML output.
    
    s   htmlc    s=   j k | |  i j o# l t d | |  i i f   n d  S(   Ns'   Unrecognized output format "%s" for %s.(   s   outputFormats   selfs   RECOGNIZED_OUTPUT_FORMATSs
   ValueErrors	   __class__s   __name__(   s   selfs   outputFormat(    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   _testOutputFormatj s   i   c 
   s«   r   |  i |   d k }  | i i i }  | d j o\  h  }  | i	 |   | | d < t | i  | f |  |  }	  t |	  Sn  | Sd S(   s―  Returns the 'inputText' data translated into the 'outputFormat'.

        Parameters:

          'inputText' -- String or other sequence of characters to be
          converted.  This string should be in the format advertised
          by the docstring converter.

          'outputFormat' -- String defined by the docstring converter
          class to represent a supported output scheme.  This value is
          converter-specific, and not all converters will support the
          same output formats.

          'level=3' -- Beginning indention level for the text.  This
          controls what type of header elements are created among
          other behaviors.
        
        Ns   htmls   level(   s   selfs   _testOutputFormats   outputFormats:   happydoclib.docstring.StructuredText.ClassicStructuredTexts   happydoclibs	   docstrings   StructuredTexts   ClassicStructuredTexts   applyNamedArgss   updates	   namedArgss   levels   applys   html_with_referencess	   inputTexts   argss   html_representations   str(
   s   selfs	   inputTexts   outputFormats   levels   argss	   namedArgss   happydoclibs   StructuredTexts   applyNamedArgss   html_representation(    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   convertr s   	c    s    ₯ ¦ |  i |  § d k } ¨ | i i i } © | d j oN ͺ t | i	 « | f | ¬ |  } ΄ t i d Ά d · |  } Έ | Sn Ί | Sd S(   s³  Returns the 'inputText' quoted in a way that special characters are escaped.

        Parameters:

          'inputText' -- String or other sequence of characters to be
          converted.  This string should be in the format advertised
          by the docstring converter.

          'outputFormat' -- String defined by the docstring converter
          class to represent a supported output scheme.  This value is
          converter-specific, and not all converters will support the
          same output formats.

          '*args' -- Additional, converter-specific, positional arguments.

          '**namedArgs' -- Additional, converter-specific, named arguments.
          
        Ns   htmls   &quot;([^&]+)&quot;:s   "\1":(   s   selfs   _testOutputFormats   outputFormats:   happydoclib.docstring.StructuredText.ClassicStructuredTexts   happydoclibs	   docstrings   StructuredTexts   ClassicStructuredTexts   applys
   html_quotes	   inputTexts   argss	   namedArgss   html_quoteds   res   sub(   s   selfs	   inputTexts   outputFormats   argss	   namedArgss   happydoclibs   StructuredTexts   html_quoted(    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   quote s   (   s   __doc__s   ClassicStructuredTextFiles   externalDocumentFactorys   RECOGNIZED_OUTPUT_FORMATSs   _testOutputFormats   converts   quote(    (    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   ClassicStructuredTextConverter] s   		!s   ClassicSTUnitTestc      s&   ½ Ώ d Z  dd   Z sd   Z RS(   NsΛ  <h3>"""Classic Structured Text Manipulation</h3>
<p>  Parse a structured text string into a form that can be used with
  structured formats, like html.</p>

<p>  Structured text is text that uses indentation and simple symbology
  to indicate the structure of a document.</p>

<p>  A structured string consists of a sequence of paragraphs separated
  by one or more blank lines.  Each paragraph has a level which is
  defined as the minimum indentation of the paragraph.  A paragraph is
  a sub-paragraph of another paragraph if the other paragraph is the
  last preceding paragraph that has a lower level.</p>


<p>Special symbology is used to indicate special constructs:</p>

<ul><li><p>A single-line paragraph whose immediately succeeding paragraphs are lower
  level is treated as a header.</p>

</li>
<li><p>A paragraph that begins with a <code>-</code>, <code>*</code>, or <code>o</code> is treated as an
  unordered list (bullet) element.</p>

</li>
<li><p>A paragraph that begins with a sequence of digits followed by a
  white-space character is treated as an ordered list element.</p>

</li>
<li><p>A paragraph that begins with a sequence of sequences, where each
  sequence is a sequence of digits or a sequence of letters followed
  by a period, is treated as an ordered list element.</p>

</li>
<li><p>A paragraph with a first line that contains some text, followed by
  some white-space and <code>--</code> is treated as
  a descriptive list element. The leading text is treated as the
  element title.</p>

</li>
<li><p>Sub-paragraphs of a paragraph that ends in the word <code>example</code> or the
  word <code>examples</code>, or <code>::</code> is treated as example code and is output as is.</p>

</li>
<li><p>Text enclosed single quotes (with white-space to the left of the
  first quote and whitespace or punctuation to the right of the second quote)
  is treated as example code.</p>

</li>
<li><p>Text surrounded by <code>*</code> characters (with white-space to the left of the
  first <code>*</code> and whitespace or punctuation to the right of the second <code>*</code>)
  is emphasized.</p>

</li>
<li><p>Text surrounded by <code>**</code> characters (with white-space to the left of the
  first <code>**</code> and whitespace or punctuation to the right of the second <code>**</code>)
  is made strong.</p>

</li>
<li><p>Text surrounded by <code>_</code> underscore characters (with whitespace to the left 
  and whitespace or punctuation to the right) is made underlined.</p>

</li>
<li><p>Text encloded by double quotes followed by a colon, a URL, and concluded
  by punctuation plus white space, <em>or</em> just white space, is treated as a
  hyper link. For example:</p>
<p>    "Zope":http://www.zope.org/ is ...</p>

<p>  Is interpreted as <code><a href="http://www.zope.org/">Zope</a> is ....</code>
  Note: This works for relative as well as absolute URLs.</p>


</li>
<li><p>Text enclosed by double quotes followed by a comma, one or more spaces,
  an absolute URL and concluded by punctuation plus white space, or just
  white space, is treated as a hyper link. For example:</p>
<p>    "mail me", mailto:amos@digicool.com.</p>

<p>  Is interpreted as <code><a href="mailto:amos@digicool.com">mail me</a>.</code> </p>


</li>
<li><p>Text enclosed in brackets which consists only of letters, digits,
  underscores and dashes is treated as hyper links within the document.
  For example:</p>
<p>    As demonstrated by Smith <a href="#12">[12]</a> this technique is quite effective.</p>

<p>  Is interpreted as <code>... by Smith <a href="#12">[12]</a> this ...</code>. Together
  with the next rule this allows easy coding of references or end notes.</p>


</li>
<li><p>Text enclosed in brackets which is preceded by the start of a line, two
  periods and a space is treated as a named link. For example:</p>
<p>    .. <a href="#12">[12]</a> "Effective Techniques" Smith, Joe ... </p>

<p>  Is interpreted as <code><a name="12">[12]</a> "Effective Techniques" ...</code>.
  Together with the previous rule this allows easy coding of references or
  end notes. </p>


</li>
<li><p>A paragraph that has blocks of text enclosed in <code>||</code> is treated as a
  table. The text blocks correspond to table cells and table rows are
  denoted by newlines. By default the cells are center aligned. A cell
  can span more than one column by preceding a block of text with an
  equivalent number of cell separators <code>||</code>. Newlines and <code>|</code> cannot
  be a part of the cell text.</p>
<p>  For example:</p>
<PRE>
      |||| **Ingredient** ||
      || *Name* || *Amount* ||
      ||Spam||10||
      ||Eggs||3||

</PRE>

<p>  is interpreted as:</p>
<PRE>
    &lt;TABLE BORDER=1 CELLPADDING=2&gt;
     &lt;TR&gt;
      &lt;TD ALIGN=CENTER COLSPAN=2&gt; &lt;strong&gt;Ingredients&lt;/strong&gt; &lt;/TD&gt;
     &lt;/TR&gt;
     &lt;TR&gt;
      &lt;TD ALIGN=CENTER COLSPAN=1&gt; &lt;em&gt;Name&lt;/em&gt; &lt;/TD&gt;
      &lt;TD ALIGN=CENTER COLSPAN=1&gt; &lt;em&gt;Amount&lt;/em&gt; &lt;/TD&gt;
     &lt;/TR&gt;
     &lt;TR&gt;
      &lt;TD ALIGN=CENTER COLSPAN=1&gt;Spam&lt;/TD&gt;
      &lt;TD ALIGN=CENTER COLSPAN=1&gt;10&lt;/TD&gt;
     &lt;/TR&gt;
     &lt;TR&gt;
      &lt;TD ALIGN=CENTER COLSPAN=1&gt;Eggs&lt;/TD&gt;
      &lt;TD ALIGN=CENTER COLSPAN=1&gt;3&lt;/TD&gt;
     &lt;/TR&gt;
    &lt;/TABLE&gt;

</PRE>

<p>  and appear as:</p>
<p>
<TABLE BORDER=1 CELLPADDING=2>
 <TR>
  <TD ALIGN=CENTER COLSPAN=2> <strong>Ingredient</strong> </TD>
 </TR>
 <TR>
  <TD ALIGN=CENTER COLSPAN=1> <em>Name</em> </TD>
  <TD ALIGN=CENTER COLSPAN=1> <em>Amount</em> </TD>
 </TR>
 <TR>
  <TD ALIGN=CENTER COLSPAN=1>Spam</TD>
  <TD ALIGN=CENTER COLSPAN=1>10</TD>
 </TR>
 <TR>
  <TD ALIGN=CENTER COLSPAN=1>Eggs</TD>
  <TD ALIGN=CENTER COLSPAN=1>3</TD>
 </TR>
</TABLE></p>



</li></ul>
<p>"""</p>

c    so   ded } fd  k } g| i i |  } h| i } j|  i	 | ld md n|  i
 od  qd  Sd  S(   Ns(   TestCases/test_classic_structuredtext.pys   ClassicStructuredTexts   htmls?   Converting Classic ST to HTML did not produce expected results.(   s   filenames   happydoclib.parseinfos   happydoclibs	   parseinfos   getDocss   parsed_modules
   _docstrings
   input_texts   selfs   _testConversions   expectedOutput(   s   selfs   filenames   happydoclibs   parsed_modules
   input_text(    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys#   testClassicStructuredTextConversionds   		
c    s   std } d } |  i | d d | d  ‘d } ²d } Θ|  i | Κd Λd Μ| Νd  Οd  Sd  S(   Ns~    any text

first heading

    first
    section

second heading

    second
    section

third heading

    third
    section
s·   <p> any text</p>

<h3>first heading</h3>
<p>    first
    section</p>


<h3>second heading</h3>
<p>    second
    section</p>


<h3>third heading</h3>
<p>    third
    section
</p>


s   ClassicStructuredTexts   htmls?   Converting Classic ST to HTML did not produce expected results.su   

first heading

    first
    section

second heading

    second
    section

third heading

    third
    section
sΦ   <p>
<TABLE BORDER=1 CELLPADDING=2>
</TABLE></p>

<h3>first heading</h3>
<p>    first
    section</p>


<h3>second heading</h3>
<p>    second
    section</p>


<h3>third heading</h3>
<p>    third
    section
</p>


(   s   input_text1s   expected_text1s   selfs   _testConversions   input_text2s   expected_text2(   s   selfs   expected_text2s   input_text2s   expected_text1s   input_text1(    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   testBug471981Classicss   		
		
(   s   expectedOutputs#   testClassicStructuredTextConversions   testBug471981Classic(    (    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   ClassicSTUnitTest½ s   	₯(   s   __doc__s   __rcs_info__s   splits   __version__s   res   happydoclibs
   entryPoints   happydocstrings   ExternalDocumentationFileBases   ClassicStructuredTextFiles   HappyDocStringConverterBases   ClassicStructuredTextConverters   DocStringConverterTests   ClassicSTUnitTest(   s   __rcs_info__s   happydoclibs   ClassicStructuredTextFiles   __version__s   ClassicSTUnitTests   ClassicStructuredTextConverters
   entryPoints   re(    (    ss   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/docstring/docstring_ClassicStructuredText.pys   ? s   Q`