skip to navigation
skip to content

par 0.4

Simple structured text parser.

Latest Version: 1.3.4

Par is a simple structured text parser, for new it supports google code wiki syntax(partial) and markdown syntax. And I also extend some new syntax for it.

Paring Markdown Programmly

Do like this:

from import parseHtml

template = ”’<!doctype html> <html> <head> <title>%(title)s</title> </head> <body> %(body)s </body> </html>”’

tag_class = {‘table’:’table’}

text = “”” # Test Markdown

This is a pragraph “”“

print parseHtml(text, template, tag_class)

Markdown Syntax Expand

Table Support

do like this:

|| a || b || c || || c || d || e ||

will get this:

<table> <tr><td> a </td><td> b </td><td> c </td> </tr> <tr><td> b </td><td> c </td><td> d </td> </tr> </table>

Definition List support

do like this:

a –
b –

will get this:

<dl> <dt>a</dt> <dd><p>abc</p> </dd> <dt>b</dt> <dd><p>cde</p> </dd> </dl>

Other text decorators also adds some new text decorators, such as:

^text^ <sup>text<sup> ,,text,, <sub>text<sub> ~~text~~ <span style=”text-decoration: line-through”>text</span> *text* <strong><em>text</em></strong> ___text___ <strong><em>text</em></strong>

Bootstrap Tab Pages

Support tab pages, the format is:

` This is a test `
  • this is a list
  • test

Bootstrap Alert

#### Alert Title This is alert message
This is an alert. It’ll has a close button.

For bootstrap usage, you should invoke the code like this:

from import parseHtml from par.bootstrap_ext import blocks

print parseHtml(text, template, block_callback=blocks)