emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] including external file in src block execution; ATTR_HTML on src


From: Charles C. Berry
Subject: Re: [O] including external file in src block execution; ATTR_HTML on src blocks
Date: Mon, 12 Dec 2016 19:52:23 -0800
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

On Mon, 12 Dec 2016, Matt Price wrote:

On Mon, Dec 12, 2016 at 12:16 PM, Charles C. Berry <address@hidden> wrote:

On Mon, 12 Dec 2016, Matt Price wrote:


[snip]


My questions are:
1. can I pass this html attribute to the <pre><code> block somehow?


Yes.

ATTR_HTML doesn't seem to work.  Is this a bug? If so, should I try to fix
it?


No and no.

Did you try

: (plist-get (cadr src-block) :attr_html)

in `org-html-src-block' ?


ah, ok.  Now I will reveal some of the depths of my ignorance.  Looks like
:attr_html is a plist (right?).

No, it is a property name. (cadr src-block) is the plist.

See (info "(elisp) Property Lists")


(a) what is the appropriate way to identify an attribute here.  should I
write, e.g.:

#+ATTR_HTML: :data-external-libs "http://underscorejs.org/underscore-min.js";
:class "list of classes"

Any could be made to work, but I'd use (a). Then

: (org-babel-parse-header-arguments
:  (car (plist-get (cadr src-block) :attr_html)))

will give you

: ((:data-external-libs . "http://underscorejs.org/underscore-min.js";) : (:class . "list of classes"))

or:
#+ATTR_HTML: data-external-libs "http://underscorejs.org/underscore-min.js";
class "list of classes"
or
#+ATTR_HTML: "data-external-libs" "http://underscorejs.org/underscore-min.js";
"class" "list of classes"

And then, if I want to transform this into:

data-external-libs="http://underscorejs.org/underscore-min.js"; class="list
of classes"

can I just do something like:
(let ((attributes (org-export-get-attribute :attr_html src-block))
 (cl-loop for (key value) in attributes
   (collect (concat key "=" "\"" value "\" " ))))

or do I need to transform the key into a string first?

Well, I'd just try it and see.

I'm sorry to be writing such basic lisp questions; obviously I need to read
a really good lisp introduction, but I haven't found one yet.


This is what I use:

* Elisp: (elisp).               The Emacs Lisp Reference Manual.
* Emacs Lisp Intro: (eintr).    A simple introduction to Emacs Lisp programming.

and ample Googling, usually leading to StackOverflow, to get hints on stuff I am fuzzy on. And I read docstrings over and over and ...

Best,

Chuck



reply via email to

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