[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: |
Wed, 15 Feb 2023 20:44:40 +0000 |
reza <reza@housseini.me> writes:
> #+BEGIN_SRC bash :file log_{{{year}}}.csv
> ./get_log_file --start={{{year}}}-01-01 --end={{{year}}}-12-31
> #+END_SRC
>
> #+BEGIN_SRC python
> log = pd.read_csv("log_{{{year}}}.csv")
> #END_SRC
> ...
> But that does not seem to work. It looks like the macro expansion does
> not happen for included content. Is this a bug or correct behavior, what
> would be the approach to not repeat the content for several reports?
Macro expansion only works inside Org proper markup.
Macros are only recognized withing non-verbatim contexts.
Src blocks are considered verbatim and macros are not expanded there.
Otherwise, Org would risk interfering with proper programming language
syntax.
What you can do instead is creating a named Org paragraph with macro,
like
#+name: year
{{{year}}}
and then refer to it via variable assignments.
--
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>
- Cannot expand macros through included org file, reza, 2023/02/15
- Re: Cannot expand macros through included org file,
Ihor Radchenko <=
- Message not available
- Re: Cannot expand macros through included org file, reza, 2023/02/15
- Re: Cannot expand macros through included org file, Ihor Radchenko, 2023/02/15
- Message not available
- Re: Cannot expand macros through included org file, reza, 2023/02/15
- Re: Cannot expand macros through included org file, Ihor Radchenko, 2023/02/17
- Message not available
- Re: Cannot expand macros through included org file, reza, 2023/02/17
- Re: Cannot expand macros through included org file, Nick Dokos, 2023/02/15