File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -190,3 +190,12 @@ def test_github_issue_51():
190190 result = textile .textile (test )
191191 expect = '\t <p><a href="www.google.com.br">www.google.com.br</a></p>'
192192 assert result == expect
193+
194+ def test_github_issue_52 ():
195+ """Table build without space after aligment raise a AttributeError."""
196+ test = '|=.First Header |=. Second Header |'
197+ result = textile .textile (test )
198+ expect = ('\t <table>\n \t \t <tr>\n \t \t \t <td>=.First Header '
199+ '</td>\n \t \t \t <td style="text-align:center;">Second Header </td>'
200+ '\n \t \t </tr>\n \t </table>' )
201+ assert result == expect
Original file line number Diff line number Diff line change @@ -38,15 +38,17 @@ def process(self):
3838 # as a normal center-aligned cell.
3939 if i == 0 and row [:2 ] == '|=' :
4040 captionpattern = (r"^\|\=(?P<capts>{s}{a}{c})\. "
41- r"(?P<cap>[^\n]*)(?P<row>.*)" .format (** {'s' :
42- table_span_re_s , 'a' : align_re_s , 'c' : cls_re_s }))
41+ r"(?P<cap>[^\n]*)(?P<row>.*)" .format (** {
42+ 's' : table_span_re_s , 'a' : align_re_s ,
43+ 'c' : cls_re_s }))
4344 caption_re = re .compile (captionpattern , re .S )
4445 cmtch = caption_re .match (row )
45- caption = Caption (** cmtch .groupdict ())
46- self .caption = '\n {0}' .format (caption .caption )
47- row = cmtch .group ('row' ).lstrip ()
48- if row == '' :
49- continue
46+ if cmtch :
47+ caption = Caption (** cmtch .groupdict ())
48+ self .caption = '\n {0}' .format (caption .caption )
49+ row = cmtch .group ('row' ).lstrip ()
50+ if row == '' :
51+ continue
5052
5153 # Colgroup -- A colgroup row will not necessarily end with a |.
5254 # Hence it may include the next row of actual table data.
You can’t perform that action at this time.
0 commit comments