emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Code block evaluation export bug ?


From: Nick Dokos
Subject: Re: [O] Code block evaluation export bug ?
Date: Wed, 09 Nov 2011 16:55:43 -0500

Eric Schulte <address@hidden> wrote:

> I turns out the problem here is that the table was being parsed for
> column headers twice, so the top two rows were both being taken as
> column headers.  I've just pushed up a fix.
> 

Works fine - thanks!

> Best -- Eric
> 
> Nick Dokos <address@hidden> writes:
> 
> > Thomas S. Dye <address@hidden> wrote:
> >
> >> Nick Dokos <address@hidden> writes:
> >> 
> >> > While testing my response to Viktor's question, I ran into a problem.
> >> > I used a test file that is slightly modified from a previous post of Tom 
> >> > Dye's:
> >> >
> >> > * R tables
> >> >
> >> > #+TBLNAME: tbl-1
> >> > | column1 | column2 |
> >> > |---------+---------|
> >> > |      45 |      34 |
> >> > |      77 |      56 |
> >> >
> >> > #+tblname: tbl-2
> >> > | col1 | col2 |
> >> > |------+------|
> >> > | a    | b    |
> >> > | c    | d    |
> >> >
> >> > #+tblname: tbl-3
> >> > | c1 | c2 |
> >> > |----+----|
> >> > | A  | B  |
> >> > | C  | D  |
> >> >
> >> > #+BEGIN_SRC R :var x=tbl-1 :var y=tbl-2 :var z=tbl-3 :colnames yes 
> >> > :exports both :results value
> >> > z
> >> > #+END_SRC
> >> >
> >> >
> >> >
> >> > Evaluating the code block correctly produces the result
> >> >
> >> > ,----
> >> > | 
> >> > | #+results:
> >> > | | c1 | c2 |
> >> > | |----+----|
> >> > | | A  | B  |
> >> > | | C  | D  |
> >> > `----
> >> >
> >> > but exporting (to ascii, PDF, HTML or ODT) chops off the first row of
> >> > the result. For example, here
> >> > is the ascii:
> >> >
> >> > ,----
> >> > | 
> >> > |   c1   c2  
> >> > |  ----+----
> >> > |   C    D   
> >> > `----
> >> > ...
> >> 
> >> Aloha Nick,
> >> 
> >> I see the same behavior.
> >> 
> >
> > Here's a progress report on this: the call chain is
> >
> > ,----
> > | 
> > |   org-babel-process-params(((:comments . "") (:shebang . "") (:cache
> > | . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports
> > | . "both") (:results . "replace value") (:var x (45 34) (77 56))
> > | (:var y ("a" "b") ("c" "d")) (:var z ("A" "B") ("C" "D")) (:session
> > | . "none") (:rowname-names) (:result-type . value) (:result-params
> > | "replace" "value") (:padnewline . "yes") (:hlines . "no") (:colnames
> > | . "yes") (:colname-names (x "column1" "column2") (y "col1" "col2")
> > | (z "c1" "c2"))))
> > |   ...    
> > |   (org-babel-exp-in-export-file lang (org-babel-process-params 
> > (org-babel-merge-params (nth 2 info) (\` ((:results \, (if silent "silent" 
> > "replace")))))))
> > |   ...                  
> > |   org-babel-exp-results(("R" "z" ((:cache . "no") (:colname-names (x
> > | "column1" "column2") (y "col1" "col2") (z "c1" "c2")) (:colnames
> > | . "yes") (:comments . "") (:exports . "both") (:hlines . "no")
> > | (:noweb . "no") (:padline . "") (:padnewline . "yes")
> > | (:result-params "replace" "value") (:result-type . value) (:results
> > | . "replace value") (:rowname-names) (:session . "none") (:shebang
> > | . "") (:tangle . "no") (:var x (45 34) (77 56)) (:var y ("a" "b")
> > | ("c" "d")) (:var z ("A" "B") ("C" "D"))) "" nil 0) block nil
> > | "6443d36b0252c9e3192f813429018760bee3c11d")
> > |   ...                      
> > |   org-babel-exp-do-export(("R" "z" ((:cache . "no") (:colname-names
> > | (x "column1" "column2") (y "col1" "col2") (z "c1" "c2")) (:colnames
> > | . "yes") (:comments . "") (:exports . "both") (:hlines . "no")
> > | (:noweb . "no") (:padline . "") (:padnewline . "yes")
> > | (:result-params "replace" "value") (:result-type . value) (:results
> > | . "replace value") (:rowname-names) (:session . "none") (:shebang
> > | . "") (:tangle . "no") (:var x (45 34) (77 56)) (:var y ("a" "b")
> > | ("c" "d")) (:var z ("A" "B") ("C" "D"))) "" nil 0) block
> > | "6443d36b0252c9e3192f813429018760bee3c11d")
> > |   
> > |   org-babel-exp-src-block(...)
> > |                                             
> > |   org-export-blocks-preprocess()
> > |   ...            
> > |   org-export-preprocess-string(...)
> > |   ...    
> > |   org-export-as-ascii(nil nil nil "*Org ASCII Export*")
> > |   org-export-as-ascii-to-buffer(nil)
> > |   ...
> > |   org-export(nil)
> > `----
> >
> > So far, so good: x, y and z are still 2x2 tables. But evaluating the last 
> > form, we get
> >
> > ((:var x (77 56)) (:var y ("c" "d")) (:var z ("C" "D"))
> > (:colname-names (x "column1" "column2") (y "col1" "col2") (z "c1"
> > "c2")) (:rowname-names) (:result-params "replace" "value" "replace"
> > "value") (:result-type . value) (:comments . "") (:shebang . "")
> > (:cache . "no") (:padline . "") (:noweb . "no") ...)
> >
> > The first row of each table has disappeared. Looks like a problem with 
> > org-babel-process-params.
> > Eric, can you take a look?
> >
> > Thanks,
> > Nick
> >
> 
> -- 
> Eric Schulte
> http://cs.unm.edu/~eschulte/
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]