Ejemplo n.º 1
0
    def odd_tag_test(s):
        "If the html has an odd tag (<section> in this case), don't puke or skip it"
        s.assertNotEqual(u.strip_body_tags(u.tidy2html(bad_input[0])), 
                         """<div>
<p>How you like me now?</p>
<section class="field">What up?</section>
</div>
""")
Ejemplo n.º 2
0
def main():
    print u.strip_body_tags(u.tidy2html(bad_input[0]))
Ejemplo n.º 3
0
 def br_test_4(s):
     "Do we handle <br></br>?"
     a = u.strip_body_tags(u.tidy2html("<br></br>"))
     s.assertTrue(a == "<br/>" or a == "<br>")
Ejemplo n.º 4
0
 def comment_test(s):
     "Don't panic if the html has a comment"
     s.assertEqual(u.strip_body_tags(u.tidy2html(bad_input[1])), 
                   "<p>What about comments? <!-- comments! --> Do we like them?</p>")
Ejemplo n.º 5
0
 def empty_tag_test(s):
     """Self-closing tags shouldn't be rendered as just <tag/>, except for <br/>.
     See bug # 10 and commit 9a9f67acfb336fead33a4808be5f7e29335a9d0f"""
     s.assertEqual(u.strip_body_tags(u.tidy2html("hey: <i> </i>")),
                 "<p>hey: <i> </i></p>")
Ejemplo n.º 6
0
         else:
            feed_data['title'] = f['name']
         feed_data['image'] = f['image']
         if 'feedurl' in f:
            feed_data['url'] = f['feedurl']
         else:
            log.error("%s is missing the feedurl key.  Falling back to url" % url)
            feed_data['url'] = f['url']
         lopt['Feeds'].append(feed_data)

      sorted_entries = sorted(entries.values(), reverse=True, 
                              key=parse_updated_time)

      for e in sorted_entries[:50]:
         if 'summary' in e and not 'content' in e:
            e['content_encoded'] = u.strip_body_tags(html2xml(u.tidy2html(e['summary'])).strip())
         elif 'content' in e and e['content'][0]['value']:
            e['content_encoded'] = u.strip_body_tags(html2xml(u.tidy2html(e['content'][0]['value'])).strip())
         else:
            e['summary_encoded'] = 'N/A'
            e['content_encoded'] = 'N/A'
            continue

         if not 'summary' in e:
            e['summary'] = e['content'][0]['value']
         e['summary_encoded'] = u.strip_body_tags(html2xml(u.tidy2html(e['summary'])).strip())

         
      lopt['Items'] = sorted_entries[:50]

      # now do it again for xml