Aloha David,

David Dynerman <da...@block-party.net> writes:

> Hi all,
>
> I’m trying to accomplish the following:
>
> 1) I have an org-babel python block in my code that produces a figure file
> 2) I’d like to include the resulting figure HTML export of my org file
> 3) The code takes a bit to run, so I don’t want to execute the code
> block during each HTML export
>
> What I have so far:
>
> #+NAME: my_python_function
> #+HEADER: :var some python vars
> #+BEGIN_SRC python :results value file
>   my python code
> #+END_SRC
> #+CALL: my_python_function(some python vars=values) :results value file 
> :exports results
> #+CAPTION: Here is a figure
> #+LABEL: fig:an_amazing_figure
> #+ATTR_HTML: :height 200em
> #+RESULTS:
> [[file:output_file]]
>
> This block works when I export to HTML (e.g. the code runs, and the
> figure is placed in the appropriate figure with the appropriate
> caption).
>
> Question: How can I modify this so that the code is only executed when
> I run C-c C-c on the +CALL line, but still have the figure in the
> exported HTML?
>
> I tried adding :eval no-export to the code and to the +CALL line, but
> then the resulting HTML doesn’t contain the figure (it outputs “nil”,
> presumably because the CALL line is trying to call it, but the code is
> refusing to run because of the no-export line)

You can set :cache yes, which can be used to avoid re-evaluating
unchanged code blocks.

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

Reply via email to