fixed issue 1618:markmin problem with blockquote

This commit is contained in:
mdipierro
2013-08-07 07:47:45 -05:00
parent 237ace5f7f
commit ae4d9dab10
2 changed files with 24 additions and 31 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.6.0-development+timestamp.2013.08.07.07.28.14 Version 2.6.0-development+timestamp.2013.08.07.07.46.58
+23 -30
View File
@@ -1014,8 +1014,8 @@ def render(text,
# - is empty -> this is an <hr /> tag # - is empty -> this is an <hr /> tag
# - consists '|' -> table # - consists '|' -> table
# - consists other characters -> blockquote # - consists other characters -> blockquote
if ( lineno+1 >= strings_len or if (lineno+1 >= strings_len or
not (s.count('-') == len(s) and len(s)>3) ): not(s.count('-') == len(s) and len(s)>3)):
return (s, mtag, lineno) return (s, mtag, lineno)
lineno+=1 lineno+=1
@@ -1034,7 +1034,8 @@ def render(text,
while lineno < strings_len: while lineno < strings_len:
s = strings[lineno].strip() s = strings[lineno].strip()
if s[:1] == '=': if s[:1] == '=':
if s.count('=')==len(s) and len(s)>3: # header or footer # header or footer
if s.count('=')==len(s) and len(s)>3:
if not thead: # if thead list is empty: if not thead: # if thead list is empty:
thead = tout thead = tout
else: else:
@@ -1054,16 +1055,16 @@ def render(text,
tr = '<tr class="even">' tr = '<tr class="even">'
else: else:
tr = '<tr class="first">' if rownum == 0 else '<tr>' tr = '<tr class="first">' if rownum == 0 else '<tr>'
tout.append(tr+''.join(['<td%s>%s</td>'% \ tout.append(tr + ''.join(['<td%s>%s</td>' % (
(' class="num"' ' class="num"'
if regex_num.match(f) if regex_num.match(f) else '',
else '', f.strip()
f.strip() ) for f in s.split('|')])+'</tr>'+pp)
) for f in s.split('|')])+'</tr>'+pp)
rownum+=1 rownum+=1
lineno+=1 lineno+=1
t_cls = ' class="%s%s"'%(class_prefix, t_cls) if t_cls and t_cls != 'id' else '' t_cls = ' class="%s%s"'%(class_prefix, t_cls) \
if t_cls and t_cls != 'id' else ''
t_id = ' id="%s%s"'%(id_prefix, t_id) if t_id else '' t_id = ' id="%s%s"'%(id_prefix, t_id) if t_id else ''
s = '' s = ''
if thead: if thead:
@@ -1080,7 +1081,7 @@ def render(text,
else: else:
# parse blockquote: # parse blockquote:
bq_begin=lineno bq_begin=lineno
t_mode = False # embidded table t_mode = False # embedded table
t_cls = '' t_cls = ''
t_id = '' t_id = ''
@@ -1090,13 +1091,15 @@ def render(text,
if not t_mode: if not t_mode:
m = regex_tq.match(s) m = regex_tq.match(s)
if m: if m:
if lineno+1 == strings_len or '|' not in strings[lineno+1]: if (lineno+1 == strings_len or
'|' not in strings[lineno+1]):
t_cls = m.group('c') or '' t_cls = m.group('c') or ''
t_id = m.group('p') or '' t_id = m.group('p') or ''
break break
if regex_bq_headline.match(s): if regex_bq_headline.match(s):
if lineno+1 < strings_len and strings[lineno+1].strip(): if (lineno+1 < strings_len and
strings[lineno+1].strip()):
t_mode = True t_mode = True
lineno+=1 lineno+=1
continue continue
@@ -1107,25 +1110,15 @@ def render(text,
lineno+=1 lineno+=1
t_cls = ' class="%s%s"'%(class_prefix,t_cls) if t_cls and t_cls != 'id' else '' t_cls = ' class="%s%s"'%(class_prefix,t_cls) \
t_id = ' id="%s%s"'%(id_prefix,t_id) if t_id else '' if t_cls and t_cls != 'id' else ''
t_id = ' id="%s%s"'%(id_prefix,t_id) \
if t_id else ''
s = '<blockquote%s%s>%s</blockquote>%s' \ s = '<blockquote%s%s>%s</blockquote>%s' \
% (t_cls, % (t_cls,
t_id, t_id,
render('\n'.join(strings[bq_begin:lineno]), '\n'.join(strings[bq_begin:lineno]),pp)
extra,
allowed,
'br',
URL,
environment,
latex,
autolinks,
protolinks,
class_prefix,
id_prefix,
pretty_print),
pp
)
mtag='q' mtag='q'
else: else:
s = '<hr />' s = '<hr />'
@@ -1440,4 +1433,4 @@ if __name__ == '__main__':
print " file.markmin [file.css] - process file.markmin + built in file.css (optional)" print " file.markmin [file.css] - process file.markmin + built in file.css (optional)"
print " file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)" print " file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)"
run_doctests() run_doctests()