Permalink
Browse files

Fixed elyxer to escape HTML/XML properly

  • Loading branch information...
1 parent 5827118 commit fb3976458be7e4cf739b72b0932584f0731a3872 @dchenbecker dchenbecker committed May 22, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 elyxer.py
View
@@ -6855,6 +6855,15 @@ def process(self):
if 'caption' in self.lstparams:
text = self.lstparams['caption'][1:-1]
self.contents.insert(0, Caption().create(text))
+
+ # If this is HTML or XML, we need to escape leading "<" characters
+ if "ml" in self.brush.lower():
+ for part in self.contents:
+ if isinstance(part, TaggedText):
+ for line in part.contents:
+ if isinstance(line, Constant):
+ line.string = line.string.replace("<", "&lt;")
+
if Listing.processor:
Listing.processor.postprocess(self)

0 comments on commit fb39764

Please sign in to comment.