Commit 64fa54d1 authored by Chris McDonough's avatar Chris McDonough

The color_paragraphs method of DocumentClass attempts to iterate through all...

The color_paragraphs method of DocumentClass attempts to iterate through all the defined paragraph_type methods for each paragraph.  If a paragraph_type method returns anything but None, the colorization has been completed by the paragraph_type method, and we move on.  However, when a paragraph_type cannot be found to colorize a paragraph, we make a copy of the paragraph, and attempt to colorize its children with the color_paragraphs function.  In this case, the DOM-style attributes attached to the original paragraph were lost.  I modified the color_paragraphs method to retain the original paragraph's DOM-style attributes when a colorizer for the paragraph was not found.
parent df402d24
......@@ -487,12 +487,17 @@ class DocumentClass:
r=r,
new_paragraphs=r
for paragraph in new_paragraphs:
paragraph.setSubparagraphs(self.color_paragraphs(paragraph.getSubparagraphs()))
subs = self.color_paragraphs(paragraph.getSubparagraphs())
paragraph.setSubparagraphs(subs)
break
else:
new_paragraphs=ST.StructuredTextParagraph(paragraph.getColorizableTexts()[0],
self.color_paragraphs(paragraph.getSubparagraphs()),
indent=paragraph.indent),
# copy, retain attributes
kw = {}
atts = getattr(paragraph, '_attributes', [])
for att in atts: kw[att] = getattr(paragraph, att)
subs = self.color_paragraphs(paragraph.getSubparagraphs())
new_paragraphs=apply(ST.StructuredTextParagraph,
(paragraph.getColorizableTexts()[0], subs), kw),
# color the inline StructuredText types
# for each StructuredTextParagraph
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment