0
I Use This!
Activity Not Available

Project Summary

django-rstify - A restructured text filter for django templatesdjango-rstify is a set of template filters to provide easy conversion from restructured text to HTML. Besides this basic functionality this application allows you to highlight sourcecode snippets inside your text using the pygments library.

Note: Django already provides a simple restructured text filter. If you don't need the extras in this application, I recommend to use the core version.

DownloadThe main repository of this app is located on Github. You can easily checkout the latest version using git:

git clone git://github.com/bartTC/django-rstify.git or download this app as a .tar.gz file. See Links on the right side for download links.

How to use it in templatesTo convert a restructured text from an object to HTML simply apply the rstify filter on it:

{% load rstify_tags %}

{{ entry.content|rstify }}If you want to convert inline content, use the filter templatetag around:

{% load rstify_tags %}

{% filter rstify %}
This is some *restructured text*.
{% endfilter %}How to use it in sourcecodeApplying this filter inside your code is easy:

>>> from rstify import rstify
>>>
>>> print rstify('This is *restructured text*.')
This is restructured text.

Initial Header LevelBy default the initial heading in your restructured text becomes a

in HTML:

>>> header = '''
... ================
... This is a Header
... ================
... '''
>>> print rstify(header)

This is a Header
You can override this by setting the initial_header_level to an integer from 1 to 6:

>>> print rstify(header, initial_header_level=3)

This is a Header
In your template just set this as the first option of the rstify filter:

{{ entry.content|rstify:"3" }}Syntax Highlightingdjango-rstify provides syntax highlighting using the pygments library. To highlight parts of your restructured text, simply put it in a sourcecode directive:

Here is some text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Integer porttitor nulla sed dui. Aenean lorem mi, tincidunt et, porttitor
nec, condimentum venenatis, felis. Maecenas ornare blandit leo.

.. sourcecode:: python

def foo(bar):
return bar*2

Continue with text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Integer porttitor nulla sed dui. Aenean lorem mi, tincidunt et, porttitor nec,
condimentum venenatis, felis. Maecenas ornare blandit leo.Pygments provides a bunch of highlighters (also called lexer), just replace python with a lexer of your choice. Here is a complete set of available lexers. Read pygments styles how to colorize the output using css.

Tags

django filter markup restructuredtext rst template templatetag

In a Nutshell, django-rstify...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

BSD 4-clause (University of California-Specific)
Permitted

Place Warranty

Commercial Use

Modify

Distribute

Forbidden

Hold Liable

Use Trademarks

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    check out hot projects on the Open Hub
  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    anyone with an Open Hub account can update a project's tags

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis