コード例 #1
0
ファイル: _email.py プロジェクト: dpwhite2/linkanalytics
def _html_to_text(html, full_document=True):
    """Convert the given html string into a plain text string.  If 
       full_document is True, only convert data within the body element--ignore 
       everything else."""
    htt = HTMLtoText(full_document)
    htt.feed(html)
    return str(htt)
コード例 #2
0
ファイル: util.py プロジェクト: dpwhite2/linkanalytics
 def test_two_paragraphs(self):
     body = "<p>A paragraph.</p><p>Another paragraph.</p>"
     html = self.htmloutline.format(body)
     htt = HTMLtoText()
     htt.feed(html)
     text = str(htt)
     self.assertEquals(text, "\nA paragraph.\n\nAnother paragraph.\n")
コード例 #3
0
ファイル: util.py プロジェクト: dpwhite2/linkanalytics
 def test_basic(self):
     html = self.htmloutline.format("This is some text.")
     htt = HTMLtoText()
     htt.feed(html)
     text = str(htt)
     self.assertEquals(text, "This is some text.")
コード例 #4
0
ファイル: util.py プロジェクト: dpwhite2/linkanalytics
 def test_linebreak(self):
     html = self.htmloutline.format("One line.<br/>Two lines.")
     htt = HTMLtoText()
     htt.feed(html)
     text = str(htt)
     self.assertEquals(text, "One line.\nTwo lines.")
コード例 #5
0
ファイル: util.py プロジェクト: dpwhite2/linkanalytics
 def test_simple_paragraph(self):
     html = self.htmloutline.format("<p>A paragraph.</p>")
     htt = HTMLtoText()
     htt.feed(html)
     text = str(htt)
     self.assertEquals(text, "\nA paragraph.\n")