[Top][All Lists]

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

Re: [O] Using property values in source code blocks

From: Joon Ro
Subject: Re: [O] Using property values in source code blocks
Date: Sat, 16 Jul 2016 12:00:29 -0500

> I do not see an easy way to do what you want only with tangle.
> There are hooks you can define that might enable you to set things up.
> Maybe you can use `org-babel-pre-tangle-hook' to collect the property
> values and put them somewhere that `org-babel-post-tangle-hook' can get at
> them and use them to modify the tangled results accordingly. Or maybe
> `org-babel-post-tangle-hook' can do it by using methods like those in
> `org-babel-detangle' to look back at the *.org file.
> Another alternative is to write all of your code blocks so they will
> execute to create the code you want as results and then tangle those
> results. You would use :wrap like this:
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_SRC shell :noweb yes :wrap "src shell :tangle ./tangle-test.sh"
> echo "echo " <<get-property(prop="DUMMY",pom=(point))>>
> --8<---------------cut here---------------end--------------->8---
> Execute the src block and then tangle the buffer.
> In fact, if you go that route it might make more sense to write elisp
> code blocks to find the prpoerty values and then format the results.

I see - thank you so much for your help. It does look like I have to write some code to do this.

Since I'm not that familiar with elisp, I think I will write a Python code block which has the template as a multi-line string, and then just pass values as arguments to the source code block to generate the shell scripts.


reply via email to

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