Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(1)  |  Derive(0)  |  Import(2)
Encodes the string with html entities.

        def encode_htmlentities(string, encoding='utf-8'):
    """
    Encodes the string with html entities.
    """

    if isinstance(string, unicode):
        was_unicode = True
    else:
        was_unicode = False
        string = string.decode(encoding)

    string = string.replace('&', '&')

    for codepoint, name in cp2n.items():
        if name != 'amp':
            string = string.replace(unichr(codepoint), '&%s;' % name)

    if not was_unicode:
        string = string.encode(encoding)
    return string
        


src/f/t/ftw.pdfgenerator-1.3.0/ftw/pdfgenerator/html2latex/converter.py   ftw.pdfgenerator(Download)
from ftw.pdfgenerator.html2latex.subconverters import table
from ftw.pdfgenerator.html2latex.subconverters import textformatting
from ftw.pdfgenerator.utils import encode_htmlentities
from ftw.pdfgenerator.utils import xml2htmlentities
from random import choice
    def convert_plain(self, text, **kwargs):
        html = encode_htmlentities(text)
        return self.convert(html, **kwargs)
 
 

src/f/t/ftw.book-2.2.20/ftw/book/table/generator.py   ftw.book(Download)
from ftw.book.table.tablepart import TablePartHeader
from ftw.book.table.utils import cleanup_standalone_html_tags
from ftw.pdfgenerator.utils import encode_htmlentities
from ftw.pdfgenerator.utils import html2xmlentities
from ftw.pdfgenerator.utils import xml2htmlentities