Org writer: remove extra spaces from table cells

Closes: #6024
This commit is contained in:
Albert Krewinkel 2020-01-02 23:59:11 +01:00
parent 2c1a911bc1
commit c3a00c1fdc
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 30 additions and 30 deletions

View file

@ -195,7 +195,7 @@ blockToOrg (Table caption' _ _ headers rows) = do
let numChars = maximum . map offset
-- FIXME: width is not being used.
let widthsInChars =
map ((+2) . numChars) $ transpose (headers' : rawRows)
map numChars $ transpose (headers' : rawRows)
-- FIXME: Org doesn't allow blocks with height more than 1.
let hpipeBlocks blocks = hcat [beg, middle, end]
where sep' = vfill " | "

View file

@ -1,51 +1,51 @@
Simple table with caption:
| Right | Left | Center | Default |
|---------+--------+----------+-----------|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
| Right | Left | Center | Default |
|-------+------+--------+---------|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
#+CAPTION: Demonstration of simple table syntax.
Simple table without caption:
| Right | Left | Center | Default |
|---------+--------+----------+-----------|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
| Right | Left | Center | Default |
|-------+------+--------+---------|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
Simple table indented two spaces:
| Right | Left | Center | Default |
|---------+--------+----------+-----------|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
| Right | Left | Center | Default |
|-------+------+--------+---------|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
#+CAPTION: Demonstration of simple table syntax.
Multiline table with caption:
| Centered Header | Left Aligned | Right Aligned | Default aligned |
|-------------------+----------------+-----------------+---------------------------------------------------------|
| First | row | 12.0 | Example of a row that spans multiple lines. |
| Second | row | 5.0 | Here's another one. Note the blank line between rows. |
| Centered Header | Left Aligned | Right Aligned | Default aligned |
|-----------------+--------------+---------------+-------------------------------------------------------|
| First | row | 12.0 | Example of a row that spans multiple lines. |
| Second | row | 5.0 | Here's another one. Note the blank line between rows. |
#+CAPTION: Here's the caption. It may span multiple lines.
Multiline table without caption:
| Centered Header | Left Aligned | Right Aligned | Default aligned |
|-------------------+----------------+-----------------+---------------------------------------------------------|
| First | row | 12.0 | Example of a row that spans multiple lines. |
| Second | row | 5.0 | Here's another one. Note the blank line between rows. |
| Centered Header | Left Aligned | Right Aligned | Default aligned |
|-----------------+--------------+---------------+-------------------------------------------------------|
| First | row | 12.0 | Example of a row that spans multiple lines. |
| Second | row | 5.0 | Here's another one. Note the blank line between rows. |
Table without column headers:
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
Multiline table without column headers:
| First | row | 12.0 | Example of a row that spans multiple lines. |
| Second | row | 5.0 | Here's another one. Note the blank line between rows. |
| First | row | 12.0 | Example of a row that spans multiple lines. |
| Second | row | 5.0 | Here's another one. Note the blank line between rows. |