diff options
| author | Michael Stahl <[email protected]> | 2023-05-01 13:59:29 +0200 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-05-01 20:55:37 -0700 |
| commit | 2881c1274018a31e78ccba647cae4c2764fb5dad (patch) | |
| tree | cd092b13a0a7e31935b6f6fe6956c58d0de2b56a | |
| parent | 013351f6023a6b8b83e9f8c45d8a8fbc6dcd46f1 (diff) | |
Writers.OpenDocument: handle row header column cells as ordinary cells
While ODF 1.3 part 3 does specify a 9.1.11 <table:table-header-columns>
element, in practice it's only implemented by spreadsheet applications,
not word processors.
So simply treat the row header columns as ordinary table columns, at
least they don't get lost then.
Fixes: #8764
| -rw-r--r-- | src/Text/Pandoc/Writers/OpenDocument.hs | 4 | ||||
| -rw-r--r-- | test/command/8764.md | 50 |
2 files changed, 52 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index e844d91f7..fa2750b90 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -516,9 +516,9 @@ tableRowToOpenDocument :: PandocMonad m => WriterOptions -> [Text] -> Ann.BodyRow -> OD m (Doc Text) tableRowToOpenDocument o ns r = - let (Ann.BodyRow _ _ _ c ) = r + let (Ann.BodyRow _ _ rowheaders cs) = r in inTagsIndented "table:table-row" . vcat <$> - mapM (tableItemToOpenDocument o "TableRowCell") (zip ns c) + mapM (tableItemToOpenDocument o "TableRowCell") (zip ns (rowheaders ++ cs)) colspanAttrib :: ColSpan -> [(Text, Text)] colspanAttrib cs = diff --git a/test/command/8764.md b/test/command/8764.md new file mode 100644 index 000000000..e5fe43d25 --- /dev/null +++ b/test/command/8764.md @@ -0,0 +1,50 @@ +``` +% 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_Contents">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_Contents">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> +``` |
