Domanda

When noweb reference in org-mode 's source code block is expanded, ever the content of the reference consists of only one line, it will expand the reference with an surplus line. This is an example:

The source block is :

 #+srcname: test
 #+begin_src sh
 hello
 #+end_src

 #+begin_src sh :tangle ~/tmp/1.sh
 echo "<<test>>, world!"
 #+end_src

and the block's expand result is:

 echo "hello
 echo ", world!"

How can I modify OR setup, so that I can get the expand result like this:

 echo "hello, world!"

Answer: see the comment.

È stato utile?

Soluzione

Which version of org-mode are you using?

I'm not sure why you are getting the newline added, but your example, as given, does not work because you are missing the :noweb yes header argument. I have this code:

testing

#+srcname: test                                                                 
#+begin_src sh                                                                  
hello                                                                           
#+end_src                                                                       

#+begin_src sh :tangle ~/tmp/1.sh :noweb yes                                    
echo "<<test>>, world!"                                                         
#+end_src

When I run org-babel-tangle (bound to C-c C-v C-t), I get this:

tmp$ cat 1.sh 

echo "hello, world!"

I'm using org-mode version: 7.7 (release_7.7.303.g56de2c.dirty)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top