示例#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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#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')
示例#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')
示例#10
0
文件: editor.py 项目: kuno/geeknote
def ENMLtoText(contentENML):
    content = html2text.html2text(contentENML.decode("utf-8"))
    content = re.sub(r" *\n", os.linesep, content)
    return content.encode("utf-8")