help-recutils
[Top][All Lists]
Advanced

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

setting a variable within a recfmt template


From: Charles Millar
Subject: setting a variable within a recfmt template
Date: Tue, 1 Aug 2023 13:58:53 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

Hi,

Here us the use case (org mode with recutils to export to latexpdf):

the ThisFile.rec file:

Name: who1
Address: where1
Condition1: yes
Condition1Info: some information pertaining to who1
Condition2: yes
Condition2info: some other information pertaining to who1

Name: who2
Address: where2
Condition1: yes
Condition1Info: some information pertaining to who2
Condition2: yes
Condition2info: some other information pertaining to who2
Condition3: yes
Condition3: some further information pertaining to who2

Name: who3
Address: where3
Condition1: yes
Condition1Info: some information pertaining to who3
Condition3: yes
Condition3info: some further information pertaining to who3

The current recfmt template:

rec: SomeRecords

#+Name: ARecutilsTemplate
#+begin_src org :results file :exports results :file ARecutilsTemplate.tmpl
\vskip2.0ex
  \begin{flushleft}
    \begin{minipage} [t]{3.0in}
    {{Name}}
    \end{minipage}
    \begin{minipage} [t]{2.5in}
   {{Condition1Info}}
    \end{minipage}
  \end{flushleft}

The source code for export to latex pdf:

  #+name: Export1
  #+header: :eval yes
#+begin_src shell :noweb yes :exports results :results replace :results raw recsel -t SomeRecords -e "Condition1='yes'" ThisFiles.rec | recfmt -f ARecutilsTemplate.tmpl
  #+end_src

Which I expect in pdf to be

who1    some information pertaining to who1
who2    some information pertaining to who2
who3    some information pertaining to who3

Now to the question.

As you can see in the ARecutilsTemplate the last slot specifically refers to Condition1Info.

Is there a means so that the template can be generic, i.e.,

#+Name: ARecutilsTemplate
#+begin_src org :results file :exports results :file ARecutilsTemplate.tmpl
\vskip2.0ex
  \begin{flushleft}
    \begin{minipage} [t]{3.0in}
    {{Name}}
    \end{minipage}
    \begin{minipage} [t]{2.5in}
   {{Condition}}
    \end{minipage}
  \end{flushleft}

and, for instance, that {{Condition}} can be substituted with {{Condition1Info}} when evaluating Export1 and exporting to the latex pdf?

Likewise if I have a Export2 source block in which I set -e "Condition2='yes'" i may set Condtition to "Condition2Info"

and obtain

who1    some other information pertaining to who1
who2    some other information pertaining to who2

Charlie Millar


reply via email to

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