emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] running some elisp code when exporting a given file


From: Eric Schulte
Subject: Re: [O] running some elisp code when exporting a given file
Date: Fri, 06 Sep 2013 11:41:36 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Alan Schmitt <address@hidden> writes:

> address@hidden writes:
>
>> Hello,
>>
>> Alan Schmitt <address@hidden> writes:
>>
>>> I would like to inline a css when exporting a file to html, but I don't
>>> know how to tell org-mode to set the variable org-html-head from within
>>> the file.
>>>
>>> Here is what I tried: I added the following block at the beginning of my
>>> file:
>>>
>>> #+BEGIN_SRC emacs-lisp :exports none
>>>   (set (make-local-variable 'org-html-head) (concat
>>>                              "<style type=\"text/css\">\n"
>>>                              "<!--/*--><![CDATA[/*><!--*/\n"
>>>                              (with-temp-buffer
>>>                                (insert-file-contents "style.css")
>>>                                (buffer-string))
>>>                              "/*]]>*/-->\n"
>>>                              "</style>\n"))
>>> #+END_SRC
>>>
>>> It does not seem to be evaluated, however.
>>>
>>> Is there a way to have arbitrary code stored in the file being exported
>>> being evaluated before an export?
>>
>> I think this has to do with ":exports none", which means that code will
>> not be evaluated during export. You may want to try setting the
>> attribute to some other value, and put the block in a :noexport: entry.
>
> Thanks a lot, this was it.
>

Just for completeness, another option may be the following set of header
arguments.

    #+begin_src emacs-lisp :exports results :results none
      ;; code executed for side effects
    #+end_src

Cheers,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



reply via email to

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