Skip to content

Instantly share code, notes, and snippets.

@wallyqs
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wallyqs/9289545 to your computer and use it in GitHub Desktop.
Save wallyqs/9289545 to your computer and use it in GitHub Desktop.

Support for :exports options from code blocks

According to the Org mode docs, it is possible to customize whether the code block will be exported or not.

About the #+RESULTS: block

Using Org Babel features, it is possible to set :results output to a code block and render the results within a #+RESULTS: code block:

puts "Hello world"

One thing about the #+RESULTS: code blocks, is that they exist in several forms:

  1. As an accumulated group of inline examples:
  2. As an example code block. By default, the
    10.times {|n| puts n }
        

  3. Also, in case :results output code is used, the results would be a src block of the same language as the original one.
    counter = 0
    10.times { puts "puts '#{counter += 1}'" } # Displayed in first code block
    puts counter # Displayed in second code block
        

TODO :exports code

Only the code would be in the output, the same as when no option is set.

var message = "Hello world!";

console.log(message);

TODO :exports none

This omits both the resulting block, and the code block itself.

TODO :exports both

As of OrgRuby 0.9.1, this is what has been implemented, so old tests would need to add :exports both to code blocks.

Math::PI

TODO :exports results

This option can’t be supported by OrgRuby since we would have to eval the code block using :lang, so Org Babel features would have to be implemented as well.

Implementation for this is under consideration and leaving as a no-op for now.

3.141592653589793
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment