Permalink
Browse files

Fixed #58, Added tests for blockquote

  • Loading branch information...
1 parent 88c68be commit 6a5109547233f8b061667871639056cb06fcb4f2 @syrusakbary committed Jan 2, 2013
View
6 pyjade/lexer.py
@@ -25,7 +25,7 @@ class Lexer(object):
RE_EXTENDS = re.compile(r'^extends? +([^\n]+)')
RE_PREPEND = re.compile(r'^prepend +([^\n]+)')
RE_APPEND = re.compile(r'^append +([^\n]+)')
- RE_BLOCK = re.compile(r'^block +(?:(prepend|append) +)?([^\n]*)')
+ RE_BLOCK = re.compile(r'''^block(( +(?:(prepend|append) +)?([^\n]*))|\n)''')
RE_YIELD = re.compile(r'^yield *')
RE_INCLUDE = re.compile(r'^include +([^\n]+)')
RE_ASSIGNMENT = re.compile(r'^(\w+) += *([^;\n]+)( *;? *)')
@@ -172,8 +172,8 @@ def block(self):
captures = regexec(self.RE_BLOCK,self.input)
if captures:
self.consume(len(captures[0]))
- mode = captures[1] or 'replace'
- name = captures[2]
+ mode = captures[3] or 'replace'
+ name = captures[4] or ''
tok = self.tok('block',name)
tok.mode = mode
return tok
View
2 pyjade/testsuite/cases/block-expansion.html
@@ -4,5 +4,7 @@
<li><a href="#">bar</a>
</li>
</ul>
+<blockquote>block
+</blockquote>
<p>baz
</p>
View
2 pyjade/testsuite/cases/block-expansion.jade
@@ -2,4 +2,6 @@ ul
li: a(href='#') foo
li: a(href='#') bar
+blockquote block
+
p baz
View
6 pyjade/testsuite/cases/mixin.blocks.jade
@@ -4,7 +4,7 @@ mixin form(method, action)
form(method=method, action=action)
csrf_token_from_somewhere = 'hey'
input(type='hidden', name='_csrf', value=csrf_token_from_somewhere)
- block
+ block
html
body
@@ -24,12 +24,12 @@ html
mixin bar()
#bar
- block
+ block
mixin foo()
#foo
+bar
- block
+ block
+foo
p one

0 comments on commit 6a51095

Please sign in to comment.