summaryrefslogtreecommitdiff
path: root/sandbox/html4strict/data/simple-lists.txt
blob: 13efd33e32610b7ea87db30d67a3202631d77e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
Simple and complex lists
------------------------

The `html4css1.HTMLTranslator` docstring says:

    This HTML writer has been optimized to produce visually compact
    lists (less vertical whitespace).  HTML's mixed content models
    allow list items to contain "<li><p>body elements</p></li>" or
    "<li>just text</li>" or even "<li>text<p>and body
    elements</p>combined</li>", each with different effects.  It would
    be best to stick with strict body elements in list items, but they
    affect vertical spacing in browsers (although they really
    shouldn't).

    Here is an outline of the optimization:

    - Check for and omit <p> tags in "simple" lists: list items
      contain either a single paragraph, a nested simple list, or a
      paragraph followed by a nested simple list.  This means that
      this list can be compact:

          - Item 1.
          - Item 2.

      But this list cannot be compact:

          - Item 1.

            This second paragraph forces space between list items.

          - Item 2.

    - In non-list contexts, omit <p> tags on a paragraph if that
      paragraph is the only child of its parent (footnotes & citations
      are allowed a label first).

    - Regardless of the above, in definitions, table cells, field bodies,
      option descriptions, and list items, mark the first child with
      'class="first"' and the last child with 'class="last"'.  The stylesheet
      sets the margins (top & bottom respectively) to 0 for these elements.

    The ``no_compact_lists`` setting (``--no-compact-lists`` command-line
    option) disables list whitespace optimization.

In `html4_strict`, the algorithm to determine if a list is "simple"
enough to be compacted includes field lists (in addition to ordered
lists and unordered lists).


.. raw:: html

   <style type="text/css"><!--
   dl.field-list > dd { margin-left:  40px;
                        padding-left: 0;
                        /* background: yellow; */
                      }
   --></style>



Simple lists
~~~~~~~~~~~~

* This list is simple
* There should be no space beween items.

#. This list is simple
#. There should be no space beween items.

:l1: This list is simple
:l2: There should be no space beween items.

Simple nested lists
~~~~~~~~~~~~~~~~~~~

* This list is simple
* * There should be no space beween items.

#. This list is simple
#. * There should be no space beween items.
   * There should be no space beween items.

:l1: This list is simple
:l2: * There should be no space beween items.

* This list is simple
* #. There should be no space beween items.

#. This list is simple
#. #. There should be no space beween items.

:l1: This list is simple
:l2: #. There should be no space beween items.

* This list is simple
* :11: There should be no space beween items.

#. This list is simple
#. :11: There should be no space beween items.

:l1: This list is simple
:l2: :11: There should be no space beween items.

Combined paragraph and list in a list item
""""""""""""""""""""""""""""""""""""""""""

* This list is simple

  #. Enumeration in first item
  #. second enumeration item

* There should be no space beween items.


#. This list is simple

   #. Enumeration in first item
   #. second enumeration item

#. There should be no space beween items.

:l1: This list is simple

   #. Enumeration in first item
   #. second enumeration item

:l2: There should be no space beween items.

* This list is simple

  * Bullet list in first item
  * Bullet list in first item

* There should be no space beween items.


#. This list is simple

   * Bullet list in first item
   * Bullet list in first item

#. There should be no space beween items.

:l1: This list is simple

     * Bullet list in first item
     * Bullet list in first item

:l2: There should be no space beween items.


* This list is simple

  :11: this item contains a field list.
  :12: this item contains a field list.

* there should be no space beween items.

#. This list is simple

   :11: this item contains a field list.
   :12: this item contains a field list.

#. there should be no space beween items.


:l1: This list is simple

     :11: this item contains a field list.

:l2: There should be no space beween items.


Complex lists
"""""""""""""

* This list is not simple

* Watch the space beween items

  It is caused by this paragraph


#. This list is not simple

#. Watch the space beween items

   It is caused by this paragraph

:l1: This list is not simple

:l2: Watch the space beween items

     It is caused by this paragraph


* This list is not simple

  second paragraph in first item

* Watch the space beween items.


#. This list is not simple

   second paragraph in first item

#. Watch the space beween items.

:l1: This list is not simple

     second paragraph in first item

:l2: Watch the space beween items.


* This list is not simple

* * Watch the space beween items

  It is caused by this paragraph


#. This list is not simple

#. * Watch the space beween items

   It is caused by this paragraph

:l1: This list is not simple

:l2: * Watch the space beween items

     * Watch the space beween items

     It is caused by this paragraph

:l1: This list is not simple

:l2: #. Watch the space beween items

     #. Watch the space beween items

     It is caused by this paragraph