Submit
Path:
~
/
/
usr
/
lib64
/
python2.7
/
site-packages
/
Cheetah
/
File Content:
Filters.pyc
� [Z-Lc @ 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 ( ( s5 /usr/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( ( s5 /usr/lib64/python2.7/site-packages/Cheetah/Filters.pyt filter s N( t __name__t __module__t __doc__R R R R ( ( ( s5 /usr/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: <h1>My Header</h1> 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( ( s5 /usr/lib64/python2.7/site-packages/Cheetah/Filters.pyR ? s ( R R R R ( ( ( s5 /usr/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&