Changeset 1299

Show
Ignore:
Timestamp:
10/30/07 16:31:54 (13 months ago)
Author:
JensDiemer
Message:

bugfixes for pygments.

Location:
trunk/pylucid/PyLucid
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/system/hightlighter.py

    r1280 r1299  
    11 
    2 from PyLucid.tools.content_processors import escape 
     2from PyLucid.tools.content_processors import escape, escape_django_tags 
    33 
    44from django.conf import settings 
     
    2121    '</fieldset>' 
    2222) 
     23CSSCLASS = "pygments" 
    2324 
    2425def make_html(sourcecode, source_type): 
     
    5455 
    5556    formatter = HtmlFormatter( 
    56         linenos=True, encoding="utf-8", style='colorful' 
     57        linenos=True, encoding="utf-8", style='colorful', 
     58        cssclass = CSSCLASS, 
    5759    ) 
    5860 
    59     stylesheet = formatter.get_style_defs('.pygments_code') 
     61    #stylesheet = formatter.get_style_defs(CSSCLASS) 
    6062 
    6163#    self.context["css_data"].append({ 
     
    6870    html = out_object.getvalue() 
    6971 
     72    # If there is e.g. html code with django tags, we must escape this: 
     73    html = escape_django_tags(html) 
     74 
    7075    return html, lexer_name 
    7176 
  • trunk/pylucid/PyLucid/tools/content_processors.py

    r1283 r1299  
    149149from xml.sax.saxutils import escape as sax_escape 
    150150ENTITIES = { 
    151 #    &amp;#x7B;% lucidTag RSS url=&quot;http url&quot; title=&quot;a feed&quot; %&amp;#x7D; 
    152     "{" : "&#x7B;", 
    153     "}" : "&#x7D;", 
     151    "{{" : "&#x7B;&#x7B;", 
     152    "}}" : "&#x7D;&#x7D;", 
     153    "{%" : "&#x7B;%", 
     154    "%}" : "%&#x7D;", 
    154155} 
    155156def escape(txt):