"Fossies" - the Fresh Open Source Software Archive

Member "cheetah3-3.2.6.post2/Cheetah/Utils/htmlDecode.py" (20 Apr 2021, 438 Bytes) of package /linux/www/cheetah3-3.2.6.post2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "htmlDecode.py" see the Fossies "Dox" file reference documentation.

    1 """This is a copy of the htmlDecode function in Webware.
    2 
    3 @@TR: It implemented more efficiently.
    4 
    5 """
    6 
    7 from Cheetah.Utils.htmlEncode import htmlCodesReversed
    8 
    9 
   10 def htmlDecode(s, codes=htmlCodesReversed):
   11     """ Returns the ASCII decoded version of the given HTML string. This does
   12     NOT remove normal HTML tags like <p>. It is the inverse of htmlEncode()."""
   13     for code in codes:
   14         s = s.replace(code[1], code[0])
   15     return s