ó Û¶eTc@sïdZddlZidd6dd6Zdefd„ƒYZeZeZd efd „ƒYZd efd „ƒYZd efd„ƒYZ defd„ƒYZ defd„ƒYZ defd„ƒYZ d„Z edkrëe ƒndS(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"tFiltercBs)eZdZdd„Zded„ZRS(s$A baseclass for the Cheetah Filters.cCs ||_dS(sSetup 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(ttemplate(tselfR((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyt__init__scKsP|dkrdSt|tƒr#|Syt|ƒSWntk rK||ƒSXdS(s_ Pass Unicode strings through unmolested, unless an encoding is specified. uN(tNonet isinstancetunicodetUnicodeDecodeError(Rtvaltencodingtstrtkw((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pytfilters  N(t__name__t __module__t__doc__RRR R(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR s tMarkdowncBseZdZd„ZRS(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 cKs^yddl}Wn#tk r5dGHdGHdGH‚nXtt|ƒ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(tmarkdownt ImportErrortsuperRR(RtvaluetkwargsRtencoded((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR?s (RRRR(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR.stCodeHighlightercBseZdZd„ZRS(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 Kstt|ƒj||}y4ddlm}ddlm}ddlm}Wn.tk r}d|jj |fGHdGH|SXd}y|j |ƒ}Wn |j k r»|j ƒ}nX|jddƒ} |||| ƒ}| jd ƒ} d i| d 6|d 6S( Niÿÿÿÿ(t highlight(tlexers(t formatterss&<%s> - Failed to import pygments! (%s)s7-- You may need to install it from: http://pygments.orgtcssclasstcode_highlighters.code_highlightersU%(source)stcsstsource(RRRtpygmentsRRRRt __class__RRt guess_lexert ClassNotFoundt PythonLexert HtmlFormattertget_style_defs( RR RRRRRtextlexert formatterR((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR]s$(RRRR(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyRLstMaxLencBseZd„ZRS(cKsMtt|ƒj||}d|krIt|ƒ|dkrI||d S|S(s+Replace None with '' and cut off at maxlen.tmaxlen(RR+Rtlen(RR R toutput((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyRxs" (RRR(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR+wstWebSafecBseZdZd„ZRS(s+Escape HTML entities in $placeholders. cKsÀtt|ƒj||}|jddƒ}|jddƒ}|jddƒ}d|kr¼|d}t}xL|D]A}||kr“||}ndt|ƒ}|j||ƒ}qtWn|S( Nt&s&ts>talsos&#%s;(RR/RtreplacetwebSafeEntitiestord(RR R tsR3tentitiestktv((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyRƒs     (RRRR(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR/€stStripcBseZdZd„ZRS(s¼Strip leading/trailing whitespace but preserve newlines. This filter goes through the value line by line, removing leading and trailing whitespace on each line. It does not strip newlines, so every input line corresponds to one output line, with its trailing newline intact. We do not use val.split(' ') because that would squeeze out consecutive blank lines. Instead, we search for each newline individually. This makes us unable to use the fast C .split method, but it makes the filter much more widely useful. This filter is intended to be usable both with the #filter directive and with the proposed #sed directive (which has not been ratified yet.) cKs·tt|ƒj||}g}d}xctrŒ|jd|ƒ}|dkrRPn|||!jƒ}|j|ƒ|jdƒ|d}q*W||jƒ}|j|ƒdj|ƒS(Nis iÿÿÿÿit(RR;RtTruetfindtstriptappendtjoin(RR R R7tresulttstarttendtchunk((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR¥s     (RRRR(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR;–st StripSqueezecBseZdZd„ZRS(sÎCanonicalizes every chunk of whitespace to a single space. Strips leading/trailing whitespace. Removes all newlines, so multi-line input is joined into one ling line with NO trailing newline. cKs4tt|ƒj||}|jƒ}dj|ƒS(NR(RRFRtsplitRA(RR R R7((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyR¼s (RRRR(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyRF¶scCs«d}d}dt|ƒfGHdttƒj|ƒƒfGHd GHdt|ƒfGHdttƒj|ƒƒfGHdttƒj|ƒƒfGHdttƒjd ƒƒfGHdS( Ns abc <=> &s asdf 1 2 3 sWebSafe INPUT:s WebSafe:s Strip INPUT:s Strip:s StripSqueeze:sUnicode:u aoeu12345ሴ((treprR/RR;RFt EncodeUnicode(ts1ts2((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyttestÄst__main__(RtsysR5tobjectRtRawOrEncodedUnicodeRIRRR+R/R;RFRLR(((s>/opt/freeware/lib64/python2.7/site-packages/Cheetah/Filters.pyts +