4

If I create a file with {{{input-file}}} as contents and export to HTML, the default macro is correctly evaluated to the filename. However, if I write [[file:{{{input-file}}}.alternative][Alternative version]] the macro is not evaluated. However, if I place the macro on the other part of the link: [[file:manual.html.alternative][{{{input-file}}}.alternative]] then it works! If I use it in a #+BEGIN_HTML #+END_HTML session instead of in a link the macro isn't evaluated either.

How can I fix this?

1
  • Damn it, org-mode. I can't believe you named another feature "macro" when that term was already overloaded in Emacs. I've edited the title to make it less ambiguous.
    – phils
    May 10, 2016 at 3:50

1 Answer 1

1

You can try a emacs-lisp src block with raw results.

For example:

#+begin_src emacs-lisp :exports results :results raw
(concat "[[file:./" (buffer-file-name) ".alternative]]" )
#+end_src

To get rid of confirmation messages, you can use the org-confirm-babel-evaluatevariable. This is my setting:

    (defun my-org-confirm-babel-evaluate (lang body)
       (not (member lang '("dot" "emacs-lisp" "shell" "plantuml"))))
    (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.