Aram Dulyan avatar Aram Dulyan committed 0c7b417

Fixed some issues with the interaction of links and simple tags when there are multiple links.

Comments (0)

Files changed (2)

             textile = '\n\n'
         elif tag == 'a':
+            self.block = False
             title = self.a_part.get('title', None)
-            textilized = ' "%(tag_open)s%(haystack)s%(tag_close)s%(title)s":%(href)s ' % {
+            textilized = '%(space)s"%(tag_open)s%(haystack)s%(tag_close)s%(title)s":%(href)s ' % {
+                'space': '' if self._ends_with_newline() else ' ',
                 'tag_open': ''.join(reversed(self.tags_inside_links)),
                 'haystack': ''.join(self.haystack),
                 'tag_close': ''.join(self.tags_inside_links),
                 'title': ' (%s)' % title if title else '',
                 'href': safe_url(self.a_part.get('href', ''), ' '),
-            self.haystack = []         
+            self.haystack = []
+            self.tags_inside_links = []      
-            self.block = False
         elif tag == 'ul':
             self.ul_ident -= 1
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 Test the correct handling of whitespace around Textile mark-up:
 >>> convert('Some <em>emphasised</em> text.')
 bq. Quoted text.
+Ensure links are not unnecessarily indented at the start of paragraphs.
+>>> convert('<p><a href="">Link</a></p><p><a href="">Link</a></p>')
 Test line breaks:
 >>> convert('<p><span style="color: navy"><span><a href="">Link</a></span></span></p>')
+Test that behaviour is consistent across paragraps.
+>>> convert('<p><em><strong><a href="">Link</a></strong></em></p>\
+             <p><em><strong><a href="">Link</a></strong></em></p>')
 Test classes and IDs.
 >>> convert('<p class="some_class" id="some_id">Some text.</p>')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.