[PYTHON DOC-SIG] New Module StructuredText

Jim Fulton jim.fulton@digicool.com
Thu, 19 Sep 1996 11:44:25 -0400


This is a multi-part message in MIME format.

--------------23206CC4745
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I've added logic so that paragraphs that end with '::' and that have
subparagraphs introduce sample code.  This was necessary becaus it
sometimes doesn't make sense to end the introductory paragraph with the
word 'example'.  I propose that this be incorporated into gendoc.

See: http://www.digicool.com/jim/python/StructuredText.html

Jim

-- 
Jim Fulton         Digital Creations
jim@digicool.com   540.371.6909
## Python is my favorite language ##
##     http://www.python.org/     ##

--------------23206CC4745
Content-Type: text/html; charset=us-ascii; name="StructuredText.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="StructuredText.html"
Content-Base: "http://www.digicool.com/jim/python/Str
	ucturedText.html"

<BASE HREF="http://www.digicool.com/jim/python/StructuredText.html">

<html>
<head><title>Module StructuredText</title></head>
<body>

<dl><dt><h1>StructuredText</h1><dd>Structured Text Manipulation</dl>
<h1>Description</h1>

<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
preceedeing paragraph that has a lower level.</p>

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

<ul><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><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><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><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><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><p>Text enclosed single quotes (with white-space to the left of the
  first quote and whitespace or puctuation to the right of the second quote)
  is treated as example code.</p>


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


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


</ul>



<h1>Module Functions</h1>

<dl><dt><strong>indent_level(aString)</strong><dd>
<p>    Find the minimum indentation for a string, not counting blank lines.
    </p>


</dl>
<dl><dt><strong>untabify(aString)</strong><dd>
<p>    Convert indentation tabs to spaces.
    </p>


</dl>


<h1>Class HTML (StructuredText)</h1>

<p>    An HTML structured text formatter.
    </p>


<dl><dt><p><strong>Constructor For HTML</strong></p><dd>

<dl><dt><strong>StructuredText(aStructuredString, [level])</strong><dd>
<p>
        Convert a string containing structured text into a structured text object.</p>

<dl><dt><p><strong>        Aguments:</strong><p>
<dd><dl><dt>          aStructuredString<dd><p>The string to be parsed.
          level -- The level of top level headings to be created.
        </p>

</dl>

</dl>

</dl>
</dl>

<dl><dt><p><strong>General Services Provided by HTML</strong></p><dd>

<dl><dt><strong>str(aHTML)</strong><dd>
<p>
        Return an HTML string representation of the structured text data.</p>
<p>        </p>



</dl>
</dl>



<h1>Class StructuredText</h1>

<p>    Model text as structured collection of paragraphs.</p>

<p>    Structure is implied by the indentation level.</p>

<p>    This class is intended as a base classes that do actual text
    output formatting.
    </p>


<dl><dt><p><strong>Constructor For StructuredText</strong></p><dd>

<dl><dt><strong>StructuredText(aStructuredString, [level])</strong><dd>
<p>
        Convert a string containing structured text into a structured text object.</p>

<dl><dt><p><strong>        Aguments:</strong><p>
<dd><dl><dt>          aStructuredString<dd><p>The string to be parsed.
          level -- The level of top level headings to be created.
        </p>

</dl>

</dl>

</dl>
</dl>

<dl><dt><p><strong>General Services Provided by StructuredText</strong></p><dd>

<dl><dt><strong>str(aStructuredText)</strong><dd>
<p>Convert a StructuredText to a string.</p>


</dl>
</dl>

<a href="StructuredText.py">Download StructuredText.py</a>

<hr>Last Modified: 17 September 1996
</body></html>

--------------23206CC4745--


=================
DOC-SIG  - SIG for the Python Documentation Project

send messages to: doc-sig@python.org
administrivia to: doc-sig-request@python.org
=================