emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
@ 2020-03-09 14:42 Steven Delean
  2020-03-11  0:17 ` Jack Kamm
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Delean @ 2020-03-09 14:42 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi,

HTML table produced from a source code block (using R code) does not display
because html code is not formatted correctly in the exported html output. The
source code block uses:

#+begin_src R :results output html :exports both
zd <- data.frame(a = 1:3, b = letters[1:3])
knitr:::kable(zd)
#+end_src

Each line in the html table that is produced is broken mid-line where a >
symbol is replaced with a line feed. The html code that is produced shows that
there is a line feed where there should be a > symbol after the ;" for each th
header tag in the table.

<table>
 <thead>
  <tr>
   <th style="text-align:right;"
a </th>
   <th style="text-align:left;"
b </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:right;"
1 </td>
   <td style="text-align:left;"
a </td>
  </tr>
  <tr>
   <td style="text-align:right;"
2 </td>
   <td style="text-align:left;"
b </td>
  </tr>
  <tr>
   <td style="text-align:right;"
3 </td>
   <td style="text-align:left;"
c </td>
  </tr>
</tbody>
</table>

Thanks for your time,
Best regards,
Steve

Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of
2019-09-17 Package: Org mode version 9.3.6 (9.3.6-23-g01ee25-elpaplus @
/home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
  2020-03-09 14:42 Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)] Steven Delean
@ 2020-03-11  0:17 ` Jack Kamm
  2020-03-11  3:07   ` Steven Delean
  0 siblings, 1 reply; 5+ messages in thread
From: Jack Kamm @ 2020-03-11  0:17 UTC (permalink / raw)
  To: Steven Delean, emacs-orgmode@gnu.org

Hi Steve,

Steven Delean <steven.delean@adelaide.edu.au> writes:

> HTML table produced from a source code block (using R code) does not display
> because html code is not formatted correctly in the exported html output.

I believe this is the same issue as reported here:
https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00267.html

Though, that thread was for ":session" blocks, and it's unclear whether
you're using session or non-session evaluation here.

Anyways, that thread suggests that ":results value html" works
correctly, does switching to that work for you?

If I'm correct, the basic problem is that ob-R tries to remove
interactive shell prompts like ">" from the output. This can also cause
other problems. I think it can be fixed by changing ob-R to use
`ess-eval-region' to evaluate code, I'll try to submit a patch for this
after 9.4 is released.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
  2020-03-11  0:17 ` Jack Kamm
@ 2020-03-11  3:07   ` Steven Delean
  2020-03-12  1:16     ` Steven Delean
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Delean @ 2020-03-11  3:07 UTC (permalink / raw)
  To: Jack Kamm; +Cc: Steven Delean, emacs-orgmode@gnu.org

Hi Jack,

Thanks for your response.

Yes, I am using :session evaluation here, set using #+PROPERTY:

However, ":results value html" does not work for me. In fact, this produces no
table output at all in the resulting exported html file.

The output sent to the R :session buffer is printed correctly (when using
either :results value html or :results output html). As you say, it is the
exporter that is removing ">" from the output.

If I remove :session evaluation, I also get no output at all from these code
blocks in the exported html.

The change has been introduced within the last 12 months, as my scripts
exported with correct html formatting when I used them for last years' classes.

Best regards,
Steve

On Tue, 10 Mar 2020 17:17:48 -0700
Jack Kamm <jackkamm@gmail.com> wrote:

> Hi Steve,
>
> Steven Delean <steven.delean@adelaide.edu.au> writes:
>
> > HTML table produced from a source code block (using R code) does not display
> > because html code is not formatted correctly in the exported html output.
>
> I believe this is the same issue as reported here:
> https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00267.html
>
> Though, that thread was for ":session" blocks, and it's unclear whether
> you're using session or non-session evaluation here.
>
> Anyways, that thread suggests that ":results value html" works
> correctly, does switching to that work for you?
>
> If I'm correct, the basic problem is that ob-R tries to remove
> interactive shell prompts like ">" from the output. This can also cause
> other problems. I think it can be fixed by changing ob-R to use
> `ess-eval-region' to evaluate code, I'll try to submit a patch for this
> after 9.4 is released.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
  2020-03-11  3:07   ` Steven Delean
@ 2020-03-12  1:16     ` Steven Delean
  2020-11-01 19:02       ` Jack Kamm
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Delean @ 2020-03-12  1:16 UTC (permalink / raw)
  To: Steven Delean; +Cc: Jack Kamm, emacs-orgmode@gnu.org

Hello again Jack,

I am trying to use ob-session-async as a workaround for this problem.

In my R :session, the correct output is printed to screen, followed by a UUID if
I use :results output html, which is printed as, e.g.,
[1] "ob_comint_async_R_end_4d2e818b7c2544da6f026d0413c7ac6c"

Alternatively, if I use :results value html then the tempfile path is printed
as:
[1] "ob_comint_async_R_file_/tmp/babel-6BGHQK/R-QNasco"

The problem, however, is that what is exported to html and displayed in the
exported block is either the actual UUID or the tempfile path and not the
results from evaluating the R code. In the case of the tempfile, the tempfile
exists but is empty.

Any advice as to how to resolve this would be greatly appreciated, thanks.

Best regards,
Steve

On Wed, 11 Mar 2020 13:37:01 +1030
Steven Delean <steven.delean@adelaide.edu.au> wrote:

> Hi Jack,
>
> Thanks for your response.
>
> Yes, I am using :session evaluation here, set using #+PROPERTY:
>
> However, ":results value html" does not work for me. In fact, this produces no
> table output at all in the resulting exported html file.
>
> The output sent to the R :session buffer is printed correctly (when using
> either :results value html or :results output html). As you say, it is the
> exporter that is removing ">" from the output.
>
> If I remove :session evaluation, I also get no output at all from these code
> blocks in the exported html.
>
> The change has been introduced within the last 12 months, as my scripts
> exported with correct html formatting when I used them for last years'
> classes.
>
> Best regards,
> Steve
>
> On Tue, 10 Mar 2020 17:17:48 -0700
> Jack Kamm <jackkamm@gmail.com> wrote:
>
> > Hi Steve,
> >
> > Steven Delean <steven.delean@adelaide.edu.au> writes:
> >
> > > HTML table produced from a source code block (using R code) does not
> > > display because html code is not formatted correctly in the exported html
> > > output.
> >
> > I believe this is the same issue as reported here:
> > https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00267.html
> >
> > Though, that thread was for ":session" blocks, and it's unclear whether
> > you're using session or non-session evaluation here.
> >
> > Anyways, that thread suggests that ":results value html" works
> > correctly, does switching to that work for you?
> >
> > If I'm correct, the basic problem is that ob-R tries to remove
> > interactive shell prompts like ">" from the output. This can also cause
> > other problems. I think it can be fixed by changing ob-R to use
> > `ess-eval-region' to evaluate code, I'll try to submit a patch for this
> > after 9.4 is released.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
  2020-03-12  1:16     ` Steven Delean
@ 2020-11-01 19:02       ` Jack Kamm
  0 siblings, 0 replies; 5+ messages in thread
From: Jack Kamm @ 2020-11-01 19:02 UTC (permalink / raw)
  To: Steven Delean, Steven Delean; +Cc: emacs-orgmode@gnu.org

Hi Steven,

Sorry for the delayed response.

> The problem, however, is that what is exported to html and displayed in the
> exported block is either the actual UUID or the tempfile path and not the
> results from evaluating the R code. In the case of the tempfile, the tempfile
> exists but is empty.

Yes, async doesn't work well with export. I think it would be very
challenging to make it work correctly.

For my recent patch to add this functionality into org-mode [0], my
workaround was to simply disable async evaluation during export.

[0] https://orgmode.org/list/87h7qi2l2m.fsf@gmail.com/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-01 19:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 14:42 Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)] Steven Delean
2020-03-11  0:17 ` Jack Kamm
2020-03-11  3:07   ` Steven Delean
2020-03-12  1:16     ` Steven Delean
2020-11-01 19:02       ` Jack Kamm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).