Re: [O] Bug (or at least a trap) in exporting #+begin_src blocks

2014-02-26 Thread Nicolas Goaziou
Hello,

Giovanni Moretti  writes:

> Could I ask that an error message be generated for this?

The problem is that is a valid Org syntax (though different than the one
you expect), so it isn't an error /per se/. So, the parser will not
generate an error for this.

> While not strictly a bug, it's an insidious trap given that the
> in-buffer expansion (C-c C-c) runs and inserts the results as
> expected.

I hope that, one day, Babel will rely on the same parser as the export
framework. Until then, (minor) discrepancies are to be expected.


Regards,

-- 
Nicolas Goaziou



[O] Bug (or at least a trap) in exporting #+begin_src blocks

2014-02-23 Thread Giovanni Moretti
I've just solved a puzzle finding out why Python src blocks that exported 
happily last year don't now. I'm using them for class tutorials and a of about 
fifteen Python fragments, a couple of the blocks would expand in-situ (C-c C-c) 
but when exported were treated as normal text.


I narrowed it down using the following file
==
#+options: num:nil toc:nil
** Try 1

#+BEGIN_SRC python :results output :exports both
print "hi"
#+END_SRC

#+RESULTS:
: hi

** Try 2

#+BEGIN_SRC python :results output :exports both
print "Fred"
#+END_SRC python

#+RESULTS:
: Fred


Both of the src blocks can be isolated and edited in its own buffer using 
org-babel-expand-src-block - C-c C-v C-v) and both get run correctly if you C-c 
C-c inside them, as shown by the #+RESULTS blocks, however on export, the second 
one is treated as normal text .


Puzzlingly, a hex-dump showed the #+BEGIN_SRC lines were identical - then I 
noticed that the #+END line was wrong. I'd written "#+END_SRC python" instead of 
just "#+END_SRC".


It seems like the parser for the src blocks is now stricter that it was last 
year.

Could I ask that an error message be generated for this? While not strictly a 
bug, it's an insidious trap given that the in-buffer expansion (C-c C-c) runs 
and inserts the results  as expected.


I've also had similar problems with

#+BEGIN_SRC python :output results :exports both
print "hi"
#+END_SRC

which looks ok, and the ":output results" makes sense when you read it, but 
should be ":results output". From memory, this also worked in-buffer but would 
silently fail on export.


Orgmode + Babel is excellent for writing Python tutorial worksheets - so thank 
you - your work is much appreciated.


Cheers
Giovanni
--

==
Dr Giovanni Moretti | School of Engineering and Advanced Technology
Senior Lecturer | Massey University, Palmerston North, New Zealand
Computer Science| Ph +64-6-3505799x84134 Fax +64-6-3502259 - ZL2GX
==
http://seat.massey.ac.nz/morettig.more...@massey.ac.nz