This commit is contained in:
Kovid Goyal 2023-10-01 07:39:58 +05:30
commit 8b5fbe73b3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 45 additions and 3 deletions

View File

@ -48,11 +48,21 @@ def parse_body(item):
if item.get('type') == 'inline':
if c.get('cmsType') == 'listicle':
if 'title' in c:
yield '<h3>' + escape(c['title']) + "</h3>"
yield '<h3>' + escape(c['title']) + '</h3>'
yield c['text']
elif c.get('cmsType') == 'image':
for line in parse_lead_image(c):
yield line
elif c.get('cmsType') == 'imagegroup':
for imgs in c['images']:
for line in parse_lead_image(imgs):
yield line
elif c.get('cmsType') == 'pullquote':
if 'quote' in c:
yield '<blockquote>' + c['quote'] + '</blockquote>'
elif c.get('cmsType') == 'editorsNote':
if 'note' in c:
yield '<blockquote>' + c['note'] + '</blockquote>'
else:
if c['mrkup'].strip().startswith('<'):
yield c['mrkup']
@ -87,6 +97,10 @@ def article_parse(data):
continue
for mod in frm.get('mods', ()):
for edg in mod.get('edgs', ()):
if edg.get('cmsType') == 'ImmersiveLeadTile':
if 'image' in edg.get('cmsImage', {}):
for line in parse_lead_image(edg['cmsImage']):
yield line
if edg.get('cmsType') == 'ArticleBodyTile':
for line in parse_article(edg):
yield line

View File

@ -47,11 +47,21 @@ def parse_body(item):
if item.get('type') == 'inline':
if c.get('cmsType') == 'listicle':
if 'title' in c:
yield '<h3>' + escape(c['title']) + "</h3>"
yield '<h3>' + escape(c['title']) + '</h3>'
yield c['text']
elif c.get('cmsType') == 'image':
for line in parse_lead_image(c):
yield line
elif c.get('cmsType') == 'imagegroup':
for imgs in c['images']:
for line in parse_lead_image(imgs):
yield line
elif c.get('cmsType') == 'pullquote':
if 'quote' in c:
yield '<blockquote>' + c['quote'] + '</blockquote>'
elif c.get('cmsType') == 'editorsNote':
if 'note' in c:
yield '<blockquote>' + c['note'] + '</blockquote>'
else:
if c['mrkup'].strip().startswith('<'):
yield c['mrkup']
@ -86,6 +96,10 @@ def article_parse(data):
continue
for mod in frm.get('mods', ()):
for edg in mod.get('edgs', ()):
if edg.get('cmsType') == 'ImmersiveLeadTile':
if 'image' in edg.get('cmsImage', {}):
for line in parse_lead_image(edg['cmsImage']):
yield line
if edg.get('cmsType') == 'ArticleBodyTile':
for line in parse_article(edg):
yield line

View File

@ -49,11 +49,21 @@ def parse_body(item):
if item.get('type') == 'inline':
if c.get('cmsType') == 'listicle':
if 'title' in c:
yield '<h3>' + escape(c['title']) + "</h3>"
yield '<h3>' + escape(c['title']) + '</h3>'
yield c['text']
elif c.get('cmsType') == 'image':
for line in parse_lead_image(c):
yield line
elif c.get('cmsType') == 'imagegroup':
for imgs in c['images']:
for line in parse_lead_image(imgs):
yield line
elif c.get('cmsType') == 'pullquote':
if 'quote' in c:
yield '<blockquote>' + c['quote'] + '</blockquote>'
elif c.get('cmsType') == 'editorsNote':
if 'note' in c:
yield '<blockquote>' + c['note'] + '</blockquote>'
else:
if c['mrkup'].strip().startswith('<'):
yield c['mrkup']
@ -88,6 +98,10 @@ def article_parse(data):
continue
for mod in frm.get('mods', ()):
for edg in mod.get('edgs', ()):
if edg.get('cmsType') == 'ImmersiveLeadTile':
if 'image' in edg.get('cmsImage', {}):
for line in parse_lead_image(edg['cmsImage']):
yield line
if edg.get('cmsType') == 'ArticleBodyTile':
for line in parse_article(edg):
yield line