From d82f91c0ec3deae254273f0f958b84456af0bf8a Mon Sep 17 00:00:00 2001
From: mdipierro
Date: Sun, 9 Sep 2012 09:14:50 -0500
Subject: [PATCH] fixed a bug and replace div anchor with span anchor, as
suggested by Vladyslav
---
VERSION | 2 +-
gluon/contrib/markmin/markmin2html.py | 29 ++++++++++++++-------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/VERSION b/VERSION
index 128b466d..ad0bb575 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-Version 2.0.8 (2012-09-08 23:22:37) stable
+Version 2.0.8 (2012-09-09 09:14:46) stable
diff --git a/gluon/contrib/markmin/markmin2html.py b/gluon/contrib/markmin/markmin2html.py
index bde911fb..1820c620 100755
--- a/gluon/contrib/markmin/markmin2html.py
+++ b/gluon/contrib/markmin/markmin2html.py
@@ -643,7 +643,7 @@ def render(text,
- class_prefix is a prefix for ALL classes in markmin text. E.g. if class_prefix='my_'
then for ``test``:cls class will be changed to "my_cls" (default value is '')
- id_prefix is prefix for ALL ids in markmin text (default value is 'markmin_'). E.g.:
- -- [[id]] will be converted to
+ -- [[id]] will be converted to
-- [[link #id]] will be converted to link
-- ``test``:cls[id] will be converted to test
@@ -774,19 +774,19 @@ def render(text,
'[[probe]]
'
>>> render(r"\\\\[[probe]]")
- '\\\\
'
+ '\\\\
'
>>> render(r"\\\\\\[[probe]]")
'\\\\[[probe]]
'
>>> render(r"\\\\\\\\[[probe]]")
- '\\\\\\\\
'
+ '\\\\\\\\
'
>>> render(r"\\\\\\\\\[[probe]]")
'\\\\\\\\[[probe]]
'
>>> render(r"\\\\\\\\\\\[[probe]]")
- '\\\\\\\\\\\\
'
+ '\\\\\\\\\\\\
'
>>> render("``[[ [\\[[probe\]\\]] URL\\[x\\]]]``:red[dummy_params]")
'URL[x]'
@@ -834,16 +834,16 @@ def render(text,
'test 1
'
>>> render('[[id1 [span **messag** in ''markmin''] ]] ... [[**link** to id [link\\\'s title] #mark1]]')
- 'span messag in markmin
... link to id'
+ 'span messag in markmin ... link to id
'
>>> render('# Multiline[[NEWLINE]]\\n title\\nParagraph[[NEWLINE]]\\nwith breaks[[NEWLINE]]\\nin it')
'Multiline
title
Paragraph
with breaks
in it
'
>>> render("anchor with name 'NEWLINE': [[NEWLINE [ ] ]]")
- 'anchor with name \\'NEWLINE\\':
'
+ 'anchor with name \\'NEWLINE\\':
'
>>> render("anchor with name 'NEWLINE': [[NEWLINE [newline] ]]")
- 'anchor with name \\'NEWLINE\\':
newline
'
+ 'anchor with name \\'NEWLINE\\': newline
'
"""
if autolinks=="default": autolinks = autolinks_simple
if protolinks=="default": protolinks = protolinks_simple
@@ -895,7 +895,7 @@ def render(text,
text = regex_proto.sub(lambda m: protolinks(*m.group('p','k')), text)
if autolinks:
- text = replace_autolinks(text,lambda m: autolinks(m.group('k')))
+ text = replace_autolinks(text,autolinks)
#############################################################
# normalize spaces
@@ -1260,12 +1260,13 @@ def render(text,
% dict(k=k, title=title, target=target, t=t)
if t == 'NEWLINE' and not a:
return '
'+pp
- return '%s
' % (escape(id_prefix+t),
- render(a, {},{},'br', URL,
- environment, latex, autolinks,
- protolinks, class_prefix,
- id_prefix, pretty_print))
-
+ return '%s' % (
+ escape(id_prefix+t),
+ render(a, {},{},'br', URL,
+ environment, latex, autolinks,
+ protolinks, class_prefix,
+ id_prefix, pretty_print))
+
parts = text.split(LINK)
text = parts[0]
for i,s in enumerate(links):