Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docx writer can generate fatal "Encountered unassigned table cell" error #9096

Open
wlupton opened this issue Sep 22, 2023 · 0 comments
Open
Labels

Comments

@wlupton
Copy link
Contributor

wlupton commented Sep 22, 2023

If a table contains an undefined cell then the Docx writer can generate a fatal "Encountered unassigned table cell" error (in which case no output is generated).

Such a table is invalid, and probably couldn't usually be created, but can be created due to a bug in a filter, e.g., the pandoc-ext/list-table filter can generate such tables (I've created pandoc-ext/list-table#2 to fix this).

However, I think that one can argue that writers should be able to handle such malformed input. The HTML writer can, but the Docx writer only seems to be able to handle it when the missing cell is in the first row.

With this markdown:

This has an unassigned table cell but doesn't trigger a docx writer error.

::: list-table
* - A
  - B

* - 1
:::

But this does.

::: list-table
* - A
  - B

* - 1
  - 2

* - 3
:::

...the default HTML writer creates empty cells for any missing ones:

% pandoc-3.1.8 -L list-table.lua list-table-bug.md 
<p>This has an unassigned table cell but doesn’t trigger a docx writer
error.</p>
<table>
<thead>
<tr class="header">
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td></td>                            <!-- added empty cell ->
</tr>
</tbody>
</table>
...

...but the Docx writer doesn't (in fact it seems to if the empty cell is in the first row, but not if it's in the second):

% pandoc-3.1.8 -L list-table.lua list-table-bug.md -o list-table-bug.docx
Encountered unassigned table cell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant