mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-04 03:27:00 -05:00 
			
		
		
		
	MOBI Output: Fix space errorneously being removed when the input document contains a tag with leading space and sub-tags. Fixes #1179216 (Space lost between span tags converting to mobi)
This commit is contained in:
		
							parent
							
								
									689808861a
								
							
						
					
					
						commit
						1c225cac66
					
				@ -16,7 +16,8 @@ from calibre.ebooks.oeb.transforms.flatcss import KeyMapper
 | 
				
			|||||||
from calibre.utils.magick.draw import identify_data
 | 
					from calibre.utils.magick.draw import identify_data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MBP_NS = 'http://mobipocket.com/ns/mbp'
 | 
					MBP_NS = 'http://mobipocket.com/ns/mbp'
 | 
				
			||||||
def MBP(name): return '{%s}%s' % (MBP_NS, name)
 | 
					def MBP(name):
 | 
				
			||||||
 | 
					    return '{%s}%s' % (MBP_NS, name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MOBI_NSMAP = {None: XHTML_NS, 'mbp': MBP_NS}
 | 
					MOBI_NSMAP = {None: XHTML_NS, 'mbp': MBP_NS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -413,7 +414,7 @@ class MobiMLizer(object):
 | 
				
			|||||||
                        # img sizes in units other than px
 | 
					                        # img sizes in units other than px
 | 
				
			||||||
                        # See #7520 for test case
 | 
					                        # See #7520 for test case
 | 
				
			||||||
                        try:
 | 
					                        try:
 | 
				
			||||||
                            pixs = int(round(float(value) / \
 | 
					                            pixs = int(round(float(value) /
 | 
				
			||||||
                                (72./self.profile.dpi)))
 | 
					                                (72./self.profile.dpi)))
 | 
				
			||||||
                        except:
 | 
					                        except:
 | 
				
			||||||
                            continue
 | 
					                            continue
 | 
				
			||||||
@ -488,8 +489,6 @@ class MobiMLizer(object):
 | 
				
			|||||||
        if elem.text:
 | 
					        if elem.text:
 | 
				
			||||||
            if istate.preserve:
 | 
					            if istate.preserve:
 | 
				
			||||||
                text = elem.text
 | 
					                text = elem.text
 | 
				
			||||||
            elif len(elem) > 0 and isspace(elem.text):
 | 
					 | 
				
			||||||
                text = None
 | 
					 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                text = COLLAPSE.sub(' ', elem.text)
 | 
					                text = COLLAPSE.sub(' ', elem.text)
 | 
				
			||||||
        valign = style['vertical-align']
 | 
					        valign = style['vertical-align']
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user