Show
Ignore:
Timestamp:
09/16/08 13:31:56 (18 months ago)
Author:
JensDiemer
Message:
  • add a pass-through for normal django tags (not blocktags)
  • Move creole markup above
  • Update creole markup help and unittests
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid_project/PyLucid/system/markups/creole.py

    r1766 r1769  
    5050            ]] 
    5151        )''' 
     52 
     53#    link = r'''(?P<link1> 
     54#            \[\[ 
     55#            (?P<link_target1>.+?)\|(?P<link_text1>.+?) 
     56#            ]] 
     57#        )|(?P<link2> 
     58#            \[\[ 
     59#            (?P<link_target2> (%s)://[^ ]+) \s* (?P<link_text2>.+?) 
     60#            ]] 
     61#        )| 
     62#            \[\[(?P<internal_link>.+)\]\] 
     63#        ''' % proto 
    5264 
    5365    #-------------------------------------------------------------------------- 
     
    113125 
    114126    # Pass-through all django template blocktags 
    115     passthrough = r'''^ \s*(?P<passthrough> 
     127    passthrough_block = r'''^ \s*(?P<passthrough_block> 
    116128            {%.*?%} 
    117129            (.|\n)+? 
     
    119131        ) \s*$ 
    120132        ''' 
     133    passthrough_line = r'''(?P<passthrough_line> 
     134            ({%.*?%})| 
     135            ({{.*?}}) 
     136        )''' 
    121137    #Pass-through html code lines 
    122138    html = r'''(?P<html> 
     
    141157    blockelements = ( 
    142158        "head", "list", "pre", "code", "table", "separator", "macro", 
    143         "passthrough", "html" 
     159        "passthrough_block", "html" 
    144160    ) 
    145161 
     
    161177    block_re = re.compile( 
    162178        '|'.join([ 
    163             Rules.passthrough, Rules.html, 
     179            Rules.passthrough_block, 
     180            Rules.html, 
    164181            Rules.line, Rules.head, Rules.separator, Rules.pre, Rules.list, 
    165182            Rules.table, Rules.text, 
     
    168185    ) 
    169186    # For inline elements: 
    170     inline_re = re.compile('|'.join([Rules.link, Rules.url, Rules.macro, 
    171         Rules.code, Rules.image, Rules.strong, Rules.emph, Rules.linebreak, 
    172         Rules.escape, Rules.char]), re.X | re.U) 
     187    inline_re = re.compile( 
     188        '|'.join([ 
     189            Rules.link, Rules.url, Rules.macro, 
     190            Rules.code, Rules.image, 
     191            Rules.passthrough_line, 
     192            Rules.strong, Rules.emph, Rules.linebreak, 
     193            Rules.escape, Rules.char 
     194        ]), 
     195        re.X | re.U 
     196    ) 
    173197 
    174198    def __init__(self, raw): 
     
    197221    # same method needs several names, because of group names in regexps. 
    198222 
    199     def _passthrough_repl(self, groups): 
     223    def _passthrough_block_repl(self, groups): 
    200224        """ Pass-through all django template blocktags """ 
    201225        self._upto_block() 
    202         DocNode("passthrough", self.root, groups["passthrough"]) 
     226        DocNode("passthrough_block", self.root, groups["passthrough_block"]) 
     227        self.text = None 
     228         
     229    def _passthrough_line_repl(self, groups): 
     230        """ Pass-through all django tags """ 
     231        DocNode("passthrough_line", self.cur, groups["passthrough_line"]) 
    203232        self.text = None 
    204233