Reputation:
I have this in my org-mode file:
This is how we define a function:
#+BEGIN_SRC ruby :tangle hello.rb
def hello
puts 'Hello world!'
end
#+END_SRC
And this is how we call it:
#+BEGIN_SRC ruby :tangle hello.rb
hello
#+END_SRC
However, when I use org-babel-tangle
it appears like this in the file:
[blank line]
def hello
puts 'Hello world!'
end
[blank line]
hello
[blank line]
How do I get it so all the blank lines do not appear?
Upvotes: 1
Views: 1976
Reputation:
The way to suppress the extra blank lines that appear around the exported source code is to use the header argument padline
. Set it to no
and it will not add blank lines.
With the above example, you would do this:
This is how we define a function:
#+BEGIN_SRC ruby :padline no :tangle hello.rb
def hello
puts 'Hello world!'
end
#+END_SRC
And this is how we call it:
#+BEGIN_SRC ruby :padline no :tangle hello.rb
hello
#+END_SRC
If you are within a heading, you can use the #+PROPERTY
setting to set this up for all source code blocks within the buffer or for just the sub-heading with the following:
* My Section
:PROPERTIES:
:header-args: :padline no :tangle hello.rb
:END
Upvotes: 3