diff --git a/VERSION b/VERSION index de907de5..ce7a71ef 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-07-17 10:59:23) dev +Version 2.00.0 (2012-07-17 12:35:54) dev diff --git a/applications/admin/views/default/plugin.html b/applications/admin/views/default/plugin.html index 8e5c6181..aded9d40 100644 --- a/applications/admin/views/default/plugin.html +++ b/applications/admin/views/default/plugin.html @@ -50,8 +50,8 @@ def deletefile(arglist): {{=button("#modules", T("modules"))}} diff --git a/gluon/compileapp.py b/gluon/compileapp.py index 76b4fe72..516e92a4 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -40,18 +40,15 @@ import imp import logging logger = logging.getLogger("web2py") import rewrite -import platform try: import py_compile except: logger.warning('unable to import py_compile') -is_pypy = hasattr(platform,'python_implementation') and \ - platform.python_implementation() == 'PyPy' -settings.global_settings.is_pypy = is_pypy -is_gae = settings.global_settings.web2py_runtime_gae -is_jython = settings.global_settings.is_jython = 'java' in sys.platform.lower() or hasattr(sys, 'JYTHON_JAR') or str(sys.copyright).find('Jython') > 0 +is_pypy = settings.global_settings.is_pypy +is_gae = settings.global_settings.web2py_runtime_gae +is_jython = settings.global_settings.is_jython TEST_CODE = \ r""" diff --git a/gluon/contrib/markmin/markmin.html b/gluon/contrib/markmin/markmin.html index aa556392..d68ae23a 100644 --- a/gluon/contrib/markmin/markmin.html +++ b/gluon/contrib/markmin/markmin.html @@ -17,7 +17,7 @@ print markmin2html(m) from markmin2latex import markmin2latex print markmin2latex(m) from markmin2pdf import markmin2pdf # requires pdflatex -print markmin2pdf(m) ====================
This is a blockquote with a list with tables in it:
This is a paragraph before list. You can continue paragraph on the next lines.
This is an ordered list with tables:
- Item 1
- Item 2
aa bb cc 11 22 33 - Item 4
T1 T2 t3 aaa bbb ccc ddd fff ggg 123 0 5.0
This this a new paragraph with a table. Table has header and footer:
| Title 1 | Title 2 | Title 3 |
| data 1 | data 2 | 2.00 |
| data 4 | data5(long) | 23.00 |
| data 8 | 33.50 | |
| Total: | 3 items | 58.50 |
Now lists can be multilevel:
Ordered item 1 of sublevel 2 with a paragraph (paragraph can start with point after plus or minus characters, e.g. ++. or --.)
This is another item. But with 3 paragraphs, blockquote and sublists:
This is the second paragraph in the item. You can add paragraphs to an item, using point notation, where first characters in the string are sequence of points with space between them and another string. For example, this paragraph (in sublevel 2) starts with two points:
.. This is the second paragraph...this is a blockquote in a list
You can use blockquote with headers, paragraphs, tables and lists in it:
Tables can have or have not header and footer. This table is defined without any header and footer in it:
red fox 0 blue dolphin 1000 green leaf 10000
This is yet another paragraph in the item.
and this is a paragraph in sublevel 4
This is a new item with paragraph in sublevel 3.
line 1
+print markmin2pdf(m) ====================This is a blockquote with a list with tables in it:
This is a paragraph before list. You can continue paragraph on the next lines.
This is an ordered list with tables:
- Item 1
- Item 2
aa bb cc 11 22 33 - Item 4
T1 T2 t3 aaa bbb ccc ddd fff ggg 123 0 5.0
This this a new paragraph with a table. Table has header and footer:
| Title 1 | Title 2 | Title 3 |
| data 1 | data 2 | 2.00 |
| data 4 | data5(long) | 23.00 |
| data 8 | 33.50 | |
| Total: | 3 items | 58.50 |
Now lists can be multilevel:
Ordered item 1 of sublevel 2 with a paragraph (paragraph can start with point after plus or minus characters, e.g. ++. or --.)
This is another item. But with 3 paragraphs, blockquote and sublists:
This is the second paragraph in the item. You can add paragraphs to an item, using point notation, where first characters in the string are sequence of points with space between them and another string. For example, this paragraph (in sublevel 2) starts with two points:
.. This is the second paragraph...this is a blockquote in a list
You can use blockquote with headers, paragraphs, tables and lists in it:
Tables can have or have not header and footer. This table is defined without any header and footer in it:
red fox 0 blue dolphin 1000 green leaf 10000
This is yet another paragraph in the item.
and this is a paragraph in sublevel 4
This is a new item with paragraph in sublevel 3.
line 1
line 2
line 3Yet another item with code block:
line 1
line 2
@@ -47,7 +47,7 @@ code block
X | 0 | 0
=================
**D**|**F**|**G**
------------------:abc[id] is a table and is rendered as| A | B | C |
| 0 | 0 | X |
| 0 | X | 0 |
| X | 0 | 0 |
| D | F | G |
:abc, :id[abc_1] or :abc[abc_1] at the end sets the class and/or id for the table and it is optional.A table with a single cell is rendered as a blockquote:
Hello world
Blockquote can contain headers, paragraphs, lists and tables:
-----
+-----------------:abc[id] is a table and is rendered as| A | B | C |
| 0 | 0 | X |
| 0 | X | 0 |
| X | 0 | 0 |
| D | F | G |
:abc, :id[abc_1] or :abc[abc_1] at the end sets the class and/or id for the table and it is optional.A table with a single cell is rendered as a blockquote:
Hello world
Blockquote can contain headers, paragraphs, lists and tables:
-----
This is a paragraph in a blockquote
+ item 1
diff --git a/gluon/contrib/markmin/markmin2html.py b/gluon/contrib/markmin/markmin2html.py
index 1d761ae9..2b305608 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\w+)(?:\[(?P\S+?)\])?)?)',re.S)
+regex_code = re.compile('('+META+'|'+DISABLED_META+r')|(``(?P.+?)``(?::(?P[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P[^\]]*)\])?)?)',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\S+?)(?:\[(?P\S+)\])?)?$')
+regex_tq=re.compile('^(-{3}-*)(?::(?P[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P[a-zA-Z][_a-zA-Z\-\d]*)\])?)?$')
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):
+def render(text,extra={},allowed={},sep='p',URL=None,environment=None,latex='google',auto=True,class_prefix='',id_prefix='markmin_'):
"""
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-
-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"'%t_cls if t_cls and t_cls != 'id' else ''
- t_id = ' id="%s"'%t_id if t_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 ''
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"'%t_cls if t_cls and t_cls != 'id' else ''
- t_id = ' id="%s"'%t_id if t_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 ''
s = '%s
' \
% (t_cls,
t_id,
@@ -1166,13 +1166,13 @@ 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"'%b if b and b != 'id' else ''
- id = ' id="%s"'%escape(p) if p else ''
- if code[:1]=='\n' and code[-1:]=='\n':
+ cls = ' class="%s%s"'%(class_prefix,b) if b and b != 'id' else ''
+ id = ' id="%s%s"'%(id_prefix,escape(p)) if p else ''
+ beg=(code[:1]=='\n')
+ end=[None,-1][code[-1:]=='\n']
+ if beg and end:
return '%s
' % (cls, id, escape(code[1:-1]))
- return '%s' \
- % (cls, id, escape(code[ (code[:1]=='\n')
- : [None,-1][code[-1:]=='\n']]))
+ return '%s' % (cls, id, escape(code[beg:end]))
text = regex_expand_meta.sub(expand_meta, text)
text = text.translate(ttab_out)
return text