diff rgToolFactory2.py @ 8:9d58cc32a12d draft

Uploaded
author fubar
date Mon, 12 Jan 2015 05:27:52 -0500
parents 61381bad936d
children ce5ec1d989fd
line wrap: on
line diff
--- a/rgToolFactory2.py	Mon Jan 12 05:01:29 2015 -0500
+++ b/rgToolFactory2.py	Mon Jan 12 05:27:52 2015 -0500
@@ -145,7 +145,7 @@
      "<": "&lt;",
      "$": "\$"
      }
-html_unescape_table = dict(zip(html_escape_table.values(),html_escape_table.keys()))
+
 def html_escape(text):
      """Produce entities within text."""
      return "".join(html_escape_table.get(c,c) for c in text)
@@ -153,7 +153,8 @@
 
 def html_unescape(text):
      """Revert entities within text."""
-     return "".join(html_unescape_table.get(c,c) for c in text)
+     t = text.replace('&amp;','&').replace('&gt;','>').replace('&lt;','<').replace('\$','$')
+     return t
      
 def cmd_exists(cmd):
      return subprocess.call("type " + cmd, shell=True,