[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Can I wrap a Babel call inside a macro?
From: |
Sebastien Vauban |
Subject: |
[O] Can I wrap a Babel call inside a macro? |
Date: |
Thu, 23 Jan 2014 23:42:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) |
Hello,
I did the following test, not fully successfull:
--8<---------------cut here---------------start------------->8---
#+name: current-time
#+begin_src sh
echo "$(date '+%Y%m%d.%H%M')"
#+end_src
#+results: current-time
: 20140123.2339
Date/time:
#+CALL: current-time()
#+results:
: 20140123.2339
#+MACRO: ct #+CALL: current-time()
The current date and time is:
{{{ct}}}.
--8<---------------cut here---------------end--------------->8---
as the HTML export gives:
--8<---------------cut here---------------start------------->8---
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Tests</h2>
<div class="outline-text-2" id="text-1">
<div class="org-src-container">
<pre class="src src-sh" id="current-time">
<span style="color: #006FE0;">echo</span> <span style=
"color: #036A07;">"$(date '+%Y%m%d.%H%M')"</span>
</pre>
</div>
<p>Date/time:</p>
<pre class="example">
20140123.2338
</pre>
<p>The current date and time is: #+CALL: current-time().</p>
</div> ^^^^^^^^^^^^^^^^^^^^^^
</div>
--8<---------------cut here---------------end--------------->8---
As macros are expanded _before_ Babel calls are executed, I'd think this
is possible, but I must miss something...
Best regards,
Seb
--
Sebastien Vauban
- [O] Can I wrap a Babel call inside a macro?,
Sebastien Vauban <=