[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Extraneous blank lines in when attempting to export org tables
From: |
Rohit Patnaik |
Subject: |
Extraneous blank lines in when attempting to export org tables |
Date: |
Sat, 17 Feb 2024 21:36:10 -0600 |
User-agent: |
Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 |
Hello,
I'm currently working on an exporter that will allow org-mode to export to
PMWiki markdown (https://github.com/quanticle/ox-pmwiki/), and I'm running into
a problem when writing the export code to handle tables. When exporting table
rows, I'm getting extraneous blank lines between table rows.
My export code for tables is as follows:
#+begin_src elisp
(defun org-pmwiki-table-cell (table-cell contents info)
"Transcode a TABLE-CELL from org to pmwiki format. CONTENTS is nil. INFO is a
plist used as a communications channel."
(let ((cell-alignment (org-export-table-cell-alignment table-cell info)))
(cond ((eq cell-alignment 'left) (format "%s ||" contents))
((eq cell-alignment 'right) (format " %s||" contents))
((eq cell-alignment 'center) (format " %s ||" contents)))))
(defun org-pmwiki-table-row (table-row contents info)
"Transcode a TABLE-ROW element from org to pmwiki format. CONTENTS is the
contents of the row. INFO is a plist used as a communications channel."
(format "||%s" contents))
(defun org-pmwiki-table (table contents info)
"Transcode a TABLE from org to pmwiki format. TABLE is the table element
itself. CONTENTS is the contents of the table. INFO is a plist holding
contextual information."
contents)
#+end_src
When I run this code on the following table:
#+begin_src org
| Col 1 | Col 2 | Col 3 |
| <l> | <c> | <r> |
| left aligned cell | centered cell | right aligned cell |
#+end_src
I expect to see the following output:
#+begin_example
||Col 1 || Col 2 || Col 3||
||left aligned cell || centered cell || right aligned cell||
#+end_example
However, the actual output generated by the code is:
#+begin_example
||Col 1 || Col 2 || Col 3||
||left aligned cell || centered cell || right aligned cell||
#+end_example
The contents of each cell are formatted correctly, but there's an additional
newline between the two rows. How do I prevent this newline from being added?
Thanks,
Rohit Patnaik
- Extraneous blank lines in when attempting to export org tables,
Rohit Patnaik <=