| 1 | """This is a copy of the htmlDecode function in Webware. |
| 2 | |
| 3 | @@TR: It implemented more efficiently. |
| 4 | |
| 5 | """ |
| 6 | |
| 7 | from .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 |