<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
<document filename="test_046_lists.pdf"> 


<template pageSize="(595, 842)" leftMargin="72" showBoundary="1">
<pageTemplate id="main">
    <pageGraphics>
        <setFont name="Helvetica-Bold" size="18"/>
            <drawString x="35" y="783">RML Example 53: Lists</drawString>
            <image file="logo_no_bar.png" preserveAspectRatio="1" x="488" y="749" width="72" height="72"/>
            <image file="strapline.png" preserveAspectRatio="1" x="35" y="0" width="525" />
        <setFont name="Helvetica" size="10"/>
        <drawCenteredString x="297" y="36"><pageNumber countingFrom="1"/></drawCenteredString>
    </pageGraphics>
    <frame id="second" x1="35" y1="45" width="525" height="590"/>
    </pageTemplate>
    <pageTemplate id="main2">
    <pageGraphics>
        <setFont name="Helvetica-Bold" size="18"/>
            <drawString x="35" y="783">RML Example 46: Lists</drawString>
            <image file="logo_no_bar.png" preserveAspectRatio="1" x="488" y="749" width="72" height="72"/>
            <image file="strapline.png" preserveAspectRatio="1" x="35" y="0" width="525" />
        <setFont name="Helvetica" size="10"/>
        <drawCenteredString x="297" y="36"><pageNumber countingFrom="1"/></drawCenteredString>
    </pageGraphics>
    <frame id="second" x1="35" y1="45" width="525" height="685"/>
    </pageTemplate>
</template>

<stylesheet>
	<initialize>
		<alias id="ul.defaultStyle" value="my.ul.defaultStyle"/>
		<alias id="ol.defaultStyle" value="my.ol.defaultStyle"/>
	</initialize>
    <paraStyle name="normal" fontName="Helvetica" fontSize="10" leading="12" />
    <paraStyle name="bodytext" parent="normal" spaceBefore="6" />
    <paraStyle name="lpsty" parent="bodytext" spaceAfter="18" />
    <paraStyle name="intro"  fontName="Helvetica" fontSize="12" leading="12" spaceAfter="12"/>
    <paraStyle name="h1" fontName="Helvetica-Bold" fontSize="12" spaceBefore ="10" />
    <paraStyle name="bullet" parent="normal" bulletFontName = "Helvetica" bulletFontSize="5"/>
    <blockTableStyle id="redgreen" spaceBefore="20">
        <!--blockAlignment value="left"/>
        <blockValign value="top"/>
        <blockBottomPadding length="0" start="0,0" stop="-1,-1"/>
        <blockLeftPadding length="0" start="0,0" stop="-1,-1"/>
        <blockTopPadding length="0" start="0,0" stop="-1,-1"/>
        <blockRightPadding length="0" start="0,0" stop="-1,-1"/-->
        <lineStyle start="0,0" stop="-1,-1" kind="GRID" colorName="green"/>
        <lineStyle start="0,0" stop="-1,-1" kind="BOX" colorName="red" thickness="2"/>
        <!--blockBackground colorName="pink" start="0,0" stop="-1,-1"/>
        <blockBackground colorName="yellow" start="0,0" stop="-1,-1"/-->
    </blockTableStyle>
    <listStyle name="blah" spaceAfter="10" bulletType="A" spaceBefore="23" />
    <listStyle name="square" spaceAfter="10" bulletType="bullet" spaceBefore="23" bulletColor="red" start="square"/>
    <listStyle name="list_normal" bulletFontSize="10" bulletFontName="Helvetica"/>
	<listStyle name="my.ul.defaultStyle" parent="style.UnorderedList" bulletFontSize="8" bulletOffsetY="0" 
		start='circle square blackstar sparkle disc diamond'/>
	<listStyle name="my.ol.defaultStyle" parent="style.OrderedList" bulletFontSize="8"
		start='1 i a A I'/>
</stylesheet>
<story>
<storyPlace x="35" y="660" width="525" height="73" origin="page">
<para style="intro">RML (Report Markup Language) is ReportLab's own language for specifying the appearance of a printed page, which is converted into PDF by the utility rml2pdf.</para>
<hr color="white" thickness="8pt"/>
<para style="intro">These RML samples showcase techniques and features for generating various types of ouput and are distributed within our commercial package as test cases. Each should be self explanatory and stand alone.</para>
<illustration height="3" width="525" align="center">
<fill color= "(0,0.99,0.97,0.0)" />
<rect x="0" y = "-12" width="525" height="3" round="1" fill="1" stroke = "Yes" />
</illustration>
</storyPlace>

<setNextTemplate name="main2"/>
    <para style="h1">Lists, and what to use them for</para>

    <para style="normal">We recently added unordered and ordered lists to RML.  This is to help out with certain publishing applications that need to
put flowing content in lists, with configurable markers. </para>

    <para style="normal">Let's spit out a simple bullet list with default attributes, and explain some of the basics:</para>

    <ul>
        <li><para style="normal">Line one.  Unordered lists use a &lt;ul&gt; tag.</para></li>
        <li><para style="normal">Line two</para></li>
        <li><para style="normal">Line three will be made very long, to make sure it wraps onto a second line.
This is to check we get the bullets nicely top-aligned.  Blah blah blah</para></li>
        <li><para style="bullet">Line four</para></li>
        <li><para style="bullet"><bullet>&bull;</bullet>Line five</para></li>
        <li><ul>
                <li><para style="normal">Line five 1</para></li>
                <li><para style="normal">Line five 2</para></li>
                <li><ul>
                        <li><para style="normal">Line five 3 1</para></li>
                        <li><para style="normal">Line five 3 2</para></li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>

    <para style="normal">To get the change of bullets with depth the style start attribute was specified as "circle square blackstar sparkle disc diamond". Here is the markup:</para>


<codesnippet language="xml"><![CDATA[
    <ul>
        <li><para style="normal">Line one</para></li>
        <li><para style="normal">Line two</para></li>
        <li><para style="normal">Line three</para></li>
        <li><para style="bullet">Line four</para></li>
        <li><para style="bullet"><bullet>A</bullet>Line five</para></li>
        <li><ul>
                <li><para style="normal">Line five 1</para></li>
                <li><para style="normal">Line five 2</para></li>
                <li><ul>
                        <li><para style="normal">Line five 3 1</para></li>
                        <li><para style="normal">Line five 3 2</para></li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>

]]></codesnippet>

<para style="h1">List alignment</para>


<para style="normal">In general, you should NOT use these if you want simple bullets and numbering alongside paragraphs of text.  Instead, use the 'bullet' feature of our paragraphs.  The problem is that the list tag has no way of knowing what paragraph style or font size you are going to use within the list items, so it's highly likely any bullets or numbers will (a) be in a different font, and (b) not be vertically aligned with the corresponding paragraphs.
</para>



<para style="normal">Lists can be styled with a listStyle tag in the stylesheet, or inline.
</para>


<para style="normal">If you want the bullets and numbers to align properly with text next to it, it's very important to define a listStyle which matches the paragraph style you intend to use:  bulletFontName, bulletFontSize, spaceBefore and spaceAfter must match those of your paragraph style. You
will then get bullets aligned to match the text.  (If you want your bullet characters to be SMALLER than the text beside them, you can drop the bulletFontSize but will need to fiddle with bulletOffsetY to get things aligned to taste).
</para>


    <ul style="list_normal">
        <li><para style="normal">Line one</para></li>
        <li><para style="normal">Line two will be made very long, to make sure it wraps onto a second line.
This is to check we get the bullets nicely top-aligned.  Blah blah blah</para></li>
        <li><para style="normal">Line three</para></li>
    </ul>



<para style="h1">Markers and numbers</para>
<para>You can specify the type of marker used in unordered lists, as well as specifying the colour, font and many other attributes.  The marker is a character in a font. You can set it on the first list item, and it will persist.  The predefined names are drawn from reportlab/platypus/flowables.py and shown below:</para>
    
<codesnippet language="python">

_bulletNames = dict(
                bulletchar=u'\u2022',   #usually a small circle
                circle=u'\u25cf',   #circle as high as the font
                square=u'\u25a0',
                disc=u'\u25cf',
                diamond=u'\u25c6',
                rarrowhead=u'\u27a4',
                )
</codesnippet>


    <ul style="list_normal">
        <li value="bulletchar"><para style="normal">Unicode Bullet character (usually small circle)</para></li>
        <li value="circle"><para style="normal">Circle</para></li>
        <li value="square"><para style="normal">Square</para></li>
        <li value="disc"><para style="normal">Disc</para></li>
        <li value="diamond"><para style="normal">Diamond</para></li>
        <li value="rarrowhead"><para style="normal">Right arrow head</para></li>
        <li value="&#x2022;"><para style="normal">Bullet, defined by unicode code point</para></li>
    </ul>

<para>You can also supply any character of your choice, either literally or as a Unicode escape sequence.</para>

<para style="h1">Numbered lists</para>

<para style="normal">The &lt;ol&gt; tag allows for automatic numbering.  In the style or list tag, set bulletType to one of these values:  'I' (for I, II, III, IV), 'i' (for 'i', 'ii', 'iii', 'iv'), '1' for 1,2,3.., 'A' for A,B,C or 'a' for 'a','b','c'.    On any list item, you can set &lt;li value="n"&gt; to set the current number used.</para>


    <ol style="list_normal" bulletType="i">
        <li><para style="normal">Item one</para></li>
        <li><para style="normal">Item two</para></li>
        <li><para style="normal">Item three</para></li>
        <li><para style="normal">Item four</para></li>
        <li><para style="normal">Item five</para></li>
        <li value="99"><para style="normal">Item six, but with value changed to 99</para></li>
        <li><para style="normal">Item six</para></li>
        <li><para style="normal">Item six</para></li>
    </ol>



<para style="h1">Some more tests</para>


    <ol>
        <li><para style="lpsty">A table with 5 rows</para></li>
        <li>
            <blockTable style="redgreen" colWidths="50,100,200">
                <tr><td>1</td><td><para style="bodytext"></para></td><td><para style="normal"></para></td></tr>
                <tr><td>2</td><td><para style="bodytext">xx </para></td><td><para style="normal">blah </para></td></tr>
                <tr><td>3</td><td><para style="bodytext">xx xx </para></td><td><para style="normal">blah blah </para></td></tr>
                <tr><td>4</td><td><para style="bodytext">xx xx xx </para></td><td><para style="normal">blah blah blah </para></td></tr>
                <tr><td>5</td><td><para style="bodytext">xx xx xx xx </para></td><td><para style="normal">blah blah blah blah </para></td></tr>
            </blockTable>
        </li>
        <li>
            <para style="normal">A sublist</para>
        </li>
        <li value="7">
            <ol bulletType="i">
                <li spaceBefore="6"><para style="normal">Another table with 3 rows</para></li>
                <li>
                    <blockTable style="redgreen" colWidths="60,90,180">
                        <tr><td>1</td><td><para style="bodytext"></para></td><td><para style="normal"></para></td></tr>
                        <tr><td>2</td><td><para style="bodytext">xx </para></td><td><para style="normal">blah </para></td></tr>
                        <tr><td>3</td><td><para style="bodytext">xx xx </para></td><td><para style="normal">blah blah </para></td></tr>
                    </blockTable>
                </li>
                <li><para style="normal">We have already seen that the notion of level of grammaticalness is,
apparently, determined by a corpus of utterance tokens upon which
conformity has been defined by the paired utterance test.  If the
position of the trace in (99c) were only relatively inaccessible to
movement, a descriptively adequate grammar suffices to account for the
traditional practice of grammarians.  Notice, incidentally, that this
analysis of a formative as a pair of sets of features cannot be
arbitrary in the strong generative capacity of the theory.</para>
                </li>
            </ol>
        </li>
        <li>
            <para style="normal">An unordered sublist</para>
        </li>
        <li>
            <ul>
                <li spaceBefore="6"><para style="normal">A table with 2 rows</para></li>
                <li bulletColor="green" spaceAfter="6">
                    <blockTable style="redgreen" colWidths="60,90,180">
                        <tr><td>1</td><td><para style="bodytext">zz zz zz </para></td><td><para style="normal">duh duh duh </para></td></tr>
                        <tr><td>2</td><td><para style="bodytext">yy yy yy yy </para></td><td><para style="normal">duh duh duh duh </para></td></tr>
                    </blockTable>
                </li>
                <li bulletColor="red" value="square"><para style="normal">In the discussion of resumptive pronouns following (81), this
selectionally introduced contextual feature is to be regarded as a
parasitic gap construction.  With this clarification, the systematic use
of complex symbols is not to be considered in determining a descriptive
fact.  On our assumptions, the notion of level of grammaticalness is
necessary to impose an interpretation on the strong generative capacity
of the theory.    It appears that a descriptively adequate grammar is not
subject to the requirement that branching is not tolerated within the
dominance scope of a complex symbol.  Comparing these examples with
their parasitic gap counterparts in (96) and (97), we see that this
selectionally introduced contextual feature is rather different from a
parasitic gap construction.</para>
                </li>
            </ul>
        </li>
        <li>
            <para style="normal">Of course, the systematic use of complex symbols raises serious doubts
about a stipulation to place the constructions into these various
categories.  By combining adjunctions and certain deformations, the
natural general principle that will subsume this case is to be regarded
as a descriptive fact.    This suggests that this analysis of a formative
as a pair of sets of features suffices to account for the requirement
that branching is not tolerated within the dominance scope of a complex
symbol.</para>
        </li>
    </ol>
    <ol style="blah">
        <li><para style="normal">item should be A</para></li>
        <li><para style="normal">item should be B</para></li>
    </ol>
    <ol>
        <li><para style="normal">item should be 1</para></li>
        <li><para style="normal">item should be 2</para></li>
    </ol>
    <ol bulletType="i">
        <li><para style="normal">item should be i</para><para style="normal">a second paragraph</para></li>
        <li><para style="normal">item should be ii</para></li>
    </ol>
    <ol bulletType="I">
        <li><para style="normal">item should be I</para></li>
        <li><para style="normal">item should be II</para><para style="normal">another paragraph</para></li>
    </ol>

    <ul style="square">
        <li><para style="normal">para 1</para></li>
        <li><para style="normal">para 2</para><para style="normal">another paragraph</para></li>
        <li value="circle" bulletColor="green"><para style="normal">para 3</para></li>
    </ul>

	<nextPage/>
<para style="h1">Ordered Lists With auto sequences</para>
<para style="normal">To get the numbering scheme to change with depth the start attribute was specified as '1 i a A I'.</para>
    <ol>
        <li><para style="normal">Line one.  Ordered lists use a &lt;ol&gt; tag.</para></li>
        <li><para style="normal">Line two</para></li>
        <li><para style="normal">Line three will be made very long, to make sure it wraps onto a second line.
This is to check we get the bullets nicely top-aligned.  Blah blah blah</para></li>
        <li><para style="bullet">Line four</para></li>
        <li><para style="bullet"><bullet>&bull;</bullet>Line five</para></li>
        <li><ol>
                <li><para style="normal">Line five 1</para></li>
                <li><para style="normal">Line five 2</para></li>
                <li><ol>
                        <li><para style="normal">Line five 3 1</para></li>
                        <li><para style="normal">Line five 3 2</para></li>
                    </ol>
                </li>
            </ol>
        </li>
    </ol>

<para style="normal">The markup is:</para>
<codesnippet language="xml"><![CDATA[
    <ol>
        <li><para style="normal">Line one.  Ordered lists use a &lt;ol&gt; tag.</para></li>
        <li><para style="normal">Line two</para></li>
        <li><para style="normal">Line three will be made very long, to make sure it wraps onto a second line.
This is to check we get the bullets nicely top-aligned.  Blah blah blah</para></li>
        <li><para style="bullet">Line four</para></li>
        <li><para style="bullet"><bullet>&bull;</bullet>Line five</para></li>
        <li><ol>
                <li><para style="normal">Line five 1</para></li>
                <li><para style="normal">Line five 2</para></li>
                <li><ol>
                        <li><para style="normal">Line five 3 1</para></li>
                        <li><para style="normal">Line five 3 2</para></li>
                    </ol>
                </li>
            </ol>
        </li>
    </ol>
]]></codesnippet>
<nextPage/>
<para style="h1">Definition lists</para>
<dl>
	<dt><h1>Coffee</h1></dt>
	<dd><para>Black hot drink</para></dd>
  <dt><h1>Milk</h1></dt>
  <dd><para>White cold drink</para></dd>
</dl>
</story>
</document>
