Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/chrisdrackett/python-textile

Conflicts:
	.gitignore
	textile/functions.py
  • Loading branch information...
commit 104eb7d53693dfd788d8fae1b0f2b90a7fd5d15b 2 parents 007fab0 + f111c75
@kurtraschke kurtraschke authored
Showing with 9 additions and 3 deletions.
  1. +1 −0  .gitignore
  2. +8 −3 textile/functions.py
View
1  .gitignore
@@ -14,3 +14,4 @@ dist
eggs
parts
develop-eggs
+.DS_Store
View
11 textile/functions.py
@@ -32,7 +32,8 @@
from urlparse import urlparse
def _normalize_newlines(string):
- out = re.sub(r'\r\n', '\n', string)
+ out = string.strip()
+ out = re.sub(r'\r\n', '\n', out)
out = re.sub(r'\n{3,}', '\n\n', out)
out = re.sub(r'\n\s*\n', '\n\n', out)
out = re.sub(r'"$', '" ', out)
@@ -346,9 +347,12 @@ def lists(self, text):
>>> t.lists("* one\\n* two\\n* three")
'\\t<ul>\\n\\t\\t<li>one</li>\\n\\t\\t<li>two</li>\\n\\t\\t<li>three</li>\\n\\t</ul>'
"""
+ #replaces bullets (U+2022) to * on line start
+ bullet_pattern = re.compile(u'^\xe2\x80\xa2', re.U|re.M)
+
pattern = re.compile(r'^([#*]+%s .*)$(?![^#*])'
% self.c, re.U|re.M|re.S)
- return pattern.sub(self.fList, text)
+ return pattern.sub(self.fList, bullet_pattern.sub('*', text))
def fList(self, match):
text = match.group(0).split("\n")
@@ -735,8 +739,9 @@ def graf(self, text):
if not self.noimage:
text = self.image(text)
+ text = self.lists(text)
+
if not self.lite:
- text = self.lists(text)
text = self.table(text)
text = self.span(text)
Please sign in to comment.
Something went wrong with that request. Please try again.