(The include Plugin is new since PyLucid v0.9.0.0810)

With the include Plugin, you can include local and remote files into a cms page.

The included content can be:

  • highlighted with pygments
  • appled markup (all existing markups)
  • striped html tags

include a local file

Basic example:

{% lucidTag include.local_file filepath="/path/to/file.txt" %}

You can only include a file which is stored in the path specified with settings.PYLUCID_INCLUDE_BASEPATH

Be careful for setup this basepath!

Local file highlighted

Highlight a file with pygments:

{% lucidTag include.local_file filepath="/path/to/sourcecode.py" hightlight="py" %}

Local file with Markup

Apply markup to a file:

{% lucidTag include.local_file filepath="/path/to/README.creole" markup="creole" %}

include a remote file

Basic example:

{% lucidTag include.remote url="http://www.domain.tld/path/to/file.txt" %}

Remote file highlighted

Highlight a file with pygments:

{% lucidTag include.remote url="http://www.google.com" hightlight="html" %}

The output is: Highlight a remote file with Pygments

Remote file with Markup

Apply markup to a file:

{% lucidTag include.remote url="https://raw.github.com/jedie/PyLucid/master/README.creole" markup="creole" %}

The output can you see here: Rendered PyLucid 'README.creole' file from github.com

Available Parameters

Shared arguments for include.local_file and include.remote:

parameter default description
encoding "utf-8" content charset
markup None Name of the Markup to apply (e.g.: "creole", "rest")
highlight None File extensions for pygments or True for autodetection (e.g.: "py", "html+django")
strip_html True Cut html tags out from content?

You can combine markup and highlight. Result is pygmentised html code ;)
if not markup and not highlight, the result would be strip_html (optional) and then escaped.

Optional arguments for include.remote to overwrite preferences:

parameter description
remote_template template filename for render the result
socket_timeout socket timeout in seconds for getting remote data
cache_timeout number of seconds to cache remote data