349 }})()""" |
349 }})()""" |
350 |
350 |
351 data = bytes(data).decode("utf-8") |
351 data = bytes(data).decode("utf-8") |
352 data = data.replace("'", "\\'") |
352 data = data.replace("'", "\\'") |
353 return source.format(data) |
353 return source.format(data) |
|
354 |
|
355 ########################################################################### |
|
356 ## scripts below are specific for eric |
|
357 ########################################################################### |
|
358 |
|
359 |
|
360 def getFeedLinks(): |
|
361 """ |
|
362 Function generating a script to extract all RSS and Atom feed links. |
|
363 |
|
364 @return script to extract all RSS and Atom feed links |
|
365 @rtype str |
|
366 """ |
|
367 source = """ |
|
368 (function() { |
|
369 var out = []; |
|
370 var links = document.getElementsByTagName('link'); |
|
371 for (var i = 0; i < links.length; ++i) { |
|
372 var e = links[i]; |
|
373 if ((e.rel == 'alternate') && |
|
374 ((e.type == 'application/atom+xml') || |
|
375 (e.type == 'application/rss+xml') |
|
376 ) |
|
377 ) { |
|
378 out.push({ |
|
379 url: e.getAttribute('href'), |
|
380 title: e.getAttribute('title') |
|
381 }); |
|
382 } |
|
383 } |
|
384 return out; |
|
385 })()""" |
|
386 return source |