From eea0129768be22d4dcd47519964232d0c4db83e9 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 16 Jul 2012 21:19:14 -0500 Subject: [PATCH] reverted markmin2html example from Valdyslav --- VERSION | 2 +- gluon/contrib/markmin/markmin2html.py | 28 +++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index 8f2c017e..bfc6a423 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-07-16 20:57:59) dev +Version 2.00.0 (2012-07-16 21:19:10) dev diff --git a/gluon/contrib/markmin/markmin2html.py b/gluon/contrib/markmin/markmin2html.py index c0f864a6..1d761ae9 100755 --- a/gluon/contrib/markmin/markmin2html.py +++ b/gluon/contrib/markmin/markmin2html.py @@ -507,14 +507,14 @@ regex_URL=re.compile(r'@\{(?P\w+)/(?P.+?)\}') regex_env=re.compile(r'@\{(?P\w+?)\}') regex_expand_meta = re.compile('('+META+'|'+DISABLED_META+')') regex_dd=re.compile(r'\$\$(?P.*?)\$\$') -regex_code = re.compile('('+META+'|'+DISABLED_META+r')|(``(?P.+?)``(?::(?P[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P

[^\]]*)\])?)?)',re.S) +regex_code = re.compile('('+META+'|'+DISABLED_META+r')|(``(?P.+?)``(?::(?P\w+)(?:\[(?P

\S+?)\])?)?)',re.S) regex_strong=re.compile(r'\*\*(?P[^\s*]+( +[^\s*]+)*)\*\*') regex_del=re.compile(r'~~(?P[^\s*]+( +[^\s*]+)*)~~') regex_em=re.compile(r"''(?P[^\s']+(?: +[^\s']+)*)''") regex_num=re.compile(r"^\s*[+-]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?[0-9]+)?\s*$") regex_list=re.compile('^(?:(#{1,6}|\.+|\++|\-+)(\.)?\s+)?(.*)$') regex_bq_headline=re.compile('^(?:(\.+|\++|\-+)(\.)?\s+)?(-{3}-*)$') -regex_tq=re.compile('^(-{3}-*)(?::(?P[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P

[a-zA-Z][_a-zA-Z\-\d]*)\])?)?$') +regex_tq=re.compile('^(-{3}-*)(?::(?P\S+?)(?:\[(?P

\S+)\])?)?$') regex_qr = re.compile(r'(?/=])qr:(?P\w+://[\w\d\-+?&%/:.]+)',re.M) regex_embed = re.compile(r'(?/=])embed:(?P\w+://[\w\d\-+_=?%&/:.]+)', re.M) regex_iframe = re.compile(r'(?/=])iframe:(?P\w+://[\w\d\-+=?%&/:.]+)', re.M) @@ -536,7 +536,7 @@ def markmin_escape(text): """ insert \\ before markmin control characters: '`:*~[]{}@$ """ return regex_markmin_escape.sub(lambda m: '\\'+m.group(0).replace('\\','\\\\'), text) -def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='google',auto=True,class_prefix='',id_prefix='markmin_'): +def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='google',auto=True): """ Arguments: - text is the text to be processed @@ -564,13 +564,13 @@ def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='goo >>> render('``\\nhello\\nworld\\n``:python') '

hello\\nworld
' >>> render('``hello world``:python[test_id]') - 'hello world' + 'hello world' >>> render('``hello world``:id[test_id]') - 'hello world' + 'hello world' >>> render('``\\nhello\\nworld\\n``:python[test_id]') - '
hello\\nworld
' + '
hello\\nworld
' >>> render('``\\nhello\\nworld\\n``:id[test_id]') - '
hello\\nworld
' + '
hello\\nworld
' >>> render("''hello world''") '

hello world

' >>> render('** hello** **world**') @@ -699,7 +699,7 @@ def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='goo >>> render("the [[link \\[**without** ``title``:red\\] http://www.example.com]]") '

the link [without <b>title</b>]

' - >>> render("aaa-META-``code``:text[]-LINK-[[link http://www.example.com]]-LINK-[[image http://www.picture.com img]]-end") + >>> render("aaa-META-``code``:text-LINK-[[link http://www.example.com]]-LINK-[[image http://www.picture.com img]]-end") '

aaa-META-code-LINK-link-LINK-image-end

' >>> render("[[test [test2] text3]]") @@ -930,8 +930,8 @@ def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='goo ) for f in s.split('|')])+'') lineno+=1 - 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_cls = ' class="%s"'%t_cls if t_cls and t_cls != 'id' else '' + t_id = ' id="%s"'%t_id if t_id else '' s = '' if thead: s += ''+''.join([l for l in thead])+'' @@ -974,8 +974,8 @@ def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='goo lineno+=1 - 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_cls = ' class="%s"'%t_cls if t_cls and t_cls != 'id' else '' + t_id = ' id="%s"'%t_id if t_id else '' s = '%s' \ % (t_cls, t_id, @@ -1166,8 +1166,8 @@ def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='goo bg='background-color: %s;' % c[1] if len(c)>1 and c[1] else '' return '%s' \ % (fg, bg, render(code,{},{},'br', URL, environment, latex, auto)) - cls = ' class="%s%s"'%(class_prefix,b) if b and b != 'id' else '' - id = ' id="%s%s"'%(id_prefix,escape(p)) if p else '' + cls = ' class="%s"'%b if b and b != 'id' else '' + id = ' id="%s"'%escape(p) if p else '' if code[:1]=='\n' and code[-1:]=='\n': return '
%s
' % (cls, id, escape(code[1:-1])) return '%s' \