Differences between revisions 1 and 13 (spanning 12 versions)
Revision 1 as of 2004-02-27 03:15:14
Size: 1149
Editor: dsl254-010-130
Comment: demonstrates PyTextile, where to download from, how to use
Revision 13 as of 2015-01-10 12:19:42
Size: 1301
Comment: correct mention of reStructuredText
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
[http://dealmeida.net/projects/textile PyTextile] is a ''very'' easy to use text-to-HTML converter. [[http://pypi.python.org/pypi/textile|PyTextile]] is a ''very'' easy to use text-to-HTML converter.
Line 5: Line 5:
You can see [http://www.textism.com/tools/textile/ a demonstration of Textile,] You can test the following demonstration of Textile code, 
Line 35: Line 35:
First, [http://dealmeida.net/code/textile-1.13.tgz download PyTextile 1.3.] First, [[http://pypi.python.org/pypi/textile|download the latest PyTextile.]]
Line 62: Line 62:
=== Options ===

PyTextile takes 3 optional arguments:

{{{
def textile(self, text, rel=None, head_offset=0, html_type='xhtml', sanitize=False):
}}}
Line 64: Line 72:
ReStructuredText is another text-to-HTML converter. [[reStructuredText]] as a markup format to convert text to HTML.

PyTextile

PyTextile is a very easy to use text-to-HTML converter.

You can test the following demonstration of Textile code, which can convert this:

_This_ is a *test.*

* One
* Two
* Three

Link to "Slashdot":http://slashdot.org/

to this:

        <p><em>This</em> is a <strong>test.</strong></p>
 
 
<ul>
        <li>One</li>
        <li>Two</li>
        <li>Three</li>
</ul>
 
        <p>Link to <a href="http://slashdot.org/">Slashdot</a></p>

Using PyTextile

First, download the latest PyTextile.

Untar it, and enter the textile directory. Start a python interpreter.

Type:

Toggle line numbers
   1 import textile
   2 
   3 s = """
   4 _This_ is a *test.*
   5 
   6 * One
   7 * Two
   8 * Three
   9 
  10 Link to "Slashdot":http://slashdot.org/
  11 """
  12 
  13 html = textile.textile( s )
  14 
  15 print html

You'll see beautiful HTML on the other side, ready for inclusion in a web page. :)

Options

PyTextile takes 3 optional arguments:

def textile(self, text, rel=None, head_offset=0, html_type='xhtml', sanitize=False):

See Also:

reStructuredText as a markup format to convert text to HTML.

Discussion

(none yet!)

PyTextile (last edited 2015-01-10 12:19:42 by WolfgangMaier)

Unable to edit the page? See the FrontPage for instructions.