Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

Conflicts:
	.gitignore
	textile/functions.py
  • Loading branch information...
commit 104eb7d53693dfd788d8fae1b0f2b90a7fd5d15b 2 parents 007fab0 + f111c75
Kurt Raschke authored
1  .gitignore
@@ -14,3 +14,4 @@ dist
14 14
 eggs
15 15
 parts
16 16
 develop-eggs
  17
+.DS_Store
11  textile/functions.py
@@ -32,7 +32,8 @@
32 32
 from urlparse import urlparse
33 33
 
34 34
 def _normalize_newlines(string):
35  
-    out = re.sub(r'\r\n', '\n', string)
  35
+    out = string.strip()
  36
+    out = re.sub(r'\r\n', '\n', out)
36 37
     out = re.sub(r'\n{3,}', '\n\n', out)
37 38
     out = re.sub(r'\n\s*\n', '\n\n', out)
38 39
     out = re.sub(r'"$', '" ', out)
@@ -346,9 +347,12 @@ def lists(self, text):
346 347
         >>> t.lists("* one\\n* two\\n* three")
347 348
         '\\t<ul>\\n\\t\\t<li>one</li>\\n\\t\\t<li>two</li>\\n\\t\\t<li>three</li>\\n\\t</ul>'
348 349
         """
  350
+        #replaces bullets (U+2022) to * on line start
  351
+        bullet_pattern = re.compile(u'^\xe2\x80\xa2', re.U|re.M)
  352
+        
349 353
         pattern = re.compile(r'^([#*]+%s .*)$(?![^#*])' 
350 354
                              % self.c, re.U|re.M|re.S)
351  
-        return pattern.sub(self.fList, text)
  355
+        return pattern.sub(self.fList, bullet_pattern.sub('*', text))
352 356
 
353 357
     def fList(self, match):
354 358
         text = match.group(0).split("\n")
@@ -735,8 +739,9 @@ def graf(self, text):
735 739
         if not self.noimage:
736 740
             text = self.image(text)
737 741
 
  742
+        text = self.lists(text)
  743
+
738 744
         if not self.lite:
739  
-            text = self.lists(text)
740 745
             text = self.table(text)
741 746
 
742 747
         text = self.span(text)

0 notes on commit 104eb7d

Please sign in to comment.
Something went wrong with that request. Please try again.