ó
Û¶eTc @ sï d Z d d l Z i d d 6d d 6Z d e f d „ ƒ YZ e Z e Z d e f d
„ ƒ YZ d e f d „ ƒ YZ d
e f d „ ƒ YZ d e f d „ ƒ YZ
d e f d „ ƒ YZ d e f d „ ƒ YZ d „ Z
e d k rë e
ƒ n d S( sÃ
Filters for the #filter directive as well as #transform
#filter results in output filters Cheetah's $placeholders .
#transform results in a filter on the entirety of the output
iÿÿÿÿNs t s "t "t Filterc B s) e Z d Z d d „ Z d e d „ Z RS( s$ A baseclass for the Cheetah Filters.c C s
| | _ d S( s Setup a reference to the template that is using the filter instance.
This reference isn't used by any of the standard filters, but is
available to Filter subclasses, should they need it.
Subclasses should call this method.
N( t template( t selfR ( ( s> /opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyt __init__ s c K sP | d k r d St | t ƒ r# | Sy t | ƒ SWn t k
rK | | ƒ SXd S( s_
Pass Unicode strings through unmolested, unless an encoding is specified.
u N( t Nonet
isinstancet unicodet UnicodeDecodeError( R t valt encodingt strt kw( ( s> /opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyt filter s
N( t __name__t
__module__t __doc__R R R R ( ( ( s> /opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR
s t Markdownc B s e Z d Z d „ Z RS( s‚
Markdown will change regular strings to Markdown
(http://daringfireball.net/projects/markdown/)
Such that:
My Header
=========
Becaomes:
My Header
and so on.
Markdown is meant to be used with the #transform
tag, as it's usefulness with #filter is marginal at
best
c K s^ y d d l } Wn# t k
r5 d GHd GHd GH‚ n Xt t | ƒ j | | } | j | ƒ S( Niÿÿÿÿs4 >>> Exception raised importing the "markdown" modules; >>> Are you sure you have the ElementTree module installed?s2 http://effbot.org/downloads/#elementtree( t markdownt ImportErrort superR R ( R t valuet kwargsR t encoded( ( s> /opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR ? s
( R R R R ( ( ( s> /opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR . s t CodeHighlighterc B s e Z d Z d „ Z RS( sù
The CodeHighlighter filter depends on the "pygments" module which you can
download and install from: http://pygments.org
What the CodeHighlighter assumes the string that it's receiving is source
code and uses pygments.lexers.guess_lexer() to try to guess which parser
to use when highlighting it.
CodeHighlighter will return the HTML and CSS to render the code block, syntax
highlighted, in a browser
NOTE: I had an issue installing pygments on Linux/amd64/Python 2.6 dealing with
importing of pygments.lexers, I was able to correct the failure by adding:
raise ImportError
to line 39 of pygments/plugin.py (since importing pkg_resources was causing issues)
c K s t t | ƒ j | | } y4 d d l m } d d l m } d d l m } Wn. t k
r } d | j j | f GHd GH| SXd } y | j | ƒ } Wn | j k
r» | j
ƒ } n X| j d d ƒ } | | | | ƒ } | j d ƒ }
d
i |
d 6| d 6S(
Niÿÿÿÿ( t highlight( t lexers( t
formatterss&