emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Calling a source block with raw results


From: Xavier Garrido
Subject: [O] Calling a source block with raw results
Date: Sun, 04 Jan 2015 20:56:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

Dear Orgers,

The following shell function lists the files within a directory and for each file, write a org piece of code to include it.

#+NAME: org-figure-to-slide
#+HEADERS: :var title="Empty title"
#+HEADERS: :var dir="./figures" :var ext="*.pdf"
#+HEADERS: :var options=""
#+BEGIN_SRC sh
  if [ ! -d ${dir} ]; then
      echo "${dir} is not a directory !"
      exit 1
  fi
  for i in ${dir}/${ext}; do
      echo "* ${title}"
      if [ "${options}" != "" ]; then
          echo ":PROPERTIES:"
          echo ${options}
          echo ":END:"
      fi
      echo "#+BEGIN_CENTER"
      echo "#+ATTR_LATEX: :width \linewidth"
      echo "[[file:${i}]]"
      echo "#+END_CENTER"
  done
#+END_SRC

The basic use of such function is for a beamer presentation, each headline corresponds to a figure.

Since I am explicitly writing all the org code, I would like to call the function and gets a *raw* results by doing

#+CALL: org-figure-to-slide[:exports none :results raw]()

The problem is when executing the call line, the result is always embeds between #+begin_example/#+end_example code block given something like

 #+RESULTS:
#+begin_example
* Empty title
#+BEGIN_CENTER
#+ATTR_LATEX: :width \linewidth
[[file:./figures/timeline0.pdf]]
#+END_CENTER
* Empty title
#+BEGIN_CENTER
#+ATTR_LATEX: :width \linewidth
[[file:./figures/timeline1.pdf]]
#+END_CENTER
#+end_example

I want to remove the #+begin_example/#+end_example but I do not find any header arguments that achieve that (I have tested almost all of them). Moreover when I read =ob-core= code I do not understand why the function =org-babel-examplify-region= (responsible for the add of example block) is called since I set a raw results.

The only (bad) way I have found is to set the variable =org-babel-min-lines-for-block-output= to nil but then I get big troubles when exporting the result.

Can someone give some advice on how to get a pure raw results from a source block ?

Thanks a lot for your help,
Xavier



reply via email to

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