r""" Encodes `text` for raw use in HTML. >>> htmlquote(u"<'&\">") u'<'&">'
(text)
| 217 | |
| 218 | |
| 219 | def htmlquote(text): |
| 220 | r""" |
| 221 | Encodes `text` for raw use in HTML. |
| 222 | |
| 223 | >>> htmlquote(u"<'&\">") |
| 224 | u'<'&">' |
| 225 | """ |
| 226 | text = text.replace("&", "&") # Must be done first! |
| 227 | text = text.replace("<", "<") |
| 228 | text = text.replace(">", ">") |
| 229 | text = text.replace("'", "'") |
| 230 | text = text.replace('"', """) |
| 231 | return text |
| 232 | |
| 233 | |
| 234 | def htmlunquote(text): |