[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] [babel] References to variable block names
From: |
Francesco Pizzolante |
Subject: |
Re: [Orgmode] [babel] References to variable block names |
Date: |
Thu, 13 Jan 2011 09:33:22 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt) |
Dear Eric,
Thanks for your answer.
> In your example the cv source block only seems to have a single variable
> specified with a :var header argument (namely v-jobtitle), e.g.
>
> #+srcname: cv
> #+begin_src latex :noweb yes :var v-jobtitle="Software Engineer"
> ...
> #+end_src
>
> however your example noweb reference uses 4 variables. You will need to
> update the cv source block so that each variable is given a header
> argument.
>
> #+srcname: cv
> #+headers: :var v-firstname="Alex" :var v-familyname="Pizzo"
> #+headers: :var v-jobtitle="Project Manager" :var employee="alex"
> #+begin_src latex :noweb yes :var v-jobtitle="Software Engineer"
> ...
> #+end_src
Well, the variable replacement works even if I do not specify the variables in
a header argument. It seems to work like a simple string replace for each
'variable="value"' parameter in the noweb reference.
When I write this:
--8<---------------cut here---------------start------------->8---
<<cv(v-firstname="Albert")>>
--8<---------------cut here---------------end--------------->8---
When I tangle/evaluate the code, it replaces any occurrence of "v-firstname"
in the cv source code by "Albert" even if the variable is not given a header
argument...
Seems like the header argument is "just" used to give a default value for the
replacement.
Is this the expected behavior?
> Then ensure that you can call the cv function using a call line, e.g.
>
> #+call: cv(v-firstname="Alex",v-familyname="Pizzo",v-jobtitle="Project
> Manager",employee="alex")
>
> Once that is working then the noweb reference should work as well.
I tried what you say, but it seems that a variable in a noweb reference does
not get replaced by its value. From my point of view, it seems that:
- either, the noweb references are replaced before the variables get replaced
by their values;
- or, the variable replacement does not work in noweb references.
Here's a shorter example where, whatever I try, I keep getting the Profile
section empty:
--8<---------------cut here---------------start------------->8---
* Alex
#+call: cv(employee="alex")
#+srcname: cv-alex
#+begin_src latex :noweb yes :tangle alex.tex
<<cv(employee="alex")>>
#+end_src
** Profile
#+srcname: profile-alex
#+begin_src latex
Software engineering expert.
#+end_src
* Composed CV
#+srcname: cv
#+begin_src latex :noweb yes :var employee="alex"
\documentclass{mycvclass}
\usepackage[utf8x]{inputenc}
\begin{document}
\section{Profile}
<<profile-employee>>
\end{document}
#+end_src
--8<---------------cut here---------------end--------------->8---
Any help is welcome.
Thanks,
Francesco