Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/writers.py
diff options
context:
space:
mode:
authorRichard Darst <rkd@zgib.net>2009-08-31 21:43:29 (GMT)
committer Richard Darst <rkd@zgib.net>2009-08-31 21:43:29 (GMT)
commitd3becbc42180b606e96a2be3e360760c945b5aeb (patch)
tree3ff7541967896f1a96f8a18680a9a4236fccbe05 /writers.py
parent2e7ff363fdf6b58ba30176ae814250dbc94be017 (diff)
Wrap lines in the HTML log
- This adds "pre { white-space: pre-wrap; }" to the css via a gross hack - I hope to soon redo this so that this gross hack isn't necessary, and the entire HTML log output is more customizable. - Thanks to commenter at http://francis.giannaros.org/blog/2009/08/27/create-minutes-and-\ logs-for-your-meetings-with-bugbot/ darcs-hash:20090831214329-82ea9-a30ea5f3f72bd0f5e008d0e8fb2a0a1b48c52255.gz
Diffstat (limited to 'writers.py')
-rw-r--r--writers.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/writers.py b/writers.py
index d9a8cd4..92f1f86 100644
--- a/writers.py
+++ b/writers.py
@@ -167,6 +167,21 @@ class HTMLlog(_BaseWriter):
lexer = Lexer()
#from rkddp.interact import interact ; interact()
out = pygments.highlight("\n".join(M.lines), lexer, formatter)
+ # Hack it to add "pre { white-space: pre-wrap; }", which make
+ # it wrap the pygments html logs. I think that in a newer
+ # version of pygmetns, the "prestyles" HTMLFormatter option
+ # would do this, but I want to maintain compatibility with
+ # lenny. Thus, I do these substitution hacks to add the
+ # format in. Thanks to a comment on the blog of Francis
+ # Giannaros (http://francis.giannaros.org) for the suggestion
+ # and instructions for how.
+ out,n = re.subn(r"(\n\s*pre\s*\{[^}]+;\s*)(\})",
+ r"\1\n white-space: pre-wrap;\2",
+ out, count=1)
+ if n == 0:
+ out = re.sub(r"(\n\s*</style>)",
+ r"\npre { white-space: pre-wrap; }\1",
+ out, count=1)
return out