* Extraneous blank lines in when attempting to export org tables
@ 2024-02-18 3:36 Rohit Patnaik
2024-02-18 16:33 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: Rohit Patnaik @ 2024-02-18 3:36 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Extraneous blank lines in when attempting to export org tables
2024-02-18 3:36 Extraneous blank lines in when attempting to export org tables Rohit Patnaik
@ 2024-02-18 16:33 ` Ihor Radchenko
2024-02-19 3:37 ` Rohit Patnaik
0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-02-18 16:33 UTC (permalink / raw)
To: Rohit Patnaik; +Cc: emacs-orgmode
"Rohit Patnaik" <quanticle@quanticle.net> writes:
> 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.
> ...
> 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?
This is because ox-md adds a blank line between almost every element,
including table-rows (which ox-md does not care about).
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=85aafac41
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Extraneous blank lines in when attempting to export org tables
2024-02-18 16:33 ` Ihor Radchenko
@ 2024-02-19 3:37 ` Rohit Patnaik
0 siblings, 0 replies; 3+ messages in thread
From: Rohit Patnaik @ 2024-02-19 3:37 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
> This is because ox-md adds a blank line between almost every element,
> including table-rows (which ox-md does not care about).
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=85aafac41
Thanks for fixing this. I completely forgot that my export code is a derived
backend from ox-md. Maybe, I should make it a standalone backend (or derive
directly from ox-html, like ox-md does), to avoid further mysterious issues.
Rohit
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-19 3:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-18 3:36 Extraneous blank lines in when attempting to export org tables Rohit Patnaik
2024-02-18 16:33 ` Ihor Radchenko
2024-02-19 3:37 ` Rohit Patnaik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.