diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-08-26 08:41:05 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-08-26 08:41:05 -0700 |
| commit | 812ef0484d27e43a7f83986d7eb6a2f15c8421af (patch) | |
| tree | abf82757df0da714f50b4f7e248d2c44db07cb0b /src | |
| parent | 73211ee02b3f03d8f27ec9369d05efb80ddc3381 (diff) | |
Docx writer: better handling of tables in lists (#5947).
Previously the content of each list cell was indented when
the table belonged to a list item. This is obviously unwanted.
With this patch, a table inside a list item will be formatted
just like a table outside the list.
One desirable improvement would be to add some left indentation
to the entire table, so it visually appears to belong to the
list item. But I'm not sure how to do that.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 7b4a056b6..c596113a4 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -934,7 +934,10 @@ blockToOpenXML' _ HorizontalRule = do ("o:hralign","center"), ("o:hrstd","t"),("o:hr","t")] () ] blockToOpenXML' opts (Table attr caption colspecs thead tbodies tfoot) = do - content <- tableToOpenXML opts + -- Remove extra paragraph indentation due to list items (#5947). + -- This means that tables in lists will not be indented, but it + -- avoids unwanted indentation in each cell. + content <- local (\env -> env{ envListLevel = - 1 }) $ tableToOpenXML opts (blocksToOpenXML opts) (Grid.toTable attr caption colspecs thead tbodies tfoot) let (tableId, _, _) = attr |
