emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leo Alekseyev <dnquark@gmail.com>
To: Emacs orgmode <emacs-orgmode@gnu.org>
Subject: [bugs] Export to HTML requires issuing org-babel-execute-buffer; results replace fails
Date: Fri, 20 Jan 2012 18:25:57 -0600	[thread overview]
Message-ID: <CADzxs1nn090FzUFe-bYFBXx-Uj-fRW2gmg8KktFKbxRhDCYFjw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]

Since all source blocks are evaluated on export, I don't think it
should be necessary to issue org-babel-execute-buffer before invoking
export.  However, running HTML export without org-babel-execute-buffer
currently produces garbage output.

On the other hand, I have several examples where running HTML export
_after_ org-babel-execute-buffer produces the wrong output due to the
fact that :results replace directive appears to append instead of
replacing the output

I am attaching three simple examples where I simulate generating and
exporting image data (I just generate and print filenames).  If I
understand the documentation correctly, they are all supposed to
produce identical output on HTML export; however, none of the files
produces the expected output, namely, blocks of the form:

----
| some output
| images/conv1.png
|
| images/conv1.png
\--

Here, the first two lines should be enclosed in a code block, and the
last line should be raw org output.

To reproduce, load any of my examples, do

C-c C-e h <- will produce garbage output on export
C-c C-v b <- will produce expected output in the buffer
C-c C-e h <- will produce extraneous output on export despite :results
replace being on
C-c C-v b <- will produce extraneous output in the buffer

This was tested on my test-export4.org, but the other examples behave
in a similar fashion.

--Leo

[-- Attachment #2: test-export4.org --]
[-- Type: application/octet-stream, Size: 843 bytes --]

#+property: session *R-babel*

* export fail

#+NAME: foo
#+HEADER: :var idx=1 :var print="TRUE" :var plot.filename="conv1.png" :var plot.disp="FALSE"
#+BEGIN_SRC R :results output silent
  if (print == TRUE) {cat("some output\n")}
  
  img.dir = "images"
  cat.fname.link <- function() { cat(img.dir,"/",plot.filename,"\n",sep="") } 
  cat.fname.link() 
#+END_SRC

Should have all conv1 stuff

#+call: foo(idx=1,print="TRUE",plot.filename="conv1.png",plot.disp="FALSE")

src_R[:results output replace]{ cat.fname.link() } 

Should have all conv2 stuff 

#+call: foo(idx=8,print="TRUE",plot.filename="conv2.png",plot.disp="FALSE")

src_R[:results output replace]{ cat.fname.link() } 

Should have all conv3 stuff
#+call: foo(idx=1,print="TRUE",plot.filename="conv3.png",plot.disp="FALSE")

src_R[:results output replace]{ cat.fname.link() } 


[-- Attachment #3: test-export5.org --]
[-- Type: application/octet-stream, Size: 953 bytes --]

#+property: session *R-babel*

* export fail

#+NAME: foo
#+HEADER: :var idx=1 :var print="TRUE" :var plot.filename="conv1.png" :var plot.disp="FALSE"
#+BEGIN_SRC R :results output silent
  if (print == TRUE) {cat("some output\n")}
  
  img.dir = "images"
  cat.fname.link <- function() { cat(img.dir,"/",plot.filename,"\n",sep="") } 
  cat.fname.link() 
#+END_SRC

Should have all conv1 stuff

#+call: foo(idx=1,print="TRUE",plot.filename="conv1.png",plot.disp="FALSE")

#+begin_src R :results output raw replace :exports results
 cat.fname.link() 
#+end_src

Should have all conv2 stuff 

#+call: foo(idx=8,print="TRUE",plot.filename="conv2.png",plot.disp="FALSE")

#+begin_src R :results output raw replace :exports results
 cat.fname.link() 
#+end_src

Should have all conv3 stuff

#+call: foo(idx=1,print="TRUE",plot.filename="conv3.png",plot.disp="FALSE")

#+begin_src R :results output raw replace :exports results
 cat.fname.link() 
#+end_src



[-- Attachment #4: test-export7.org --]
[-- Type: application/octet-stream, Size: 885 bytes --]

#+property: session *R-babel*

* export fail

#+NAME: foo
#+HEADER: :var idx=1 :var print="TRUE" :var plot.filename="conv1.png" :var plot.disp="FALSE"
#+BEGIN_SRC R :results output silent
  if (print == TRUE) {cat("some output\n")}
  
  img.dir = "images"
  cat.fname.link <- function() { cat(img.dir,"/",plot.filename,"\n",sep="") } 
  cat.fname.link() 
#+END_SRC

#+NAME: bar
#+begin_src R :results output raw replace :exports none
 cat.fname.link() 
#+end_src


Should have all conv1 stuff

#+call: foo(idx=1,print="TRUE",plot.filename="conv1.png",plot.disp="FALSE")

#+call: bar[:exports results]()

Should have all conv2 stuff 

#+call: foo(idx=8,print="TRUE",plot.filename="conv2.png",plot.disp="FALSE")

#+call: bar[:exports results]()

Should have all conv3 stuff

#+call: foo(idx=1,print="TRUE",plot.filename="conv3.png",plot.disp="FALSE")

#+call: bar[:exports results]()




             reply	other threads:[~2012-01-21  0:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21  0:25 Leo Alekseyev [this message]
2012-01-23 17:58 ` [bugs] Export to HTML requires issuing org-babel-execute-buffer; results replace fails Eric Schulte
2012-01-24  3:50   ` Leo Alekseyev
2012-01-24  4:05     ` Eric Schulte
2012-01-24  4:53       ` Leo Alekseyev
2012-01-24 14:52         ` Eric Schulte
2012-01-24 23:35           ` Leo Alekseyev
2012-01-27 22:43             ` Eric Schulte
2012-01-28 23:07               ` Leo Alekseyev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADzxs1nn090FzUFe-bYFBXx-Uj-fRW2gmg8KktFKbxRhDCYFjw@mail.gmail.com \
    --to=dnquark@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).