Files
pandoc/test/command/8764.md
T
Michael Stahl 737446f33d Writers.OpenDocument: handle row header column cells as header cells
The previous commit prevented header column cells from being dropped on
the floor, this one changes the paragraph style to "Table_20_Heading".

Note that for the test input, the result is not correct: the
AnnotatedTable type cannot represent the HTML input properly, as it only
has a concept of header rows and header columns, but HTML can have an
individual cell that is a header (not 100% sure but they way i read
https://html.spec.whatwg.org/#header-and-data-cell-semantics the <th>
cell here is both a row header cell and a column header cell while the
other cells in the row and column are not header cells), and header
cells may even appear "in the middle" of a table (see example in
https://html.spec.whatwg.org/#the-th-element).

So while this appears like it's the right thing to do for
Writer.OpenDocument, it's not clear if this is going to make things
better or worse overall.

Fixes: #8764
2023-05-01 20:55:37 -07:00

1.7 KiB

% pandoc -f html -t opendocument
<table>
  <tbody>
    <tr>
      <th>Header</th>
      <td>Normal cell (column 2)</td>
      <td>Normal cell (column 3)</td>
    </tr>
    <tr>
      <td>Normal cell (column 1)</td>
      <td>Normal cell (column 2)</td>
      <td>Normal cell (column 3)</td>
    </tr>
  </tbody>
</table>
^D
<table:table table:name="Table1" table:style-name="Table1">
  <table:table-column table:style-name="Table1.A" />
  <table:table-column table:style-name="Table1.B" />
  <table:table-column table:style-name="Table1.C" />
  <table:table-row>
    <table:table-cell table:style-name="TableRowCell" office:value-type="string">
      <text:p text:style-name="Table_20_Heading">Header</text:p>
    </table:table-cell>
    <table:table-cell table:style-name="TableRowCell" office:value-type="string">
      <text:p text:style-name="Table_20_Contents">Normal cell (column
      2)</text:p>
    </table:table-cell>
    <table:table-cell table:style-name="TableRowCell" office:value-type="string">
      <text:p text:style-name="Table_20_Contents">Normal cell (column
      3)</text:p>
    </table:table-cell>
  </table:table-row>
  <table:table-row>
    <table:table-cell table:style-name="TableRowCell" office:value-type="string">
      <text:p text:style-name="Table_20_Heading">Normal cell (column
      1)</text:p>
    </table:table-cell>
    <table:table-cell table:style-name="TableRowCell" office:value-type="string">
      <text:p text:style-name="Table_20_Contents">Normal cell (column
      2)</text:p>
    </table:table-cell>
    <table:table-cell table:style-name="TableRowCell" office:value-type="string">
      <text:p text:style-name="Table_20_Contents">Normal cell (column
      3)</text:p>
    </table:table-cell>
  </table:table-row>
</table:table>