+1 for the Segiu's message.
2017-02-20 3:42 GMT+01:00 Sergiu Dumitriu <sergiu(a)xwiki.org>rg>:
Note that only one <thead> is allowed, but in
our wiki markup we can use
as many header rows and cells as we want. And it's not guaranteed that
the first row only has header cells. For example, what should happen
with the following table:
|=head|normal cell
|normal cell|=head
So, I'm +1 for the following rule:
If the table starts with one or more rows containing only header cells,
then put those rows in a <thead>. If the table ends with one or more
rows containing only header cells, then put those rows in a <tfoot>. If
other header cells are encountered in the table, or if the first/last
row contains both header and regular cells, then those cells are put as
<th> cells in a regular <tbody> row.
Not sure what to do with: if the table contains only header cells, then...?
On 02/19/2017 05:35 AM, Vincent Massol wrote:
Hi devs,
For the following XWiki Syntax 2.1 input:
|=head11|=head12
|cell11|cell12
We generate the following XHTML 1.0 output:
<table>
<tbody>
<tr>
<th>head11</th>
<th>head12</th>
</tr>
<tr>
<td>cell11</td>
<td>cell12</td>
</tr>
</tbody>
</table>
I think it would be better to generate:
<table>
<thead>
<tr>
<th>head11</th>
<th>head12</th>
</tr>
</thead>
<tbody>
<tr>
<td>cell11</td>
<td>cell12</td>
</tr>
</tbody>
</table>
Arguments:
* More standard.
* In addition I read I the XHTML spec that "Table rows may be grouped
into a
table head, table foot, and one or more table body sections, using
the thead, tfoot and tbody elements, respectively. This division enables
user agents to support scrolling of table bodies independently of the table
head and foot. When long tables are printed, the table head and foot
information may be repeated on each page that contains table data.”
I haven’t checked but hopefully it should relatively painless for our
CSS (unless
we use a rule for tbody/tr/th instead of tr/th or th). However
even if it changes our CSS I still fee it’s the right thing to do with a
note in the Release Notes for the unlikely chances that it would break
something.
Note tat
I know that for example for the
http://extensions.xwiki.org/
xwiki/bin/view/Extension/Datatables+Macro extension, we cannot use xwiki
syntax because of this issue (this is why the example is using the html
macro).
WDYT?
Thanks
-Vincent
PS: our XHTML parser already supports this as can be verified with the
following
test:
{{groovy}}
def input = '''
<table>
<thead>
<tr>
<th>head11</th>
<th>head12</th>
</tr>
</thead>
<tbody>
<tr>
<td>cell11</td>
<td>cell12</td>
</tr>
</tbody>
</table>
'''
def xdom = services.rendering.parse(input, 'xhtml/1.0')
println "{{{"
println services.rendering.render(xdom, 'xwiki/2.1')
println "}}}"
{{/groovy}}
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
--
Guillaume Delhumeau (guillaume.delhumeau(a)xwiki.com)
Research & Development Engineer at XWiki SAS
Committer on the