From: Francesco Pizzolante <fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
To: Eric Schulte <schulte.eric-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: mailing-list-org-mode <emacs-orgmode-mXXj517/zsQ@public.gmane.org>
Subject: Re: [babel] References to variable block names
Date: Thu, 13 Jan 2011 09:33:22 +0100 [thread overview]
Message-ID: <874o9dmcdp.fsf@mundaneum.com> (raw)
In-Reply-To: <87y66qrsko.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> (Eric Schulte's message of "Wed, 12 Jan 2011 09:32:23 -0700")
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
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2011-01-13 8:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 11:40 [babel] References to variable block names Francesco Pizzolante
2011-01-12 16:32 ` Eric Schulte
[not found] ` <87y66qrsko.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-01-13 8:33 ` Francesco Pizzolante [this message]
2011-01-13 16:50 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874o9dmcdp.fsf@mundaneum.com \
--to=fpz-djc/ipccudyqhejpep6iedvlejwurmry@public.gmane.org \
--cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
--cc=schulte.eric-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).