[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cannot expand macros through included org file
From: |
Ihor Radchenko |
Subject: |
Re: Cannot expand macros through included org file |
Date: |
Fri, 17 Feb 2023 13:02:28 +0000 |
reza <reza@housseini.me> writes:
>> It works, but Org does not include variable assignments to exported code
>> by default. See org-babel-exp-code-template. The assignment would be
>> done if you execute the blocks though.
>
> So I have to set this variable to true?
Check out the docstring.
<F1> v org-babel-exp-code-template <RET>
>> Yet another approach is including common :var year=2009 header arg.
>
> what do you mean by common? I want to have a report for the years
> 2019-2022 for example.
report_2019.org:
#+TITLE: Report 2019
#+property: header-args :var year=2019
#+INCLUDE: "template.org" :lines "2-"
template.org:
#+TITLE: Report
* My headline
#+begin_src emacs-lisp :exports both :results value :eval yes
year
#+end_src
#+BEGIN_SRC bash
./get_log_file --start=$year-01-01 --end=$year-12-31
#+END_SRC
#+BEGIN_SRC python
log = pd.read_csv(f"log_{year}.csv")
#+END_SRC
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>