Preserve link/title, map rss source to atom source
This commit is contained in:
parent
bc72bf572f
commit
d2f2f8510b
@ -103,6 +103,8 @@ def links(xentry, entry):
|
|||||||
xlink.setAttribute('type', link.get('type'))
|
xlink.setAttribute('type', link.get('type'))
|
||||||
if link.has_key('rel'):
|
if link.has_key('rel'):
|
||||||
xlink.setAttribute('rel', link.get('rel',None))
|
xlink.setAttribute('rel', link.get('rel',None))
|
||||||
|
if link.has_key('title'):
|
||||||
|
xlink.setAttribute('title', link.get('title'))
|
||||||
if link.has_key('length'):
|
if link.has_key('length'):
|
||||||
xlink.setAttribute('length', link.get('length'))
|
xlink.setAttribute('length', link.get('length'))
|
||||||
xentry.appendChild(xlink)
|
xentry.appendChild(xlink)
|
||||||
@ -229,15 +231,11 @@ def source(xsource, source, bozo, format):
|
|||||||
for contributor in source.get('contributors',[]):
|
for contributor in source.get('contributors',[]):
|
||||||
author(xsource, 'contributor', contributor)
|
author(xsource, 'contributor', contributor)
|
||||||
|
|
||||||
links(xsource, source)
|
|
||||||
if not source.has_key('links') and source.has_key('href'): #rss
|
if not source.has_key('links') and source.has_key('href'): #rss
|
||||||
xlink = xdoc.createElement('link')
|
source['links'] = [{ 'href': source.get('href') }]
|
||||||
xlink.setAttribute('href', source.get('href'))
|
if source.has_key('title'):
|
||||||
xsource.appendChild(xlink)
|
source['links'][0]['title'] = source.get('title')
|
||||||
if source.has_key('title'):
|
links(xsource, source)
|
||||||
xtitle = xdoc.createElement('title')
|
|
||||||
xtitle.appendChild(xdoc.createTextNode(source.get('title')))
|
|
||||||
xsource.appendChild(xtitle)
|
|
||||||
|
|
||||||
content(xsource, 'rights', source.get('rights_detail',None), bozo)
|
content(xsource, 'rights', source.get('rights_detail',None), bozo)
|
||||||
content(xsource, 'subtitle', source.get('subtitle_detail',None), bozo)
|
content(xsource, 'subtitle', source.get('subtitle_detail',None), bozo)
|
||||||
|
@ -59,15 +59,16 @@ def splice():
|
|||||||
if data.feed.has_key('id'): sub_ids.append(data.feed.id)
|
if data.feed.has_key('id'): sub_ids.append(data.feed.id)
|
||||||
if not data.feed: continue
|
if not data.feed: continue
|
||||||
|
|
||||||
for link in data.feed.links:
|
if not data.feed.has_key('planet_message'):
|
||||||
if link.rel == 'self': break
|
for link in data.feed.links:
|
||||||
else:
|
if link.rel == 'self': break
|
||||||
log.warn('missing self link for ' + sub)
|
else:
|
||||||
|
log.warn('missing self link for ' + sub)
|
||||||
|
|
||||||
for link in data.feed.links:
|
for link in data.feed.links:
|
||||||
if link.rel == 'alternate' and 'html' in link.type: break
|
if link.rel == 'alternate' and 'html' in link.type: break
|
||||||
else:
|
else:
|
||||||
log.warn('missing html link for ' + sub)
|
log.warn('missing html link for ' + sub)
|
||||||
|
|
||||||
xdoc=minidom.parseString('''<planet:source xmlns:planet="%s"
|
xdoc=minidom.parseString('''<planet:source xmlns:planet="%s"
|
||||||
xmlns="http://www.w3.org/2005/Atom"/>\n''' % planet.xmlns)
|
xmlns="http://www.w3.org/2005/Atom"/>\n''' % planet.xmlns)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
Description: source element
|
Description: source element
|
||||||
Expect: source.title == 'org'
|
Expect: source.links[0].title == 'org' and source.links[0].href == 'http://www.example.org'
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<rss version="2.0">
|
<rss version="2.0">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user