pypeline.markup

Classes

class pypeline.markup.Markup(*markup_pkgs_or_fns, **markup_extensions)

Bases: object

add_renderer(func, markup_extensions)

Add a function that is responsible for rendering a particular markup syntax to HTML.

The function name should end in *_markup. The function must return a tuple of the pattern used to match supported file extensions and a callback to render a string of text.

The callback recieves one parameter, a Unicode string. It should return an HTML representation of that string. Simple callbacks can be lambdas, such as creole, textile, or markup.

can_render(filename)

Check to see if a particular file is supported. If the file is supported, the name of the markup is returned. Otherwise, the function returns None.

markups_names
render(filename, content=None)

Provided a filename or a filename and content, render the content from a particular markup syntax to HTML. The markup syntax is chosen based on matching patterns (e.g., extensions) with the filename.

renderer(filename)

Search for any markups that are responsible for the provided filename. Returns the function used to render the file and the name of the markup.

unicode(content)

Normalize a variety of encodings into unicode.