Example #1
0
def _export_markdown(html, flag):
    """Convert to Markdown"""
    html = _prepare_html(html)
    markdown = html2text.html2text(html, bodywidth=0)
    if flag == 'citation':
        if zq.backend.csl_style == 'bibtex':
            markdown = '[@' + markdown.strip() + ']'
    return markdown
def note_to_text(note):
    content = html2text(to_unicode(note.content))
    title = note.title.decode('utf-8')
    if note.tagNames:
        tags = ('\n'+' | '.join(note.tagNames)).decode('utf-8')
    else:
        tags = ''
    return title + tags + '\n' + content
Example #3
0
def _export_markdown(html, flag):
    """Convert to Markdown"""
    html = _prepare_html(html)
    markdown = html2text.html2text(html, bodywidth=0)
    if flag == 'citation':
        if zq.backend.csl_style == 'bibtex':
            markdown = '[@' + markdown.strip() + ']'
    return markdown
Example #4
0
def remove_html_tags(html):
    '''Converts an html snippet to marked-down text and returns it'''
    
    # Convert the HTML to plain text using the html2text module 
    out = html2text (html)
    
    # Strip out the leading the trailing white space
    out = string.lstrip(string.rstrip (out))

    return out
Example #5
0
    def _export_markdown(self, html):
        """Convert to Markdown

        """
        html = self._prepare_html(html)
        markdown = html2text.html2text(html, bodywidth=0)
        if self.flag == 'citation':
            if self.zotquery.csl_style == 'bibtex':
                markdown = '[@' + markdown.strip() + ']'
        return markdown
Example #6
0
def remove_html_tags(html):
    '''Converts an html snippet to marked-down text and returns it'''

    # Convert the HTML to plain text using the html2text module
    out = html2text(html)

    # Strip out the leading the trailing white space
    out = string.lstrip(string.rstrip(out))

    return out
Example #7
0
    def _export_markdown(self, html):
        """Convert to Markdown

        """
        html = self._prepare_html(html)
        markdown = html2text.html2text(html, bodywidth=0)
        if self.flag == 'citation':
            if self.zotquery.csl_style == 'bibtex':
                markdown = '[@' + markdown.strip() + ']'
        return markdown
Example #8
0
def ENMLtoText(contentENML):
    content = html2text.html2text(contentENML.decode('utf-8'))
    content = re.sub(r' *\n', os.linesep, content)
    return content.encode('utf-8')
Example #9
0
def ENMLtoText(contentENML):
    content = html2text.html2text(contentENML.decode('utf-8'))
    content = re.sub(r' *\n', os.linesep, content)
    return content.encode('utf-8')
Example #10
0
def ENMLtoText(contentENML):
    content = html2text.html2text(contentENML.decode("utf-8"))
    content = re.sub(r" *\n", os.linesep, content)
    return content.encode("utf-8")