mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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(
|
||||
imgs['caption']['text'], ' ' + imgs['caption']['credit']
|
||||
)
|
||||
yield '</p>'
|
||||
|
||||
|
||||
def parse_cont(content):
|
||||
@ -81,8 +82,7 @@ def parse_body(x):
|
||||
if 'type' in x:
|
||||
tag = x['type']
|
||||
if tag == 'inline':
|
||||
for inl in parse_inline(x):
|
||||
yield inl
|
||||
yield ''.join(parse_inline(x))
|
||||
elif 'attrs' in x and 'href' in x.get('attrs', {}):
|
||||
yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
|
||||
for yld in parse_cont(x):
|
||||
@ -124,8 +124,7 @@ def parse_article(edg):
|
||||
yield inl
|
||||
elif isinstance(item, list):
|
||||
for line in item:
|
||||
for p in parse_body(line):
|
||||
yield p
|
||||
yield ''.join(parse_body(line))
|
||||
|
||||
|
||||
def article_parse(data):
|
||||
|
@ -65,6 +65,7 @@ def parse_inline(inl):
|
||||
yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
|
||||
imgs['caption']['text'], ' ' + imgs['caption']['credit']
|
||||
)
|
||||
yield '</p>'
|
||||
|
||||
|
||||
def parse_cont(content):
|
||||
@ -80,8 +81,7 @@ def parse_body(x):
|
||||
if 'type' in x:
|
||||
tag = x['type']
|
||||
if tag == 'inline':
|
||||
for inl in parse_inline(x):
|
||||
yield inl
|
||||
yield ''.join(parse_inline(x))
|
||||
elif 'attrs' in x and 'href' in x.get('attrs', {}):
|
||||
yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
|
||||
for yld in parse_cont(x):
|
||||
@ -123,8 +123,7 @@ def parse_article(edg):
|
||||
yield inl
|
||||
elif isinstance(item, list):
|
||||
for line in item:
|
||||
for p in parse_body(line):
|
||||
yield p
|
||||
yield ''.join(parse_body(line))
|
||||
|
||||
|
||||
def article_parse(data):
|
||||
|
@ -70,6 +70,7 @@ def parse_inline(inl):
|
||||
yield '<div class="cap">{}<span class="cred">{}</span></div>'.format(
|
||||
imgs['caption']['text'], ' ' + imgs['caption']['credit']
|
||||
)
|
||||
yield '</p>'
|
||||
|
||||
|
||||
def parse_cont(content):
|
||||
@ -85,8 +86,7 @@ def parse_body(x):
|
||||
if 'type' in x:
|
||||
tag = x['type']
|
||||
if tag == 'inline':
|
||||
for inl in parse_inline(x):
|
||||
yield inl
|
||||
yield ''.join(parse_inline(x))
|
||||
elif 'attrs' in x and 'href' in x.get('attrs', {}):
|
||||
yield '<' + tag + ' href = "{}">'.format(x['attrs']['href'])
|
||||
for yld in parse_cont(x):
|
||||
@ -128,8 +128,7 @@ def parse_article(edg):
|
||||
yield inl
|
||||
elif isinstance(item, list):
|
||||
for line in item:
|
||||
for p in parse_body(line):
|
||||
yield p
|
||||
yield ''.join(parse_body(line))
|
||||
|
||||
|
||||
def article_parse(data):
|
||||
|
Loading…
x
Reference in New Issue
Block a user