author | robin <robin@reportlab.com> |
Tue, 07 Mar 2017 10:00:34 +0000 | |
changeset 4330 | 617ffa6bbdc8 |
parent 4315 | 7c65c6e52b13 |
child 4341 | 19a971b1bfa4 |
permissions | -rw-r--r-- |
4330 | 1 |
#Copyright ReportLab Europe Ltd. 2000-2017 |
2963 | 2 |
#see license.txt for license details |
3 |
"""Tests for the reportlab.platypus.paragraphs module. |
|
4 |
""" |
|
4252 | 5 |
__version__='3.3.0' |
2987 | 6 |
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation |
2984 | 7 |
setOutDir(__name__) |
2966 | 8 |
import sys, os, unittest |
2963 | 9 |
from operator import truth |
10 |
from reportlab.pdfbase.pdfmetrics import stringWidth, registerFont, registerFontFamily |
|
11 |
from reportlab.pdfbase.ttfonts import TTFont |
|
12 |
from reportlab.platypus.paraparser import ParaParser |
|
3564
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
13 |
from reportlab.platypus.flowables import Flowable, DocAssert |
2963 | 14 |
from reportlab.lib.colors import Color |
15 |
from reportlab.lib.units import cm |
|
16 |
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY |
|
17 |
from reportlab.lib.utils import _className |
|
18 |
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle |
|
19 |
from reportlab.platypus.xpreformatted import XPreformatted |
|
20 |
from reportlab.platypus.frames import Frame, ShowBoundaryValue |
|
21 |
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate, PageBreak, NextPageTemplate |
|
22 |
from reportlab.platypus import tableofcontents |
|
23 |
from reportlab.platypus.tableofcontents import TableOfContents |
|
24 |
from reportlab.platypus.tables import TableStyle, Table |
|
4046
aed0e2af4546
paragraph: fix _splitWord for unicode/bytes bug reported by Anders Hammarquist & add a test
robin
parents:
4036
diff
changeset
|
25 |
from reportlab.platypus.paragraph import Paragraph, _getFragWords, _splitWord |
2963 | 26 |
|
27 |
def myMainPageFrame(canvas, doc): |
|
28 |
"The page frame used for all PDF documents." |
|
29 |
||
30 |
canvas.saveState() |
|
31 |
||
32 |
canvas.rect(2.5*cm, 2.5*cm, 15*cm, 25*cm) |
|
33 |
canvas.setFont('Times-Roman', 12) |
|
34 |
pageNumber = canvas.getPageNumber() |
|
35 |
canvas.drawString(10*cm, cm, str(pageNumber)) |
|
36 |
||
37 |
canvas.restoreState() |
|
38 |
||
39 |
class MyDocTemplate(BaseDocTemplate): |
|
40 |
_invalidInitArgs = ('pageTemplates',) |
|
41 |
||
42 |
def __init__(self, filename, **kw): |
|
43 |
frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1') |
|
44 |
frame2 = Frame(2.5*cm, 2.5*cm, 310, 25*cm, id='F2') |
|
45 |
self.allowSplitting = 0 |
|
3326 | 46 |
BaseDocTemplate.__init__(self, filename, **kw) |
2963 | 47 |
template = PageTemplate('normal', [frame1], myMainPageFrame) |
48 |
template1 = PageTemplate('special', [frame2], myMainPageFrame) |
|
4036
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
49 |
template2 = PageTemplate('template2', [Frame(395, 108, 165, 645, id='second2')]) |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
50 |
self.addPageTemplates([template,template1,template2]) |
2963 | 51 |
|
52 |
class ParagraphCorners(unittest.TestCase): |
|
53 |
"some corner cases which should parse" |
|
54 |
def check(self,text,bt = getSampleStyleSheet()['BodyText']): |
|
55 |
try: |
|
56 |
P = Paragraph(text,style=bt) |
|
57 |
except: |
|
58 |
raise AssertionError("'%s' should parse"%text) |
|
59 |
||
60 |
def test0(self): |
|
61 |
self.check('<para />') |
|
62 |
self.check('<para/>') |
|
63 |
self.check('\t\t\t\n\n\n<para />') |
|
64 |
self.check('\t\t\t\n\n\n<para/>') |
|
65 |
self.check('<para\t\t\t\t/>') |
|
66 |
self.check('<para></para>') |
|
67 |
self.check('<para> </para>') |
|
68 |
self.check('\t\t\n\t\t\t <para> </para>') |
|
69 |
||
70 |
def test1(self): |
|
71 |
"This makes several special paragraphs." |
|
72 |
||
73 |
# Build story. |
|
74 |
story = [] |
|
75 |
styleSheet = getSampleStyleSheet() |
|
76 |
bt = styleSheet['BodyText'] |
|
77 |
btN = ParagraphStyle('BodyTextTTNone',parent=bt,textTransform='none') |
|
78 |
btL = ParagraphStyle('BodyTextTTLower',parent=bt,textTransform='lowercase') |
|
79 |
btU = ParagraphStyle('BodyTextTTUpper',parent=bt,textTransform='uppercase') |
|
80 |
btC = ParagraphStyle('BodyTextTTCapitalize',parent=bt,textTransform='capitalize') |
|
81 |
story.append(Paragraph('''This should be ORDINARY text.''',style=bt)) |
|
82 |
story.append(Paragraph('''This should be ORDINARY text.''',style=btN)) |
|
83 |
story.append(Paragraph('''This should be LOWER text.''',style=btL)) |
|
84 |
story.append(Paragraph('''This should be upper text.''',style=btU)) |
|
85 |
story.append(Paragraph('''This should be cAPITALIZED text.''',style=btC)) |
|
86 |
||
87 |
story.append(Paragraph('''T<i>hi</i>s shoul<font color="red">d b</font>e <b>ORDINARY</b> text.''',style=bt)) |
|
88 |
story.append(Paragraph('''T<i>hi</i>s shoul<font color="red">d b</font>e <b>ORDINARY</b> text.''',style=btN)) |
|
89 |
story.append(Paragraph('''T<i>hi</i>s shoul<font color="red">d b</font>e <b>LOWER</b> text.''',style=btL)) |
|
90 |
story.append(Paragraph('''T<i>hi</i>s shoul<font color="red">d b</font>e <b>upper</b> text.''',style=btU)) |
|
91 |
story.append(Paragraph('''T<i>hi</i>s shoul<font color="red">d b</font>e <b>cAPITALIZED</b> text.''',style=btC)) |
|
92 |
doc = MyDocTemplate(outputfile('test_platypus_specialparagraphs.pdf')) |
|
93 |
doc.multiBuild(story) |
|
3191
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
94 |
|
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
95 |
def test2(self): |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
96 |
'''CJK splitting in multi-frag case''' |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
97 |
style = ParagraphStyle('test', wordWrap = 'CJK') |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
98 |
p = Paragraph('bla <i>blub</i> '*130 , style) |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
99 |
aW,aH=439.275590551,121.88976378 |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
100 |
w,h=p.wrap(aW,aH) |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
101 |
S=p.split(aW,aH) |
3197
f4cef2b94b59
test_platypus_paragraphs.py: fix CJK splitting test
rgbecker
parents:
3191
diff
changeset
|
102 |
assert len(S)==2, 'Multi frag CJK splitting failed' |
3191
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
103 |
w0,h0=S[0].wrap(aW,aH) |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
104 |
assert h0<=aH,'Multi-frag CJK split[0] has wrong height %s >= available %s' % (H0,aH) |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
105 |
w1,h1=S[1].wrap(aW,aH) |
07560dd4d3d0
test_platypus_paragraphs.py: add in Volker's crashing CJK split as a test
rgbecker
parents:
2987
diff
changeset
|
106 |
assert h0+h1==h, 'Multi-frag-CJK split[0].height(%s)+split[1].height(%s) don\'t add to original %s' % (h0,h1,h) |
3492 | 107 |
|
108 |
def test3(self): |
|
109 |
'''compare CJK splitting in some edge cases''' |
|
110 |
from reportlab.pdfgen.canvas import Canvas |
|
111 |
from reportlab.platypus.paragraph import Paragraph |
|
112 |
from reportlab.lib.styles import ParagraphStyle |
|
113 |
from reportlab.pdfbase import pdfmetrics |
|
114 |
from reportlab.lib.enums import TA_LEFT |
|
115 |
sty = ParagraphStyle('A') |
|
116 |
sty.fontSize = 15 |
|
117 |
sty.leading = sty.fontSize*1.2 |
|
118 |
sty.fontName = 'Courier' |
|
119 |
sty.alignment = TA_LEFT |
|
120 |
sty.wordWrap = 'CJK' |
|
121 |
p0=Paragraph('ABCDEFGHIJKL]N',sty) |
|
122 |
p1=Paragraph('AB<font color="red">C</font>DEFGHIJKL]N',sty) |
|
123 |
canv = Canvas('test_platypus_paragraph_cjk3.pdf') |
|
124 |
ix = len(canv._code) |
|
125 |
aW = pdfmetrics.stringWidth('ABCD','Courier',15) |
|
126 |
w,h=p0.wrap(aW,1000000) |
|
127 |
y = canv._pagesize[1]-72-h |
|
128 |
p0.drawOn(canv,72,y) |
|
129 |
w,h=p1.wrap(aW,1000000) |
|
130 |
y -= h+10 |
|
131 |
p1.drawOn(canv,72,y) |
|
132 |
w,h=p0.wrap(aW*0.25-2,1000000) |
|
133 |
y -= h+10 |
|
134 |
p0.drawOn(canv,72,y) |
|
135 |
w,h=p1.wrap(aW/4.-2,1000000) |
|
136 |
y -= h+10 |
|
137 |
p1.drawOn(canv,72,y) |
|
138 |
assert canv._code[ix:]==['q', '1 0 0 1 72 697.8898 cm', 'q', '0 0 0 rg', 'BT 1 0 0 1 0 57 Tm /F2 15 Tf 18 TL (ABCD) Tj T* (EFGH) Tj T* (IJKL]) Tj T* (N) Tj T* ET', 'Q', 'Q', 'q', '1 0 0 1 72 615.8898 cm', 'q', 'BT 1 0 0 1 0 57 Tm 18 TL /F2 15 Tf 0 0 0 rg (AB) Tj 1 0 0 rg (C) Tj 0 0 0 rg (D) Tj T* (EFGH) Tj T* (IJKL]) Tj T* (N) Tj T* ET', 'Q', 'Q', 'q', '1 0 0 1 72 353.8898 cm', 'q', '0 0 0 rg', 'BT 1 0 0 1 0 237 Tm /F2 15 Tf 18 TL (A) Tj T* (B) Tj T* (C) Tj T* (D) Tj T* (E) Tj T* (F) Tj T* (G) Tj T* (H) Tj T* (I) Tj T* (J) Tj T* (K) Tj T* (L) Tj T* (]) Tj T* (N) Tj T* ET', 'Q', 'Q', 'q', '1 0 0 1 72 91.88976 cm', 'q', 'BT 1 0 0 1 0 237 Tm 18 TL /F2 15 Tf 0 0 0 rg (A) Tj T* (B) Tj T* 1 0 0 rg (C) Tj T* 0 0 0 rg (D) Tj T* (E) Tj T* (F) Tj T* (G) Tj T* (H) Tj T* (I) Tj T* (J) Tj T* (K) Tj T* (L) Tj T* (]) Tj T* (N) Tj T* ET', 'Q', 'Q'] |
|
139 |
canv.showPage() |
|
140 |
canv.save() |
|
2963 | 141 |
|
142 |
class ParagraphSplitTestCase(unittest.TestCase): |
|
143 |
"Test multi-page splitting of paragraphs (eyeball-test)." |
|
144 |
||
145 |
def test0(self): |
|
146 |
"This makes one long multi-page paragraph." |
|
147 |
||
148 |
# Build story. |
|
149 |
story = [] |
|
150 |
styleSheet = getSampleStyleSheet() |
|
151 |
bt = styleSheet['BodyText'] |
|
152 |
text = '''If you imagine that the box of X's tothe left is |
|
153 |
an image, what I want to be able to do is flow a |
|
154 |
series of paragraphs around the image |
|
155 |
so that once the bottom of the image is reached, then text will flow back to the |
|
156 |
left margin. I know that it would be possible to something like this |
|
157 |
using tables, but I can't see how to have a generic solution. |
|
158 |
There are two examples of this in the demonstration section of the reportlab |
|
159 |
site. |
|
160 |
If you look at the "minimal" euro python conference brochure, at the end of the |
|
161 |
timetable section (page 8), there are adverts for "AdSu" and "O'Reilly". I can |
|
162 |
see how the AdSu one might be done generically, but the O'Reilly, unsure... |
|
163 |
I guess I'm hoping that I've missed something, and that |
|
164 |
it's actually easy to do using platypus. |
|
165 |
''' |
|
166 |
from reportlab.platypus.flowables import ParagraphAndImage, Image |
|
2987 | 167 |
from reportlab.lib.testutils import testsFolder |
2966 | 168 |
gif = os.path.join(testsFolder,'pythonpowered.gif') |
2963 | 169 |
story.append(ParagraphAndImage(Paragraph(text,bt),Image(gif))) |
170 |
phrase = 'This should be a paragraph spanning at least three pages. ' |
|
3721 | 171 |
description = ''.join([('%d: '%i)+phrase for i in range(250)]) |
2963 | 172 |
story.append(ParagraphAndImage(Paragraph(description, bt),Image(gif),side='left')) |
173 |
||
174 |
doc = MyDocTemplate(outputfile('test_platypus_paragraphandimage.pdf')) |
|
175 |
doc.multiBuild(story) |
|
176 |
||
177 |
def test1(self): |
|
178 |
"This makes one long multi-page paragraph." |
|
179 |
||
180 |
# Build story. |
|
181 |
story = [] |
|
182 |
styleSheet = getSampleStyleSheet() |
|
183 |
h3 = styleSheet['Heading3'] |
|
184 |
bt = styleSheet['BodyText'] |
|
185 |
text = '''If you imagine that the box of X's tothe left is |
|
186 |
an image, what I want to be able to do is flow a |
|
187 |
series of paragraphs around the image |
|
188 |
so that once the bottom of the image is reached, then text will flow back to the |
|
189 |
left margin. I know that it would be possible to something like this |
|
190 |
using tables, but I can't see how to have a generic solution. |
|
191 |
There are two examples of this in the demonstration section of the reportlab |
|
192 |
site. |
|
193 |
If you look at the "minimal" euro python conference brochure, at the end of the |
|
194 |
timetable section (page 8), there are adverts for "AdSu" and "O'Reilly". I can |
|
195 |
see how the AdSu one might be done generically, but the O'Reilly, unsure... |
|
196 |
I guess I'm hoping that I've missed something, and that |
|
197 |
it's actually easy to do using platypus.We can do greek letters <greek>mDngG</greek>. This should be a |
|
198 |
u with a dieresis on top <unichar code=0xfc/>="<unichar code="0xfc"/>" and this &#xfc;="ü" and this \\xc3\\xbc="\xc3\xbc". On the other hand this |
|
199 |
should be a pound sign &pound;="£" and this an alpha &alpha;="α". You can have links in the page <link href="http://www.reportlab.com" color="blue">ReportLab</link> & <a href="http://www.reportlab.org" color="green">ReportLab.org</a>. |
|
200 |
Use scheme "pdf:" to indicate an external PDF link, "http:", "https:" to indicate an external link eg something to open in |
|
3931 | 201 |
your browser. If an internal link begins with something that looks like a scheme, precede with "document:". Empty hrefs should be allowed ie <a href=""><a href="">test</a></a> should be allowed. <strike>This text should have a strike through it.</strike> |
4291 | 202 |
This should be a mailto link <a href="mailto:reportlab-users@lists2.reportlab.com"><font color="blue">reportlab-users at lists2.reportlab.com</font></a>. |
2963 | 203 |
''' |
204 |
from reportlab.platypus.flowables import ImageAndFlowables, Image |
|
2987 | 205 |
from reportlab.lib.testutils import testsFolder |
2966 | 206 |
gif = os.path.join(testsFolder,'pythonpowered.gif') |
2963 | 207 |
heading = Paragraph('This is a heading',h3) |
208 |
story.append(ImageAndFlowables(Image(gif),[heading,Paragraph(text,bt)])) |
|
209 |
phrase = 'This should be a paragraph spanning at least three pages. ' |
|
3721 | 210 |
description = ''.join([('%d: '%i)+phrase for i in range(250)]) |
2963 | 211 |
story.append(ImageAndFlowables(Image(gif),[heading,Paragraph(description, bt)],imageSide='left')) |
212 |
story.append(NextPageTemplate('special')) |
|
213 |
story.append(PageBreak()) |
|
214 |
VERA = ('Vera','VeraBd','VeraIt','VeraBI') |
|
215 |
for v in VERA: |
|
216 |
registerFont(TTFont(v,v+'.ttf')) |
|
217 |
registerFontFamily(*(VERA[:1]+VERA)) |
|
218 |
story.append(ImageAndFlowables( |
|
219 |
Image(gif,width=280,height=120), |
|
220 |
Paragraph('''<font name="Vera">The <b>concept</b> of an <i>integrated</i> one <b><i>box</i></b> solution for <i><b>advanced</b></i> voice and |
|
221 |
data applications began with the introduction of the IMACS. The |
|
222 |
IMACS 200 carries on that tradition with an integrated solution |
|
223 |
optimized for smaller port size applications that the IMACS could not |
|
224 |
economically address. An array of the most popular interfaces and |
|
225 |
features from the IMACS has been bundled into a small 2U chassis |
|
226 |
providing the ultimate in ease of installation.</font>''', |
|
227 |
style=ParagraphStyle( |
|
228 |
name="base", |
|
229 |
fontName="Helvetica", |
|
230 |
leading=12, |
|
231 |
leftIndent=0, |
|
232 |
firstLineIndent=0, |
|
233 |
spaceBefore = 9.5, |
|
234 |
fontSize=9.5, |
|
235 |
) |
|
236 |
), |
|
237 |
imageSide='left', |
|
238 |
) |
|
239 |
) |
|
240 |
story.append(ImageAndFlowables( |
|
241 |
Image(gif,width=240,height=120), |
|
242 |
Paragraph('''The concept of an integrated one box solution for advanced voice and |
|
243 |
data applications began with the introduction of the IMACS. The |
|
244 |
IMACS 200 carries on that tradition with an integrated solution |
|
245 |
optimized for smaller port size applications that the IMACS could not |
|
246 |
economically address. An array of the most popular interfaces and |
|
247 |
features from the IMACS has been bundled into a small 2U chassis |
|
248 |
providing the ultimate in ease of installation.''', |
|
249 |
style=ParagraphStyle( |
|
250 |
name="base", |
|
251 |
fontName="Helvetica", |
|
252 |
leading=12, |
|
253 |
leftIndent=0, |
|
254 |
firstLineIndent=0, |
|
255 |
spaceBefore = 9.5, |
|
256 |
fontSize=9.5, |
|
257 |
) |
|
258 |
), |
|
259 |
imageSide='left', |
|
260 |
) |
|
261 |
) |
|
262 |
||
3320
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
263 |
story.append(PageBreak()) |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
264 |
story.append(Paragraph('Image larger than the frame',h3)) |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
265 |
story.append(ImageAndFlowables( |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
266 |
Image(gif,width=6*110,height=6*44), |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
267 |
Paragraph('''The concept of an integrated one box solution for advanced voice and |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
268 |
data applications began with the introduction of the IMACS. The |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
269 |
IMACS 200 carries on that tradition with an integrated solution |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
270 |
optimized for smaller port size applications that the IMACS could not |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
271 |
economically address. An array of the most popular interfaces and |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
272 |
features from the IMACS has been bundled into a small 2U chassis |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
273 |
providing the ultimate in ease of installation.''', |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
274 |
style=ParagraphStyle( |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
275 |
name="base", |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
276 |
fontName="Helvetica", |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
277 |
leading=12, |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
278 |
leftIndent=0, |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
279 |
firstLineIndent=0, |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
280 |
spaceBefore = 9.5, |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
281 |
fontSize=9.5, |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
282 |
) |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
283 |
), |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
284 |
imageSide='left', |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
285 |
) |
d49ef1795c27
test_platypus_paragraphs.py: add overlarge test to ImageAndFlowables tests
rgbecker
parents:
3197
diff
changeset
|
286 |
) |
4036
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
287 |
text = '''With this clarification, an important property of these three types of |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
288 |
EC can be defined in such a way as to impose problems of phonemic and |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
289 |
morphological analysis. Another superficial similarity is the interest |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
290 |
in simulation of behavior, this analysis of a formative as a pair of |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
291 |
sets of features does not readily tolerate a stipulation to place the |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
292 |
constructions into these various categories. We will bring evidence in |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
293 |
favor of the following thesis: the earlier discussion of deviance is |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
294 |
not to be considered in determining the extended c-command discussed in |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
295 |
connection with (34). Another superficial similarity is the interest in |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
296 |
simulation of behavior, relational information may remedy and, at the |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
297 |
same time, eliminate a descriptive fact. There is also a different |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
298 |
approach to the [unification] problem, the descriptive power of the base |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
299 |
component delimits the traditional practice of grammarians.''' |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
300 |
gif = os.path.join(testsFolder,'pythonpowered.gif') |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
301 |
heading = Paragraph('This is a heading',h3) |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
302 |
story.append(NextPageTemplate('template2')) |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
303 |
story.append(PageBreak()) |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
304 |
story.append(heading) |
f7d6d36cc44c
test_platypus_paragraphs.py: add image and flowables test
robin
parents:
3931
diff
changeset
|
305 |
story.append(ImageAndFlowables(Image(gif,width=66,height=81),[Paragraph(text,bt)],imageSide='left',imageRightPadding=10)) |
2963 | 306 |
doc = MyDocTemplate(outputfile('test_platypus_imageandflowables.pdf'),showBoundary=1) |
307 |
doc.multiBuild(story) |
|
308 |
||
309 |
class TwoFrameDocTemplate(BaseDocTemplate): |
|
310 |
"Define a simple document with two frames per page." |
|
311 |
||
312 |
def __init__(self, filename, **kw): |
|
313 |
m = 2*cm |
|
314 |
from reportlab.lib import pagesizes |
|
315 |
PAGESIZE = pagesizes.landscape(pagesizes.A4) |
|
316 |
cw, ch = (PAGESIZE[0]-2*m)/2., (PAGESIZE[1]-2*m) |
|
317 |
ch -= 14*cm |
|
318 |
f1 = Frame(m, m+0.5*cm, cw-0.75*cm, ch-1*cm, id='F1', |
|
319 |
leftPadding=0, topPadding=0, rightPadding=0, bottomPadding=0, |
|
320 |
showBoundary=True |
|
321 |
) |
|
322 |
f2 = Frame(cw+2.7*cm, m+0.5*cm, cw-0.75*cm, ch-1*cm, id='F2', |
|
323 |
leftPadding=0, topPadding=0, rightPadding=0, bottomPadding=0, |
|
324 |
showBoundary=True |
|
325 |
) |
|
3326 | 326 |
BaseDocTemplate.__init__(self, filename, **kw) |
2963 | 327 |
template = PageTemplate('template', [f1, f2]) |
328 |
self.addPageTemplates(template) |
|
329 |
||
330 |
||
331 |
class SplitFrameParagraphTest(unittest.TestCase): |
|
332 |
"Test paragraph split over two frames." |
|
333 |
||
334 |
def test(self): |
|
335 |
stylesheet = getSampleStyleSheet() |
|
336 |
normal = stylesheet['BodyText'] |
|
337 |
normal.fontName = "Helvetica" |
|
338 |
normal.fontSize = 12 |
|
339 |
normal.leading = 16 |
|
340 |
normal.alignment = TA_JUSTIFY |
|
341 |
||
342 |
text = "Bedauerlicherweise ist ein Donaudampfschiffkapit\xc3\xa4n auch <font color='red'>nur</font> <font color='green'>ein</font> Dampfschiffkapit\xc3\xa4n." |
|
343 |
tagFormat = '%s' |
|
344 |
# strange behaviour when using next code line |
|
345 |
# (same for '<a href="http://www.reportlab.org">%s</a>' |
|
346 |
tagFormat = '<font color="red">%s</font>' |
|
347 |
||
348 |
#text = " ".join([tagFormat % w for w in text.split()]) |
|
349 |
||
350 |
story = [Paragraph((text + " ") * 3, style=normal)] |
|
351 |
||
352 |
from reportlab.lib import pagesizes |
|
353 |
PAGESIZE = pagesizes.landscape(pagesizes.A4) |
|
354 |
||
355 |
doc = TwoFrameDocTemplate(outputfile('test_paragraphs_splitframe.pdf'), pagesize=PAGESIZE) |
|
356 |
doc.build(story) |
|
357 |
||
358 |
class FragmentTestCase(unittest.TestCase): |
|
359 |
"Test fragmentation of paragraphs." |
|
360 |
||
361 |
def test0(self): |
|
362 |
"Test empty paragraph." |
|
363 |
||
364 |
styleSheet = getSampleStyleSheet() |
|
365 |
B = styleSheet['BodyText'] |
|
366 |
text = '' |
|
367 |
P = Paragraph(text, B) |
|
3721 | 368 |
frags = [f.text for f in P.frags] |
2963 | 369 |
assert frags == [] |
370 |
||
371 |
def test1(self): |
|
372 |
"Test simple paragraph." |
|
373 |
||
374 |
styleSheet = getSampleStyleSheet() |
|
375 |
B = styleSheet['BodyText'] |
|
376 |
text = "X<font name=Courier>Y</font>Z" |
|
377 |
P = Paragraph(text, B) |
|
3721 | 378 |
frags = [f.text for f in P.frags] |
2963 | 379 |
assert frags == ['X', 'Y', 'Z'] |
380 |
||
4046
aed0e2af4546
paragraph: fix _splitWord for unicode/bytes bug reported by Anders Hammarquist & add a test
robin
parents:
4036
diff
changeset
|
381 |
def test2(self): |
aed0e2af4546
paragraph: fix _splitWord for unicode/bytes bug reported by Anders Hammarquist & add a test
robin
parents:
4036
diff
changeset
|
382 |
'''test _splitWord''' |
aed0e2af4546
paragraph: fix _splitWord for unicode/bytes bug reported by Anders Hammarquist & add a test
robin
parents:
4036
diff
changeset
|
383 |
self.assertEqual(_splitWord(u'd\'op\u00e9ration',30,[30],0,'Helvetica',12),[u"d'op\xe9", u'ratio', u'n']) |
aed0e2af4546
paragraph: fix _splitWord for unicode/bytes bug reported by Anders Hammarquist & add a test
robin
parents:
4036
diff
changeset
|
384 |
self.assertEqual(_splitWord(b'd\'op\xc3\xa9ration',30,[30],0,'Helvetica',12),[u"d'op\xe9", u'ratio', u'n']) |
aed0e2af4546
paragraph: fix _splitWord for unicode/bytes bug reported by Anders Hammarquist & add a test
robin
parents:
4036
diff
changeset
|
385 |
|
2963 | 386 |
class ULTestCase(unittest.TestCase): |
387 |
"Test underlining and overstriking of paragraphs." |
|
388 |
def testUl(self): |
|
389 |
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame, PageBegin |
|
390 |
from reportlab.lib.units import inch |
|
391 |
from reportlab.platypus.flowables import AnchorFlowable |
|
392 |
class MyDocTemplate(BaseDocTemplate): |
|
393 |
_invalidInitArgs = ('pageTemplates',) |
|
394 |
||
395 |
def __init__(self, filename, **kw): |
|
396 |
self.allowSplitting = 0 |
|
397 |
kw['showBoundary']=1 |
|
398 |
BaseDocTemplate.__init__(self, filename, **kw) |
|
399 |
self.addPageTemplates( |
|
400 |
[ |
|
401 |
PageTemplate('normal', |
|
402 |
[Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))], |
|
403 |
), |
|
404 |
]) |
|
405 |
||
406 |
styleSheet = getSampleStyleSheet() |
|
407 |
normal = ParagraphStyle(name='normal',fontName='Times-Roman',fontSize=12,leading=1.2*12,parent=styleSheet['Normal']) |
|
408 |
normal_sp = ParagraphStyle(name='normal_sp',parent=normal,alignment=TA_JUSTIFY,spaceBefore=12) |
|
409 |
normal_just = ParagraphStyle(name='normal_just',parent=normal,alignment=TA_JUSTIFY) |
|
410 |
normal_right = ParagraphStyle(name='normal_right',parent=normal,alignment=TA_RIGHT) |
|
411 |
normal_center = ParagraphStyle(name='normal_center',parent=normal,alignment=TA_CENTER) |
|
412 |
normal_indent = ParagraphStyle(name='normal_indent',firstLineIndent=0.5*inch,parent=normal) |
|
413 |
normal_indent_lv_2 = ParagraphStyle(name='normal_indent_lv_2',firstLineIndent=1.0*inch,parent=normal) |
|
414 |
texts = ['''Furthermore, a subset of <font size="14">English sentences</font> interesting on quite |
|
415 |
independent grounds is not quite equivalent to a stipulation to place |
|
416 |
the constructions into these various categories.''', |
|
417 |
'''We will bring evidence in favor of |
|
418 |
The following thesis: most of the methodological work in modern |
|
419 |
linguistics can be defined in such a way as to impose problems of |
|
420 |
phonemic and morphological analysis.'''] |
|
421 |
story =[] |
|
422 |
a = story.append |
|
423 |
a(Paragraph("This should <a href=\"#theEnd\" color=\"blue\"><a href=\"#theEnd\" color=\"blue\">jump</a></a> jump to the end!",style=normal)) |
|
424 |
a(XPreformatted("This should <a href=\"#theEnd\" color=\"blue\"><a href=\"#theEnd\" color=\"blue\">jump</a></a> jump to the end!",style=normal)) |
|
425 |
a(Paragraph("<a href=\"#theEnd\"><u><font color=\"blue\">ditto</font></u></a>",style=normal)) |
|
426 |
a(XPreformatted("<a href=\"#theEnd\"><u><font color=\"blue\">ditto</font></u></a>",style=normal)) |
|
427 |
a(Paragraph("This <font color='CMYKColor(0,0.6,0.94,0)'>should</font> <a href=\"#thePenultimate\" color=\"blue\"><a href=\"#thePenultimate\" color=\"blue\">jump</a></a> jump to the penultimate page!",style=normal)) |
|
428 |
a(Paragraph("This should <a href=\"#theThird\" color=\"blue\"><a href=\"#theThird\" color=\"blue\">jump</a></a> jump to a justified para!",style=normal)) |
|
429 |
a(Paragraph("This should <a href=\"#theFourth\" color=\"blue\"><a href=\"#theFourth\" color=\"blue\">jump</a></a> jump to an indented para!",style=normal)) |
|
430 |
for mode in (0,1): |
|
431 |
text0 = texts[0] |
|
432 |
text1 = texts[1] |
|
433 |
if mode: |
|
434 |
text0 = text0.replace('English sentences','<b>English sentences</b>').replace('quite equivalent','<i>quite equivalent</i>') |
|
435 |
text1 = text1.replace('the methodological work','<b>the methodological work</b>').replace('to impose problems','<i>to impose problems</i>') |
|
436 |
for t in ('u','strike'): |
|
3721 | 437 |
for n in range(6): |
2963 | 438 |
for s in (normal,normal_center,normal_right,normal_just,normal_indent, normal_indent_lv_2): |
439 |
for autoLeading in ('','min','max'): |
|
440 |
if n==4 and s==normal_center and t=='strike' and mode==1: |
|
441 |
a(Paragraph("<font color=green>The second jump at the beginning should come here <a name=\"thePenultimate\"/><a name=\"thePenultimate\"/>!</font>",style=normal)) |
|
442 |
elif n==4 and s==normal_just and t=='strike' and mode==1: |
|
443 |
a(Paragraph("<font color=green>The third jump at the beginning should come just below here to a paragraph with just an a tag in it!</font>",style=normal)) |
|
444 |
a(Paragraph("<a name=\"theThird\"/>",style=normal)) |
|
445 |
elif n==4 and s==normal_indent and t=='strike' and mode==1: |
|
446 |
a(Paragraph("<font color=green>The fourth jump at the beginning should come just below here!</font>",style=normal)) |
|
447 |
a(AnchorFlowable('theFourth')) |
|
448 |
a(Paragraph('n=%d style=%s(autoLeading=%s) tag=%s'%(n,s.name,autoLeading,t),style=normal_sp)) |
|
449 |
a(Paragraph('<para autoleading="%s">%s<%s>%s</%s>. %s <%s>%s</%s>. %s</para>' % ( |
|
450 |
autoLeading, |
|
451 |
(s==normal_indent_lv_2 and '<seq id="document" inc="no"/>.<seq id="document_lv_2"/>' or ''), |
|
452 |
t,' '.join((n+1)*['A']),t,text0,t,' '.join((n+1)*['A']),t,text1), |
|
453 |
style=s)) |
|
454 |
a(Paragraph("The jump at the beginning should come here <a name=\"theEnd\"/><a name=\"theEnd\"/>!",style=normal)) |
|
455 |
doc = MyDocTemplate(outputfile('test_platypus_paragraphs_ul.pdf')) |
|
456 |
doc.build(story) |
|
457 |
||
458 |
class AutoLeadingTestCase(unittest.TestCase): |
|
459 |
"Test underlining and overstriking of paragraphs." |
|
460 |
def testAutoLeading(self): |
|
461 |
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame, PageBegin |
|
462 |
from reportlab.lib.units import inch |
|
463 |
from reportlab.platypus.flowables import AnchorFlowable |
|
464 |
class MyDocTemplate(BaseDocTemplate): |
|
465 |
_invalidInitArgs = ('pageTemplates',) |
|
466 |
||
467 |
def __init__(self, filename, **kw): |
|
468 |
self.allowSplitting = 0 |
|
469 |
kw['showBoundary']=1 |
|
470 |
BaseDocTemplate.__init__(self, filename, **kw) |
|
471 |
self.addPageTemplates( |
|
472 |
[ |
|
473 |
PageTemplate('normal', |
|
474 |
[Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))], |
|
475 |
), |
|
476 |
]) |
|
477 |
||
2987 | 478 |
from reportlab.lib.testutils import testsFolder |
2963 | 479 |
styleSheet = getSampleStyleSheet() |
480 |
normal = ParagraphStyle(name='normal',fontName='Times-Roman',fontSize=12,leading=1.2*12,parent=styleSheet['Normal']) |
|
481 |
normal_sp = ParagraphStyle(name='normal_sp',parent=normal,alignment=TA_JUSTIFY,spaceBefore=12) |
|
482 |
texts = ['''Furthermore, a subset of <font size="14">English sentences</font> interesting on quite |
|
483 |
independent grounds is not quite equivalent to a stipulation to place |
|
2966 | 484 |
<font color="blue">the constructions <img src="%(testsFolder)s/../docs/images/testimg.gif"/> into these various categories.</font>'''%dict(testsFolder=testsFolder), |
2963 | 485 |
'''We will bring <font size="18">Ugly Things</font> in favor of |
486 |
The following thesis: most of the methodological work in Modern |
|
2966 | 487 |
Linguistics can be <img src="%(testsFolder)s/../docs/images/testimg.gif" valign="baseline" /> defined in such <img src="%(testsFolder)s/../docs/images/testimg.gif" valign="10" /> a way as to impose problems of |
488 |
phonemic and <u>morphological <img src="%(testsFolder)s/../docs/images/testimg.gif" valign="top"/> </u> analysis.'''%dict(testsFolder=testsFolder)] |
|
2963 | 489 |
story =[] |
490 |
a = story.append |
|
491 |
t = 'u' |
|
492 |
n = 1 |
|
493 |
for s in (normal,normal_sp): |
|
494 |
for autoLeading in ('','min','max'): |
|
495 |
a(Paragraph('style=%s(autoLeading=%s)'%(s.name,autoLeading),style=normal_sp)) |
|
496 |
a(Paragraph('<para autoleading="%s"><%s>%s</%s>. %s <%s>%s</%s>. %s</para>' % ( |
|
497 |
autoLeading, |
|
498 |
t,' '.join((n+1)*['A']),t,texts[0],t,' '.join((n+1)*['A']),t,texts[1]), |
|
499 |
style=s)) |
|
2966 | 500 |
a(Paragraph('''<img src="%(testsFolder)s/../docs/images/testimg.gif" valign="top"/> image is very first thing in the line.'''%dict(testsFolder=testsFolder), style=normal)) |
2963 | 501 |
a(Paragraph('some text.... some more.... some text.... some more....', normal)) |
2966 | 502 |
a(Paragraph('<img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="0.19in" /> some text <br /> '%dict(testsFolder=testsFolder), normal)) |
2963 | 503 |
a(Paragraph('some text.... some more.... some text.... some more....', normal)) |
2966 | 504 |
a(Paragraph('<img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="0.19in" /> <br /> '%dict(testsFolder=testsFolder), normal)) |
2963 | 505 |
a(Paragraph('some text.... some more.... some text.... some more....', normal)) |
506 |
||
507 |
#Volker Haas' valign tests |
|
508 |
fmt = '''<font color="red">%(valign)s</font>: Furthermore, a <u>subset</u> <strike>of</strike> <font size="14">English sentences</font> interesting on quite |
|
2966 | 509 |
independent grounds is not quite equivalent to a stipulation to place <img src="%(testsFolder)s/../docs/images/redsquare.png" width="0.5in" height="0.5in" valign="%(valign)s"/> |
2963 | 510 |
the constructions into these <u>various</u> categories. We will bring <font size="18">Ugly Things</font> in favor of |
511 |
The following thesis: most of the methodological work in Modern |
|
512 |
Linguistics can be defined in such a way as to impose problems of |
|
513 |
phonemic and <u>morphological</u> <strike>analysis</strike>.''' |
|
514 |
||
515 |
p_style= ParagraphStyle('Normal') |
|
516 |
p_style.autoLeading = 'max' |
|
517 |
for valign in ( |
|
518 |
'baseline', |
|
519 |
'sub', |
|
520 |
'super', |
|
521 |
'top', |
|
522 |
'text-top', |
|
523 |
'middle', |
|
524 |
'bottom', |
|
525 |
'text-bottom', |
|
526 |
'0%', |
|
527 |
'2in', |
|
528 |
): |
|
2966 | 529 |
a(Paragraph(fmt % dict(valign=valign,testsFolder=testsFolder),p_style)) |
530 |
a(XPreformatted(fmt % dict(valign=valign,testsFolder=testsFolder),p_style)) |
|
3439
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
531 |
|
4249
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
532 |
a(Paragraph('<br/><b>Some Paragraph tests of <sup rise="pts" size="pts"</b>...', normal)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
533 |
a(Paragraph("<br/>This is a <sup><span color='red'>sup</span></sup>.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
534 |
a(XPreformatted("This is a <sup><span color='red'>sup</span></sup>.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
535 |
a(Paragraph("This is a <sup rise=5><span color='red'>sup</span></sup>rise=5.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
536 |
a(XPreformatted("This is a <sup rise=5><span color='red'>sup</span></sup>rise=5.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
537 |
a(Paragraph("This is a <sup rise=6><span color='red'>sup</span></sup>rise=6.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
538 |
a(XPreformatted("This is a <sup rise=6><span color='red'>sup</span></sup>rise=6.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
539 |
a(Paragraph("This is a <sup rise=7><span color='red'>sup</span></sup>rise=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
540 |
a(XPreformatted("This is a <sup rise=7><span color='red'>sup</span></sup>rise=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
541 |
a(Paragraph("This is a <sup rise=8><span color='red'>sup</span></sup>rise=8.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
542 |
a(XPreformatted("This is a <sup rise=8><span color='red'>sup</span></sup>rise=8.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
543 |
a(Paragraph("This is a <sup rise=9><span color='red'>sup</span></sup>rise=9.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
544 |
a(XPreformatted("This is a <sup rise=9><span color='red'>sup</span></sup>rise=9.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
545 |
a(Paragraph("This is a <sup size=7><span color='red'>sup</span></sup>size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
546 |
a(XPreformatted("This is a <sup size=7><span color='red'>sup</span></sup>size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
547 |
a(Paragraph("This is a <sup rise=5 size=7><span color='red'>sup</span></sup>rise=5 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
548 |
a(XPreformatted("This is a <sup rise=5 size=7><span color='red'>sup</span></sup>rise=5 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
549 |
a(Paragraph("This is a <sup rise=6 size=7><span color='red'>sup</span></sup>rise=6 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
550 |
a(XPreformatted("This is a <sup rise=6 size=7><span color='red'>sup</span></sup>rise=6 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
551 |
a(Paragraph("This is a <sup rise=7 size=7><span color='red'>sup</span></sup>rise=7 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
552 |
a(XPreformatted("This is a <sup rise=7 size=7><span color='red'>sup</span></sup>rise=7 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
553 |
a(Paragraph("This is a <sup rise=8 size=7><span color='red'>sup</span></sup>rise=8 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
554 |
a(XPreformatted("This is a <sup rise=8 size=7><span color='red'>sup</span></sup>rise=8 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
555 |
a(Paragraph("This is a <sup rise=9 size=7><span color='red'>sup</span></sup>rise=9 size=7.",p_style)) |
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
556 |
a(XPreformatted("This is a <sup rise=9 size=7><span color='red'>sup</span></sup>rise=9 size=7.",p_style)) |
4255
89ea1d46b4a0
make paraparser syntax errors real and fix <sup/sub> tags to have relative values; version-->3.3.1
robin
parents:
4252
diff
changeset
|
557 |
a(Paragraph("This is a <sup rise=90% size=70%><span color='red'>sup</span></sup>rise=90% size=70%.",p_style)) |
89ea1d46b4a0
make paraparser syntax errors real and fix <sup/sub> tags to have relative values; version-->3.3.1
robin
parents:
4252
diff
changeset
|
558 |
a(Paragraph("This is a <sup rise=-2 size=-2><span color='red'>sup</span></sup>rise=-2 size=-2.",p_style)) |
89ea1d46b4a0
make paraparser syntax errors real and fix <sup/sub> tags to have relative values; version-->3.3.1
robin
parents:
4252
diff
changeset
|
559 |
a(Paragraph("This is a <sup rise=-4 size=-3><span color='red'>sup</span></sup>rise=-4 size=-3.",p_style)) |
4249
8fc7d11bdee0
add support for rml <sup>/<sub> rise and size attributes; version --> 3.2.17
robin
parents:
4220
diff
changeset
|
560 |
a(PageBreak()) |
3439
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
561 |
|
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
562 |
a(Paragraph('<br/><b>Some Paragraph tests of <img width="x%" height="x%"</b>...', normal)) |
3435
31d0d9bb877a
platypus: preliminary working version of % height/width for <img> tag
rgbecker
parents:
3371
diff
changeset
|
563 |
a(Paragraph('H=10%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="10%%" />'%dict(testsFolder=testsFolder), normal)) |
31d0d9bb877a
platypus: preliminary working version of % height/width for <img> tag
rgbecker
parents:
3371
diff
changeset
|
564 |
a(Paragraph('H=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="50%%" />'%dict(testsFolder=testsFolder), normal)) |
31d0d9bb877a
platypus: preliminary working version of % height/width for <img> tag
rgbecker
parents:
3371
diff
changeset
|
565 |
a(Paragraph('H=100%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="100%%" />'%dict(testsFolder=testsFolder), normal)) |
31d0d9bb877a
platypus: preliminary working version of % height/width for <img> tag
rgbecker
parents:
3371
diff
changeset
|
566 |
a(Paragraph('H=100%% W=10%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="10%%" height="100%%" />'%dict(testsFolder=testsFolder), normal)) |
31d0d9bb877a
platypus: preliminary working version of % height/width for <img> tag
rgbecker
parents:
3371
diff
changeset
|
567 |
a(Paragraph('H=100%% W=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="50%%" height="100%%" />'%dict(testsFolder=testsFolder), normal)) |
3439
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
568 |
a(Paragraph('H=50%% W=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="50%%" height="50%%" />'%dict(testsFolder=testsFolder), normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
569 |
a(Paragraph('<br/><b>Some XPreformatted tests of <img width="x%" height="x%"</b>...', normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
570 |
a(XPreformatted('H=10%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="10%%" />'%dict(testsFolder=testsFolder), normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
571 |
a(XPreformatted('H=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="50%%" />'%dict(testsFolder=testsFolder), normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
572 |
a(XPreformatted('H=100%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="100%%" />'%dict(testsFolder=testsFolder), normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
573 |
a(XPreformatted('H=100%% W=10%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="10%%" height="100%%" />'%dict(testsFolder=testsFolder), normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
574 |
a(XPreformatted('H=100%% W=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="50%%" height="100%%" />'%dict(testsFolder=testsFolder), normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
575 |
a(XPreformatted('H=50%% W=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="50%%" height="50%%" />'%dict(testsFolder=testsFolder), normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
576 |
a(Paragraph('<br/><b>Some CJK Paragraph tests of <img width="x%" height="x%"</b>...', normal)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
577 |
normalCJK = ParagraphStyle('normalCJK', parent=normal, wordWrap = 'CJK') |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
578 |
a(Paragraph('H=10%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="10%%" />'%dict(testsFolder=testsFolder), normalCJK)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
579 |
a(Paragraph('H=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="50%%" />'%dict(testsFolder=testsFolder), normalCJK)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
580 |
a(Paragraph('H=100%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="0.57in" height="100%%" />'%dict(testsFolder=testsFolder), normalCJK)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
581 |
a(Paragraph('H=100%% W=10%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="10%%" height="100%%" />'%dict(testsFolder=testsFolder), normalCJK)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
582 |
a(Paragraph('H=100%% W=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="50%%" height="100%%" />'%dict(testsFolder=testsFolder), normalCJK)) |
dc7b50400f12
test_platypus_paragraphs.py: add more tests of percentaged width/height img tags
rgbecker
parents:
3435
diff
changeset
|
583 |
a(Paragraph('H=50%% W=50%% <img src="%(testsFolder)s/../docs/images/testimg.gif" width="50%%" height="50%%" />'%dict(testsFolder=testsFolder), normalCJK)) |
2963 | 584 |
doc = MyDocTemplate(outputfile('test_platypus_paragraphs_autoleading.pdf')) |
585 |
doc.build(story) |
|
586 |
||
587 |
class JustifyTestCase(unittest.TestCase): |
|
588 |
"Test justification of paragraphs." |
|
589 |
def testUl(self): |
|
590 |
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame, PageBegin |
|
591 |
from reportlab.lib.units import inch |
|
592 |
class MyDocTemplate(BaseDocTemplate): |
|
593 |
_invalidInitArgs = ('pageTemplates',) |
|
594 |
||
595 |
def __init__(self, filename, **kw): |
|
596 |
self.allowSplitting = 0 |
|
597 |
BaseDocTemplate.__init__(self, filename, **kw) |
|
598 |
self.addPageTemplates( |
|
599 |
[ |
|
600 |
PageTemplate('normal', |
|
601 |
[Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))], |
|
602 |
), |
|
603 |
]) |
|
604 |
||
605 |
styleSheet = getSampleStyleSheet() |
|
606 |
normal = ParagraphStyle(name='normal',fontName='Times-Roman',fontSize=12,leading=1.2*12,parent=styleSheet['Normal']) |
|
607 |
normal_just = ParagraphStyle(name='normal_just',parent=normal,alignment=TA_JUSTIFY,spaceAfter=12) |
|
608 |
text0 = '''Furthermore, a subset of English sentences interesting on quite |
|
609 |
independent grounds is not quite equivalent to a stipulation to place |
|
610 |
the constructions into these various categories. We will bring evidence in favor of |
|
611 |
The following thesis: most of the methodological work in modern |
|
612 |
linguistics can be defined in such a way as to impose problems of |
|
613 |
phonemic and morphological analysis.''' |
|
614 |
story =[] |
|
615 |
a = story.append |
|
4220
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
616 |
for mode in (0,1,2,3,4,5,6,7): |
2963 | 617 |
text = text0 |
4220
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
618 |
paraStyle = normal_just |
2963 | 619 |
if mode==1: |
620 |
text = text.replace('English sentences','<b>English sentences</b>').replace('quite equivalent','<i>quite equivalent</i>') |
|
621 |
text = text.replace('the methodological work','<b>the methodological work</b>').replace('to impose problems','<i>to impose problems</i>') |
|
622 |
a(Paragraph('Justified paragraph in normal/bold/italic font',style=normal)) |
|
623 |
elif mode==2: |
|
624 |
text = '<b>%s</b>' % text |
|
625 |
a(Paragraph('Justified paragraph in bold font',style=normal)) |
|
626 |
elif mode==3: |
|
627 |
text = '<i>%s</i>' % text |
|
628 |
a(Paragraph('Justified paragraph in italic font',style=normal)) |
|
3371 | 629 |
elif mode==4: |
630 |
text = text.replace('English ','English ').replace('quite ','quite ') |
|
631 |
text = text.replace(' methodological',' methodological').replace(' impose',' impose') |
|
3807 | 632 |
a(Paragraph('Justified paragraph in normal font & some hard spaces',style=normal)) |
4220
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
633 |
elif mode in (5,6,7): |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
634 |
text = text.replace('as to impose','<br/>as to impose').replace(' most of the','<br/>most of the') |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
635 |
text = text.replace(' grounds','<br/>grounds').replace(' various','<br/>various') |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
636 |
if mode in (6,7): |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
637 |
msg = [] |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
638 |
msg.append('justifyBreaks=1') |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
639 |
paraStyle = paraStyle.clone('paraStyle6',paraStyle,justifyBreaks=1) |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
640 |
if mode==7: |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
641 |
msg.append('justifyLastLine=3') |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
642 |
paraStyle = paraStyle.clone('paraStyle7',paraStyle,justifyLastLine=3) |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
643 |
msg = '(%s) ' % (' '.join(msg)) |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
644 |
else: |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
645 |
a(PageBreak()) |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
646 |
msg = ' ' |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
647 |
|
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
648 |
a(Paragraph('Justified%swith some <br/> tags' % msg,style=normal)) |
2963 | 649 |
else: |
650 |
a(Paragraph('Justified paragraph in normal font',style=normal)) |
|
651 |
||
4220
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4148
diff
changeset
|
652 |
a(Paragraph(text,style=paraStyle)) |
2963 | 653 |
doc = MyDocTemplate(outputfile('test_platypus_paragraphs_just.pdf')) |
654 |
doc.build(story) |
|
655 |
||
3564
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
656 |
def testAutoPageTemplate(self): |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
657 |
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame, PageBegin |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
658 |
from reportlab.lib.units import inch |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
659 |
class onPage: |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
660 |
def __init__(self,label): |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
661 |
self.label = label |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
662 |
def __call__(self,canv,doc): |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
663 |
canv.drawString(72,72,'This is pageTemplate(%s)' % (self.label,)) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
664 |
class MyDocTemplate(BaseDocTemplate): |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
665 |
_invalidInitArgs = ('pageTemplates',) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
666 |
|
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
667 |
def __init__(self, filename, **kw): |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
668 |
self.allowSplitting = 0 |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
669 |
BaseDocTemplate.__init__(self, filename, **kw) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
670 |
self.addPageTemplates( |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
671 |
[ |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
672 |
PageTemplate('normal', |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
673 |
[Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))], |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
674 |
onPage = onPage('normal'), |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
675 |
), |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
676 |
PageTemplate('auto', |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
677 |
[Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))], |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
678 |
onPage = onPage('auto'), |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
679 |
autoNextPageTemplate = 'autoFollow', |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
680 |
), |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
681 |
PageTemplate('autoFollow', |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
682 |
[Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))], |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
683 |
onPage = onPage('autoFollow'), |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
684 |
), |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
685 |
]) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
686 |
styleSheet = getSampleStyleSheet() |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
687 |
normal = ParagraphStyle(name='normal',fontName='Times-Roman',fontSize=12,leading=1.2*12,parent=styleSheet['Normal']) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
688 |
story =[] |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
689 |
a = story.append |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
690 |
a(Paragraph('should be on page template normal', normal)) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
691 |
a(NextPageTemplate('auto')) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
692 |
a(PageBreak()) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
693 |
a(Paragraph('should be on page template auto', normal)) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
694 |
a(PageBreak()) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
695 |
a(DocAssert('doc.pageTemplate.id=="autoFollow"','expected doc.pageTemplate.id=="autoFollow"')) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
696 |
a(Paragraph('should be on page template autoFollow 1', normal)) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
697 |
a(PageBreak()) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
698 |
a(Paragraph('should be on page template autoFollow 2', normal)) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
699 |
doc = MyDocTemplate(outputfile('test_platypus_paragraphs_AutoNextPageTemplate.pdf')) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
700 |
doc.build(story) |
fd1f9e74eac2
test_platypus_paragraphs.py simple test of PageTemplate.autoNextPageTemplate
rgbecker
parents:
3492
diff
changeset
|
701 |
|
4315
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
702 |
def testParaBrFlowing(self): |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
703 |
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame, PageBegin |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
704 |
from reportlab.lib.units import inch |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
705 |
class MyDocTemplate(BaseDocTemplate): |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
706 |
_invalidInitArgs = ('pageTemplates',) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
707 |
|
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
708 |
def __init__(self, filename, **kw): |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
709 |
self.allowSplitting = 0 |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
710 |
BaseDocTemplate.__init__(self, filename, **kw) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
711 |
self.addPageTemplates( |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
712 |
[ |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
713 |
PageTemplate('normal', |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
714 |
[ |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
715 |
Frame(inch, 4.845*inch, 3*inch, 3.645*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red")), |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
716 |
Frame(4.27*inch, 4.845*inch, 3*inch, 3.645*inch, id='second',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red")), |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
717 |
Frame(inch, inch, 3*inch, 3.645*inch, id='third',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red")), |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
718 |
Frame(4.27*inch, inch, 3*inch, 3.645*inch, id='fourth',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red")) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
719 |
], |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
720 |
), |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
721 |
]) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
722 |
styleSheet = getSampleStyleSheet() |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
723 |
normal = ParagraphStyle(name='normal',fontName='Helvetica',fontSize=10,leading=12,parent=styleSheet['Normal']) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
724 |
bold = ParagraphStyle(name='bold',fontName='Helvetica-Bold',fontSize=12,leading=14.4,parent=normal) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
725 |
brText=""" |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
726 |
Clearly, the natural general principle that will subsume this case is |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
727 |
not subject to a parasitic gap construction. Presumably, most of the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
728 |
methodological work in modern linguistics can be defined in such a way |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
729 |
as to impose the system of base rules exclusive of the lexicon. In the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
730 |
discussion of resumptive pronouns following (81), the fundamental error |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
731 |
of regarding functional notions as categorial is to be regarded as a |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
732 |
descriptive <span color="red">fact</span>.<br/>So far, the earlier discussion of deviance is not |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
733 |
quite equivalent to a parasitic gap construction. To characterize a |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
734 |
linguistic level L, a case of semigrammaticalness of a different sort |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
735 |
may remedy and, at the same time, eliminate irrelevant intervening |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
736 |
contexts in selectional <span color="red">rules</span>.<br/> |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
737 |
Summarizing, then, we assume that the descriptive power of the base |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
738 |
component can be defined in such a way as to impose nondistinctness in |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
739 |
the sense of distinctive feature theory. A lot of sophistication has |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
740 |
been developed about the utilization of machines for complex purposes, |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
741 |
the notion of level of grammaticalness delimits an abstract underlying |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
742 |
<span color="red">order</span>.<br/>To provide a constituent structure for T(Z,K), a subset of |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
743 |
English sentences interesting on quite independent grounds appears to |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
744 |
correlate rather closely with problems of phonemic and morphological |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
745 |
analysis. For one thing, this analysis of a formative as a pair of sets |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
746 |
of features is rather different from a general convention regarding the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
747 |
forms of the grammar. A lot of sophistication has been developed about |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
748 |
the utilization of machines for complex purposes, a case of |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
749 |
semigrammaticalness of a different sort is not to be considered in |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
750 |
determining an important distinction in language <span color="red">use</span>.<br/> |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
751 |
We will bring evidence in favor of the following thesis: a subset of |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
752 |
English sentences interesting on quite independent grounds delimits a |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
753 |
descriptive <span color="red">fact</span>.<br/>To characterize a linguistic level L, the notion of |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
754 |
level of grammaticalness is not to be considered in determining a |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
755 |
parasitic gap construction. It must be emphasized, once again, that the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
756 |
speaker-hearer's linguistic intuition can be defined in such a way as to |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
757 |
impose a stipulation to place the constructions into these various |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
758 |
categories. On our assumptions, the appearance of parasitic gaps in |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
759 |
domains relatively inaccessible to ordinary extraction raises serious |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
760 |
doubts about problems of phonemic and morphological analysis. For one |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
761 |
thing, the fundamental error of regarding functional notions as |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
762 |
categorial is not quite equivalent to a stipulation to place the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
763 |
constructions into these various <span color="red">categories</span>.<br/> |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
764 |
Thus the descriptive power of the base component is unspecified with |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
765 |
respect to the strong generative capacity of the theory. Presumably, |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
766 |
the theory of syntactic features developed earlier appears to correlate |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
767 |
rather closely with a corpus of utterance tokens upon which conformity |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
768 |
has been defined by the paired utterance test. To provide a constituent |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
769 |
structure for T(Z,K), a case of semigrammaticalness of a different sort |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
770 |
is not to be considered in determining the ultimate standard that |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
771 |
determines the accuracy of any proposed grammar. For any transformation |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
772 |
which is sufficiently diversified in application to be of any interest, |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
773 |
a subset of English sentences interesting on quite independent grounds |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
774 |
raises serious doubts about the requirement that branching is not |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
775 |
tolerated within the dominance scope of a complex symbol. We will bring |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
776 |
evidence in favor of the following thesis: an important property of |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
777 |
these three types of EC is not to be considered in determining the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
778 |
system of base rules exclusive of the <span color="red">lexicon</span>.<br/> |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
779 |
With this clarification, the descriptive power of the base component is |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
780 |
not subject to the requirement that branching is not tolerated within |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
781 |
the dominance scope of a complex <span color="red">symbol</span>.<br/>In the discussion of |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
782 |
resumptive pronouns following (81), this selectionally introduced |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
783 |
contextual feature does not readily tolerate a parasitic gap |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
784 |
construction. Another superficial similarity is the interest in |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
785 |
simulation of behavior, a descriptively adequate grammar does not affect |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
786 |
the structure of a corpus of utterance tokens upon which conformity has |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
787 |
been defined by the paired utterance <span color="red">test</span>.<br/>From C1, it follows that the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
788 |
speaker-hearer's linguistic intuition is not to be considered in |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
789 |
determining the traditional practice of grammarians. Let us continue to |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
790 |
suppose that the notion of level of grammaticalness is necessary to |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
791 |
impose an interpretation on the system of base rules exclusive of the |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
792 |
<span color="red">lexicon</span>.<br/> |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
793 |
""" |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
794 |
story =[] |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
795 |
a = story.append |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
796 |
a(Paragraph('Paragraph Flowing', bold)) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
797 |
a(Paragraph(brText, normal)) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
798 |
doc = MyDocTemplate(outputfile('test_platypus_paragraphs_para_br_flowing.pdf')) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
799 |
doc.build(story) |
7c65c6e52b13
fix paragraph splitting bug (reporters Olivia Zhang & Echo Bell); version-->3.3.31
robin <robin@reportlab.com>
parents:
4291
diff
changeset
|
800 |
|
2963 | 801 |
#noruntests |
802 |
def makeSuite(): |
|
3371 | 803 |
return makeSuiteForClasses(ParagraphCorners,SplitFrameParagraphTest,FragmentTestCase, ParagraphSplitTestCase, ULTestCase, JustifyTestCase, |
804 |
AutoLeadingTestCase) |
|
2963 | 805 |
|
806 |
#noruntests |
|
807 |
if __name__ == "__main__": |
|
808 |
unittest.TextTestRunner().run(makeSuite()) |
|
809 |
printLocation() |