script-publish.py: Add debugging output for the chunk stream
authorW. Trevor King <wking@tremily.us>
Sun, 13 Jan 2013 13:49:46 +0000 (08:49 -0500)
committerW. Trevor King <wking@tremily.us>
Sun, 13 Jan 2013 13:49:46 +0000 (08:49 -0500)
So you can take a look at the raw stream before we start dumping
stuff.  I also made the SGR skipping message more explicit.

posts/script/script-publish.py

index 742339516f55a90ba6ff189f732b88a2f8f84ae3..c156fdebf3a7b00017f24a269f9135f6432726b1 100755 (executable)
@@ -256,7 +256,7 @@ class SelectGraphicRendition (ControlCode):
                 'foreground', DEFAULT_STYLE['foreground'])
             style['foreground'] = f
         elif code == 27:
-            _LOG.debug('skipping {}'.format(self))
+            _LOG.debug('skipping {} code {}'.format(self.name, code))
         elif code >= 30 and code <= 37:
             style['foreground'] = self.colors[code - 30]
         elif code == 39:  # default text color
@@ -581,6 +581,8 @@ class ControlParser (object):
     def parse(self, element, text):
         chunks = self._replace_control_codes(text)
         chunks = self._decode_text(chunks)
+        for chunk in chunks:
+            _LOG.debug(chunk)
         chunks = self._replace_tabs(chunks)
         chunks = self._merge_adjacent_text(chunks)
         chunks = self._remove_operating_system_commands(chunks)