[z3-checkins] r51393 - z3/deliverance/DeliveranceVHoster/trunk/utils

ejucovy at codespeak.net ejucovy at codespeak.net
Mon Feb 11 18:04:48 CET 2008


Author: ejucovy
Date: Mon Feb 11 18:04:47 2008
New Revision: 51393

Modified:
   z3/deliverance/DeliveranceVHoster/trunk/utils/embed_url.py
Log:
Change defaults to automatically perform the extra processing and add
a TODO comment to refelct the unfinished handling of @import statements


Modified: z3/deliverance/DeliveranceVHoster/trunk/utils/embed_url.py
==============================================================================
--- z3/deliverance/DeliveranceVHoster/trunk/utils/embed_url.py	(original)
+++ z3/deliverance/DeliveranceVHoster/trunk/utils/embed_url.py	Mon Feb 11 18:04:47 2008
@@ -32,19 +32,19 @@
        URL.
 
     -c
-    --comment-hack
-       Hack IE conditional comments so that their internal resources will be
-       embedded as well.
+    --comment-hack-disable
+       Disable the hack for IE conditional comments so that their internal
+       resources will be embedded as well.
 
     -i
-    --image-strip
-       Strip any img tags from the document, since the are links to external
-       resources, and can not be embedded.
+    --image-strip-disable
+       Disable stripping of any img tags from the document, since they are
+       links to external resources, and can not be embedded.
 
     -p
-    --percent-escape
-       Escape any percent signs found in the text, turning % into %% so that it
-       will safely pass through the templating engine.
+    --percent-escape-disable
+       Disable the escaping of any percent signs found in the text, turning %
+       into %% so that it will safely pass through the templating engine.
 
     -o file
     --output file
@@ -102,16 +102,16 @@
     try:
         options, arguments = getopt(argv[1:], "hso:fdipc", ["help", "save",
                                                          "output=", "force",
-                                                         "disable", "image-strip",
-                                                         "percent-escape", "comment-hack"])
+                                                         "disable", "image-strip-disable",
+                                                         "percent-escape-disable", "comment-hack-disable"])
     except GetoptError:
         __usage()
         exit(2)
 
     output = None
-    image_strip = False
-    percent_escape = False
-    comment_hack = False
+    image_strip = True
+    percent_escape = True
+    comment_hack = True
     save = False
     force = False
     disable = False
@@ -124,12 +124,12 @@
             save = True
         elif option in ("-o", "--output"):
             output = value
-        elif option in ("-c", "--comment-hack"):
-            comment_hack = True
-        elif option in ("-i", "--image-strip"):
-            image_strip = True
-        elif option in ("-p", "--percent-escape"):
-            percent_escape = True
+        elif option in ("-c", "--comment-hack-disable"):
+            comment_hack = False
+        elif option in ("-i", "--image-strip-disable"):
+            image_strip = False
+        elif option in ("-p", "--percent-escape-disable"):
+            percent_escape = False
         elif option in ("-f", "--force"):
             force = True
         elif option in ("-d", "--disable"):
@@ -343,6 +343,7 @@
         """If this data is for a style tag, we process @import statements."""
         from re import sub
         if self.tag_stack and self.tag_stack[-1][0] == "style":
+            # TODO make this actually work for an embed
             # Style tags have a special kind of "link" contained in the
             # internal text. "@import" statements can be written in a couple of
             # different ways, and so we use a regex to find and replace them.
@@ -355,8 +356,8 @@
             # @import "./style.css"
             # @import url("/style.css")
             # @import url(/style.css)
-            data = sub(r'(@import\s+(url\("?|"))\.?/', "\\1%s/" %
-                       self.url_base, data)
+            #data = sub(r'(@import\s+(url\("?|"))\.?/', "\\1%s/" %
+            #           self.url_base, data)
         self.parsed += data
 
     # The rest of the overridden methods that follow don't do any parsing. We


More information about the z3-checkins mailing list