Skip to content

Commit 3ea5298

Browse files
authored
Merge pull request #225 from Julow/whitespace_in_tr
Whitespace in table
2 parents 3e94898 + 613859f commit 3ea5298

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

lib/html_sigs.mli

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ module type T = sig
908908
?thead: [< | thead] elt wrap ->
909909
?tfoot: [< | tfoot] elt wrap ->
910910
([< | table_attrib], [< | table_content_fun], [> | table]) star
911+
[@@reflect.filter_whitespace]
911912
[@@reflect.element "table"]
912913

913914
val tablex :
@@ -916,27 +917,33 @@ module type T = sig
916917
?thead: [< | thead] elt wrap ->
917918
?tfoot: [< | tfoot] elt wrap ->
918919
([< | tablex_attrib], [< | tablex_content_fun], [> | tablex]) star
920+
[@@reflect.filter_whitespace]
919921
[@@reflect.element "table" "table"]
920922

921923
val colgroup :
922924
([< | colgroup_attrib], [< | colgroup_content_fun], [> | colgroup]) star
925+
[@@reflect.filter_whitespace]
923926

924927
val col : ([< | col_attrib], [> | col]) nullary
925928

926929
val thead :
927930
([< | thead_attrib], [< | thead_content_fun], [> | thead]) star
931+
[@@reflect.filter_whitespace]
928932

929933
val tbody :
930934
([< | tbody_attrib], [< | tbody_content_fun], [> | tbody]) star
935+
[@@reflect.filter_whitespace]
931936

932937
val tfoot :
933938
([< | tfoot_attrib], [< | tfoot_content_fun], [> | tfoot]) star
939+
[@@reflect.filter_whitespace]
934940

935941
val td : ([< | td_attrib], [< | td_content_fun], [> | td]) star
936942

937943
val th : ([< | th_attrib], [< | th_content_fun], [> | th]) star
938944

939945
val tr : ([< | tr_attrib], [< | tr_content_fun], [> | tr]) star
946+
[@@reflect.filter_whitespace]
940947

941948
(** {3 Forms} *)
942949

test/test_ppx.ml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,45 @@ let basics = "ppx basics", HtmlTests.make Html.[
137137
[[%html "<ol> <li>foo</li> <li>bar</li> </ol>"]],
138138
[ol [li [txt "foo"] ; li [txt "bar"]]] ;
139139

140+
"whitespace in tr",
141+
[[%html "<tr> <td>foo</td> <td>bar</td> </tr>"]],
142+
[tr [td [txt "foo"] ; td [txt "bar"]]] ;
143+
144+
"whitespace in table",
145+
[[%html "<table> <tr><td>foo</td></tr> <tr><td>bar</td></tr> </table>"]],
146+
[tablex [tbody [tr [td [txt "foo"]] ; tr [td [txt "bar"]]]]] ;
147+
148+
"whitespace in table, full example",
149+
[[%html "<table>
150+
<caption>txt</caption>
151+
<colgroup>
152+
<col span=\"2\">
153+
</colgroup>
154+
<thead>
155+
<tr>
156+
<th>h1</th>
157+
<th>h2</th>
158+
</tr>
159+
</thead>
160+
<tbody>
161+
<tr>
162+
<td>b1</td>
163+
<td>b2</td>
164+
</tr>
165+
</tbody>
166+
<tfoot>
167+
<tr>
168+
<td>f1</td>
169+
<td>f2</td>
170+
</tr>
171+
</tfoot>
172+
</table>"]],
173+
[tablex ~caption:(caption [txt "txt"])
174+
~columns:[colgroup [col ~a:[a_span 2] ()]]
175+
~thead:(thead [tr [th [txt "h1"] ; th [txt "h2"]]])
176+
~tfoot:(tfoot [tr [td [txt "f1"] ; td [txt "f2"]]])
177+
[tbody [tr [td [txt "b1"] ; td [txt "b2"]]]]] ;
178+
140179
"whitespace in select",
141180
[[%html {|<select> <option value="bar">bar</option> </select>|}]],
142181
[select [option ~a:[a_value "bar"] @@ txt "bar"]] ;

0 commit comments

Comments
 (0)