mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	...
fix html.
This commit is contained in:
		
							parent
							
								
									96aead4da9
								
							
						
					
					
						commit
						01b16cd9f8
					
				@ -66,6 +66,7 @@ def parse_inline(inl):
 | 
				
			|||||||
                    yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
 | 
					                    yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
 | 
				
			||||||
                    imgs['caption']['text'], ' ' + imgs['caption']['credit']
 | 
					                    imgs['caption']['text'], ' ' + imgs['caption']['credit']
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
 | 
					                yield '</p>'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def parse_cont(content):
 | 
					def parse_cont(content):
 | 
				
			||||||
@ -81,8 +82,7 @@ def parse_body(x):
 | 
				
			|||||||
        if 'type' in x:
 | 
					        if 'type' in x:
 | 
				
			||||||
            tag = x['type']
 | 
					            tag = x['type']
 | 
				
			||||||
            if tag == 'inline':
 | 
					            if tag == 'inline':
 | 
				
			||||||
                for inl in parse_inline(x):
 | 
					                yield ''.join(parse_inline(x))
 | 
				
			||||||
                    yield inl
 | 
					 | 
				
			||||||
            elif 'attrs' in x and 'href' in x.get('attrs', {}):
 | 
					            elif 'attrs' in x and 'href' in x.get('attrs', {}):
 | 
				
			||||||
                yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
 | 
					                yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
 | 
				
			||||||
                for yld in parse_cont(x):
 | 
					                for yld in parse_cont(x):
 | 
				
			||||||
@ -124,8 +124,7 @@ def parse_article(edg):
 | 
				
			|||||||
                            yield inl
 | 
					                            yield inl
 | 
				
			||||||
                elif isinstance(item, list):
 | 
					                elif isinstance(item, list):
 | 
				
			||||||
                    for line in item:
 | 
					                    for line in item:
 | 
				
			||||||
                        for p in parse_body(line):
 | 
					                        yield ''.join(parse_body(line))
 | 
				
			||||||
                            yield p
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def article_parse(data):
 | 
					def article_parse(data):
 | 
				
			||||||
 | 
				
			|||||||
@ -65,6 +65,7 @@ def parse_inline(inl):
 | 
				
			|||||||
                    yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
 | 
					                    yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
 | 
				
			||||||
                    imgs['caption']['text'], ' ' + imgs['caption']['credit']
 | 
					                    imgs['caption']['text'], ' ' + imgs['caption']['credit']
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
 | 
					                yield '</p>'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def parse_cont(content):
 | 
					def parse_cont(content):
 | 
				
			||||||
@ -80,8 +81,7 @@ def parse_body(x):
 | 
				
			|||||||
        if 'type' in x:
 | 
					        if 'type' in x:
 | 
				
			||||||
            tag = x['type']
 | 
					            tag = x['type']
 | 
				
			||||||
            if tag == 'inline':
 | 
					            if tag == 'inline':
 | 
				
			||||||
                for inl in parse_inline(x):
 | 
					                yield ''.join(parse_inline(x))
 | 
				
			||||||
                    yield inl
 | 
					 | 
				
			||||||
            elif 'attrs' in x and 'href' in x.get('attrs', {}):
 | 
					            elif 'attrs' in x and 'href' in x.get('attrs', {}):
 | 
				
			||||||
                yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
 | 
					                yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
 | 
				
			||||||
                for yld in parse_cont(x):
 | 
					                for yld in parse_cont(x):
 | 
				
			||||||
@ -123,8 +123,7 @@ def parse_article(edg):
 | 
				
			|||||||
                            yield inl
 | 
					                            yield inl
 | 
				
			||||||
                elif isinstance(item, list):
 | 
					                elif isinstance(item, list):
 | 
				
			||||||
                    for line in item:
 | 
					                    for line in item:
 | 
				
			||||||
                        for p in parse_body(line):
 | 
					                        yield ''.join(parse_body(line))
 | 
				
			||||||
                            yield p
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def article_parse(data):
 | 
					def article_parse(data):
 | 
				
			||||||
 | 
				
			|||||||
@ -70,6 +70,7 @@ def parse_inline(inl):
 | 
				
			|||||||
                    yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
 | 
					                    yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
 | 
				
			||||||
                    imgs['caption']['text'], ' ' + imgs['caption']['credit']
 | 
					                    imgs['caption']['text'], ' ' + imgs['caption']['credit']
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
 | 
					                yield '</p>'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def parse_cont(content):
 | 
					def parse_cont(content):
 | 
				
			||||||
@ -85,8 +86,7 @@ def parse_body(x):
 | 
				
			|||||||
        if 'type' in x:
 | 
					        if 'type' in x:
 | 
				
			||||||
            tag = x['type']
 | 
					            tag = x['type']
 | 
				
			||||||
            if tag == 'inline':
 | 
					            if tag == 'inline':
 | 
				
			||||||
                for inl in parse_inline(x):
 | 
					                yield ''.join(parse_inline(x))
 | 
				
			||||||
                    yield inl
 | 
					 | 
				
			||||||
            elif 'attrs' in x and 'href' in x.get('attrs', {}):
 | 
					            elif 'attrs' in x and 'href' in x.get('attrs', {}):
 | 
				
			||||||
                yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
 | 
					                yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
 | 
				
			||||||
                for yld in parse_cont(x):
 | 
					                for yld in parse_cont(x):
 | 
				
			||||||
@ -128,8 +128,7 @@ def parse_article(edg):
 | 
				
			|||||||
                            yield inl
 | 
					                            yield inl
 | 
				
			||||||
                elif isinstance(item, list):
 | 
					                elif isinstance(item, list):
 | 
				
			||||||
                    for line in item:
 | 
					                    for line in item:
 | 
				
			||||||
                        for p in parse_body(line):
 | 
					                        yield ''.join(parse_body(line))
 | 
				
			||||||
                            yield p
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def article_parse(data):
 | 
					def article_parse(data):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user