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
//! The elements here are used to create and handle tabular data.

html_element! {
    /// The [HTML Table Caption element (`<caption>`)][mdn] specifies the caption (or title) of a
    /// table, and if used is *always* the first child of a [`<table>`][table].
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
    /// [table]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
    <caption>

    children {
        categories {
            Flow
        }
    }
}

html_element! {
    /// The [HTML `<col>` element][mdn] defines a column within a table and is used for defining
    /// common semantics on all common cells. It is generally found within a [`<colgroup>`][cg]
    /// element.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col
    /// [cg]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup
    <col>

    attributes {
        /// This attribute contains a positive integer indicating the number of consecutive columns
        /// the `<col>` element spans. If not present, its default value is 1.
        span
    }
}

html_element! {
    /// The [HTML `<colgroup>` element][mdn] defines a group of columns within a table.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup
    <colgroup>

    children {
        tags {
            <col> // if the span attribute is present
        }
    }

    attributes {
        /// This attribute contains a positive integer indicating the number of consecutive columns
        /// the `<colgroup>` element spans. If not present, its default value is 1.
        ///
        /// > Note: This attribute is applied on the attributes of the column group, it has no
        /// > effect on the CSS styling rules associated with it or, even more, to the cells of the
        /// > column's members of the group.
        /// >
        /// > The span attribute is not permitted if there are one or more `<col>` elements within
        /// > the `<colgroup>`.
        span
    }
}

html_element! {
    /// The [HTML `<table>` element][mdn] represents tabular data — that is, information presented
    /// in a two-dimensional table comprised of rows and columns of cells containing data.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
    <table>

    categories {
        Flow
    }

    children {
        tags {
            <caption>, <colgroup>, <thead>, <tbody>, <tr>, <tfoot>
        }
    }
}

html_element! {
    /// The [HTML Table Body element (`<tbody>`)][mdn] encapsulates a set of table rows
    /// ([`<tr>`][tr] elements), indicating that they comprise the body of the table
    /// ([`<table>`][table]).
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody
    /// [tr]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
    /// [table]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
    <tbody>

    children {
        tags {
            <tr>
        }
    }
}

html_element! {
    /// The [HTML `<td>` element][mdn] defines a cell of a table that contains data. It participates
    /// in the *table model*.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td
    <td>

    categories {
        Sectioning
    }

    children {
        categories {
            Flow
        }
    }

    attributes {
        /// This attribute contains a non-negative integer value that indicates for how many columns
        /// the cell extends. Its default value is 1. Values higher than 1000 will be considered as
        /// incorrect and will be set to the default value (1).
        colspan

        /// This attribute contains a list of space-separated strings, each corresponding to the id
        /// attribute of the `<th>` elements that apply to this element.
        headers

        /// This attribute contains a non-negative integer value that indicates for how many rows
        /// the cell extends. Its default value is 1; if its value is set to 0, it extends until the
        /// end of the table section (`<thead>`, `<tbody>`, `<tfoot>`, even if implicitly defined),
        /// that the cell belongs to. Values higher than 65534 are clipped down to 65534.
        rowspan
    }
}

html_element! {
    /// The [HTML `<tfoot>` element][mdn] defines a set of rows summarizing the columns of the
    /// table.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot
    <tfoot>

    children {
        tags {
            <tr>
        }
    }
}

html_element! {
    /// The [HTML `<th>` element][mdn] defines a cell as header of a group of table cells. The exact
    /// nature of this group is defined by the [`scope`][scope] and [`headers`][headers] attributes.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
    /// [scope]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
    /// [headers]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-headers
    <th>

    children {
        categories {
            Flow // no header, footer, sectioning, or heading descendants
        }
    }

    attributes {
        /// This attribute contains a short abbreviated description of the cell's content. Some
        /// user-agents, such as speech readers, may present this description before the content
        /// itself.
        abbr

        /// This attribute contains a non-negative integer value that indicates for how many columns
        /// the cell extends. Its default value is 1. Values higher than 1000 will be considered as
        /// incorrect and will be set to the default value (1).
        colspan

        /// This attribute contains a list of space-separated strings, each corresponding to the id
        /// attribute of the `<th>` elements that apply to this element.
        headers

        /// This attribute contains a non-negative integer value that indicates for how many rows
        /// the cell extends. Its default value is 1; if its value is set to 0, it extends until the
        /// end of the table section (`<thead>`, `<tbody>`, `<tfoot>`, even if implicitly defined),
        /// that the cell belongs to. Values higher than 65534 are clipped down to 65534.
        rowspan

        /// This enumerated attribute defines the cells that the header (defined in the `<th>`)
        /// element relates to. It may have the following values:
        ///
        /// * `row`: The header relates to all cells of the row it belongs to.
        /// * `col`: The header relates to all cells of the column it belongs to.
        /// * `rowgroup`: The header belongs to a rowgroup and relates to all of its cells. These
        ///   cells can be placed to the right or the left of the header, depending on the value of
        ///   the dir attribute in the `<table>` element.
        /// * `colgroup`: The header belongs to a colgroup and relates to all of its cells.
        /// * `auto`
        ///
        /// The default value when this attribute is not specified is auto.
        scope
    }
}

html_element! {
    /// The [HTML `<thead>` element][mdn] defines a set of rows defining the head of the columns of
    /// the table.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead
    <thead>

    children {
        tags {
            <tr>
        }
    }
}

html_element! {
    /// The [HTML `<tr>` element][mdn] defines a row of cells in a table. The row's cells can then
    /// be established using a mix of [`<td>`][td] (data cell) and [`<th>`][th] (header cell)
    /// elements.
    ///
    /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
    /// [td]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td
    /// [th]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
    <tr>

    children {
        tags {
            <td>, <th>
        }
        categories {
            ScriptSupporting
        }
    }
}