[Zope-Checkins] CVS: Zope2 - DocumentClass.py:1.22
chrism@serenade.digicool.com
chrism@serenade.digicool.com
Mon, 18 Jun 2001 23:32:13 -0400
Update of /cvs-repository/Zope2/lib/python/StructuredText
In directory serenade:/home/chrism/BackTalk/lib/python/StructuredText
Modified Files:
DocumentClass.py
Log Message:
The doc_header method makes a copy of the paragraph it's working on and returns it in the case that what follows it is an example. When doing so, the attributes attached to the paragraph were lost. Changes made to the doc_header method copy the attributes assigned to the paragraph as well as the body, making the copy carry along paragraph attributes.
--- Updated File DocumentClass.py in package Zope2 --
--- DocumentClass.py 2001/06/16 15:27:48 1.21
+++ DocumentClass.py 2001/06/19 03:32:12 1.22
@@ -519,7 +519,7 @@
result.append(paragraph)
return result
-
+
def doc_table(self, paragraph, expr = re.compile(r'\s*\|[-]+\|').match):
text = paragraph.getColorizableTexts()[0]
m = expr(text)
@@ -849,8 +849,11 @@
if top[-2:]=='::':
subs=StructuredTextExample(subs)
if strip(top)=='::': return subs
- return ST.StructuredTextParagraph(
- top[:-1], [subs], indent=paragraph.indent)
+ # copy attrs when returning a paragraph
+ kw = {}
+ atts = getattr(paragraph, '_attributes', [])
+ for att in atts: kw[att] = getattr(paragraph, att)
+ return apply(ST.StructuredTextParagraph, (top[:-1], [subs]), kw)
if find(top,'\n') >= 0: return None
return StructuredTextSection(top, subs, indent=paragraph.indent)