Beispiel #1
0
def test_markdown():
    from calibre.ebooks.markdown import Markdown
    Markdown(extensions=['extra'])
    from calibre.library.comments import sanitize_html
    sanitize_html(
        b'''<script>moo</script>xxx<img src="http://moo.com/x.jpg">''')
    fprint('Markdown OK!')
Beispiel #2
0
def test_markdown():
    from calibre.ebooks.markdown import Markdown

    Markdown(extensions=["extra"])
    from calibre.library.comments import sanitize_html

    sanitize_html(b"""<script>moo</script>xxx<img src="http://moo.com/x.jpg">""")
    fprint("Markdown OK!")
Beispiel #3
0
 def get_sanitized_description(self):
     '''
     For calibre version so this code can be consolidated between
     fff_plugin.py and jobs.py
     '''
     orig = description = self.getMetadata("description")
     # logger.debug("description:%s"%description)
     if not description:
         description = ''
     else:
         if self.getConfig('keep_summary_html'):
             ## Handles desc with (supposed) html without html->MD
             ## text->html dance that sanitize_comments_html does.
             description = sanitize_html(description)
             # logger.debug("desc using sanitize_html")
         else:
             ## because of the html->MD text->html dance, text only
             ## (or MD/MD-like) descs come out better.
             description = sanitize_comments_html(description)
             # logger.debug("desc using sanitize_comments_html")
     # if orig != description:
     #     logger.debug("\nchanged description\n%s\n%s"%(orig,description))
     return description
Beispiel #4
0
 def get_sanitized_description(self):
     '''
     For calibre version so this code can be consolidated between
     fff_plugin.py and jobs.py
     '''
     orig = description = self.getMetadata("description")
     # logger.debug("description:%s"%description)
     if not description:
         description = ''
     else:
         if self.getConfig('keep_summary_html'):
             ## Handles desc with (supposed) html without html->MD
             ## text->html dance that sanitize_comments_html does.
             description = sanitize_html(description)
             # logger.debug("desc using sanitize_html")
         else:
             ## because of the html->MD text->html dance, text only
             ## (or MD/MD-like) descs come out better.
             description = sanitize_comments_html(description)
             # logger.debug("desc using sanitize_comments_html")
     # if orig != description:
     #     logger.debug("\nchanged description\n%s\n%s"%(orig,description))
     return description
Beispiel #5
0
 def test_markdown(self):
     from calibre.ebooks.markdown import Markdown
     Markdown(extensions=['extra'])
     from calibre.library.comments import sanitize_html
     sanitize_html(b'''<script>moo</script>xxx<img src="http://moo.com/x.jpg">''')