* Bug (or at least a trap) in exporting #+begin_src blocks
@ 2014-02-24 2:01 Giovanni Moretti
2014-02-26 14:08 ` Nicolas Goaziou
0 siblings, 1 reply; 2+ messages in thread
From: Giovanni Moretti @ 2014-02-24 2:01 UTC (permalink / raw)
To: orgmode mailing list
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/moretti G.Moretti@massey.ac.nz
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug (or at least a trap) in exporting #+begin_src blocks
2014-02-24 2:01 Bug (or at least a trap) in exporting #+begin_src blocks Giovanni Moretti
@ 2014-02-26 14:08 ` Nicolas Goaziou
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2014-02-26 14:08 UTC (permalink / raw)
To: Giovanni Moretti; +Cc: orgmode mailing list
Hello,
Giovanni Moretti <g.moretti@massey.ac.nz> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-26 14:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-24 2:01 Bug (or at least a trap) in exporting #+begin_src blocks Giovanni Moretti
2014-02-26 14:08 ` Nicolas Goaziou
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).