From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: including external file in src block execution; ATTR_HTML on src blocks Date: Mon, 12 Dec 2016 09:12:07 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114536386145d8054376b0e6 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGRN0-00005Q-SC for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 09:14:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGRMv-0000Uv-DY for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 09:14:22 -0500 Received: from mail-io0-f182.google.com ([209.85.223.182]:35076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGRMv-0000NR-8G for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 09:14:17 -0500 Received: by mail-io0-f182.google.com with SMTP id h30so172247823iod.2 for ; Mon, 12 Dec 2016 06:13:56 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode --001a114536386145d8054376b0e6 Content-Type: text/plain; charset=UTF-8 I use org to write my lecture notes, and have started using klipse in those exported notes to execute code snippets in a browser environment ( http://matt.hackinghistory.ca/2016/12/11/org-mode-run-code-live-in-a-reveal-slideshow-with-klipse/ ). Sometimes I would like to set up the javascript environment with some additional libraries, either local or web-based. Klipse lets you do this with a custom data- attribute. My questions are: 1. can I pass this html attribute to the
 block somehow?
ATTR_HTML doesn't seem to work.  Is this a bug? If so, should I try to fix
it? If not, is there a simple way to use header arguments to pass
information down? I am already rewriting the exporter's src-block export
function, so I can try to accomplish what I need to in that context.
2. I'd like to be able to test my code directly in org (since I'm a lousy
coder and a clumsy typist). Can I tell org to load other files before
executing a src block?

Thank you!
Mat

--001a114536386145d8054376b0e6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

=
1. can I pass this html attribute to the <pre><code> block= somehow? ATTR_HTML doesn't seem to work.=C2=A0 Is this a bug? If so, s= hould I try to fix it? If not, is there a simple way to use header argument= s to pass information down? I am already rewriting the exporter's src-b= lock export function, so I can try to accomplish what I need to in that con= text.=C2=A0
2. I'd like to be able to test my code direc= tly in org (since I'm a lousy coder and a clumsy typist). Can I tell or= g to load other files before executing a src block?

Thank= you!
Mat


--001a114536386145d8054376b0e6-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: including external file in src block execution; ATTR_HTML on src blocks Date: Mon, 12 Dec 2016 09:16:53 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGUE5-0008BF-4C for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 12:17:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGUE1-0004Pf-4V for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 12:17:21 -0500 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:14739) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGUE0-0004PV-Ma for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 12:17:17 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Matt Price Cc: Org Mode On Mon, 12 Dec 2016, Matt Price wrote: [snip] > > My questions are: > 1. can I pass this html attribute to the
 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' ?


> If not, is there a simple way to use header arguments to pass
> information down?

The answer is still no. ;-)

There are complicated ways. See

https://github.com/chasberry/orgmode-accessories/blob/ravel-lang/ox-ravel.org

for one such. But for what you are doing ATTR_HTML is easiest.


> I am already rewriting the exporter's src-block export
> function, so I can try to accomplish what I need to in that context.

BTW, the cleanest way to do this is by writing a derived exporter:

:  (org-export-define-derived-backend 'reveal 'revealplus ...

In your case you only provide the src-block entry for the 
:translate-alist, :options-alist entries for any you redefine or 
introduce, and optionally a :menu-entry.

Also, you'll probably want to add a hook to 
`org-export-before-parsing-hook' (see below).


If you do this, then `#+ATTR_REVEALPLUS:' seems suitable.

> 2. I'd like to be able to test my code directly in org (since I'm a lousy
> coder and a clumsy typist). Can I tell org to load other files before
> executing a src block?

Yes. Depending on what you want one of these:

* Add this to `org-export-before-parsing-hook', perhaps in setting up a
   derived exporter.

* Or perhaps by using a local variable `eval' see

: (info "(emacs) Specifying File Variables")

* Or by executing a src-block that loads those files.

HTH,

Chuck

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Matt Price 
Subject: Re: including external file in src block execution; ATTR_HTML on src
 blocks
Date: Mon, 12 Dec 2016 15:53:04 -0500
Message-ID: 
References: 
	
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11452d1449063405437c4a25
Return-path: 
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49935)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from ) id 1cGXbv-0002wA-Av
	for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 15:54:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from ) id 1cGXbq-0004zp-JI
	for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 15:54:11 -0500
Received: from mail-io0-f178.google.com ([209.85.223.178]:33442)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from ) id 1cGXbq-0004zh-Ca
	for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 15:54:06 -0500
Received: by mail-io0-f178.google.com with SMTP id d9so189545721ioe.0
	for ; Mon, 12 Dec 2016 12:54:06 -0800 (PST)
In-Reply-To: 
List-Id: "General discussions about Org-mode." 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: "Emacs-orgmode"
	
Cc: Org Mode 

--001a11452d1449063405437c4a25
Content-Type: text/plain; charset=UTF-8

On Mon, Dec 12, 2016 at 12:16 PM, Charles C. Berry  wrote:

> On Mon, 12 Dec 2016, Matt Price wrote:
>
>
> [snip]
>
>
>> My questions are:
>> 1. can I pass this html attribute to the 
 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?).
(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"
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?
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.

>
> If not, is there a simple way to use header arguments to pass
>> information down?
>>
>
> The answer is still no. ;-)
>
> There are complicated ways. See
>
> https://github.com/chasberry/orgmode-accessories/blob/ravel-
> lang/ox-ravel.org
>
> for one such. But for what you are doing ATTR_HTML is easiest.
>
> I will take the easiest please!

>
> I am already rewriting the exporter's src-block export
>> function, so I can try to accomplish what I need to in that context.
>>
>
> BTW, the cleanest way to do this is by writing a derived exporter:
>
> :  (org-export-define-derived-backend 'reveal 'revealplus ...
>
> In your case you only provide the src-block entry for the
> :translate-alist, :options-alist entries for any you redefine or introduce,
> and optionally a :menu-entry.
>
> Also, you'll probably want to add a hook to `org-export-before-parsing-hook'
> (see below).
>
>
> If you do this, then `#+ATTR_REVEALPLUS:' seems suitable.
>

right. Up till now I have been hoping to integrate these change sback into
ox-reveal, but now it's starting to feel a bit invasive.  I may try this
route.

>
> 2. I'd like to be able to test my code directly in org (since I'm a lousy
>> coder and a clumsy typist). Can I tell org to load other files before
>> executing a src block?
>>
>
> Yes. Depending on what you want one of these:
>
> * Add this to `org-export-before-parsing-hook', perhaps in setting up a
>   derived exporter.
>
> * Or perhaps by using a local variable `eval' see
>
> : (info "(emacs) Specifying File Variables")
>
> * Or by executing a src-block that loads those files.
>

I think this might be the best route, since I would probably want to load
such files on a block-by-block basis.

>
> HTH,
>
> Chuck
>
very much, I think!

--001a11452d1449063405437c4a25
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Mon, Dec 12, 2016 at 12:16 PM, Charles C. Berry &l= t;ccberry@ucsd.edu> 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 some= how?

Yes.

ATTR_HTML doesn't seem to work.=C2=A0 Is this a bug? If so, should I tr= y to fix
it?

No and no.

Did you try

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

in `org-html-src-block' ?


ah, ok.=C2=A0 Now I will reveal= some of the depths of my ignorance.=C2=A0 Looks like :attr_html is a plist= (right?).=C2=A0
(a) what is the appropriate way to identify= an attribute here.=C2=A0 should I write, e.g.:
or:
=C2=A0#+ATTR_HTML: data-external-libs "http://underscorejs.org/underscore-min.js= " class "list of classes"
or
#+ATTR_HTML: "= ;data-external-libs" "http://un= derscorejs.org/underscore-min.js" "class" "list of = classes"

And then, if I want to transform this into:
data-external-libs= =3D"http://underscorejs.org/undersco= re-min.js" class=3D"list of classes"

can I just do something lik= e:
(let ((at= tributes (org-export-get-attribute :attr_html src-block))
=C2=A0 (cl-loo= p for (key value) in attributes
=C2=A0=C2=A0=C2=A0 (collect (concat key "=3D"= "\"" value "\" " ))))

<= /div>
or do I need to transform the = key into a string first?
I'm sorry to be writing such basic lisp questions; obvious= ly I need to read a really good lisp introduction, but I haven't found = one yet.=C2=A0

If not, is there a simple way to use header arguments to pass
information down?

The answer is still no. ;-)

There are complicated ways. See

https://github.com/chas= berry/orgmode-accessories/blob/ravel-lang/ox-ravel.org

for one such. But for what you are doing ATTR_HTML is easiest.

I will take the easiest please!

I am already rewriting the exporter's src-block export
function, so I can try to accomplish what I need to in that context.

BTW, the cleanest way to do this is by writing a derived exporter:

:=C2=A0 (org-export-define-derived-backend 'reveal 'revealplus= ...

In your case you only provide the src-block entry for the :translate-alist,= :options-alist entries for any you redefine or introduce, and optionally a= :menu-entry.

Also, you'll probably want to add a hook to `org-export-before-parsing-= hook' (see below).


If you do this, then `#+ATTR_REVEALPLUS:' seems suitable.

right. Up till now I h= ave been hoping to integrate these change sback into ox-reveal, but now it&= #39;s starting to feel a bit invasive.=C2=A0 I may try this route. =C2=A0 <= br>

2. I'd like to be able to test my code directly in org (since I'm a= lousy
coder and a clumsy typist). Can I tell org to load other files before
executing a src block?

Yes. Depending on what you want one of these:

* Add this to `org-export-before-parsing-hook', perhaps in setting= up a
=C2=A0 derived exporter.

* Or perhaps by using a local variable `eval' see

: (info "(emacs) Specifying File Variables")

* Or by executing a src-block that loads those files.
=
I think this might be the best route, since I would probably= want to load such files on a block-by-block basis. =C2=A0

HTH,

Chuck
very much, I think!
--001a11452d1449063405437c4a25-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: including external file in src block execution; ATTR_HTML on src blocks Date: Mon, 12 Dec 2016 19:52:23 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGe96-0003QE-Uj for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 22:52:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGe93-00025v-T5 for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 22:52:53 -0500 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:33806) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGe93-000257-FE for emacs-orgmode@gnu.org; Mon, 12 Dec 2016 22:52:49 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Matt Price Cc: Org Mode On Mon, 12 Dec 2016, Matt Price wrote: > On Mon, Dec 12, 2016 at 12:16 PM, Charles C. Berry wrote: > >> On Mon, 12 Dec 2016, Matt Price wrote: >> >> >> [snip] >> >> >>> My questions are: >>> 1. can I pass this html attribute to the
 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

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Matt Price 
Subject: Fwd: including external file in src block execution; ATTR_HTML on
 src blocks
Date: Tue, 13 Dec 2016 09:44:20 -0500
Message-ID: 
References: 
	
	
	
	
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a113ea20673598805438b4132
Return-path: 
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57580)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from ) id 1cGoKz-000748-8u
	for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 09:45:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from ) id 1cGoKw-0002Vx-1m
	for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 09:45:49 -0500
Received: from mail-io0-f176.google.com ([209.85.223.176]:35455)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from ) id 1cGoKv-00022G-QG
	for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 09:45:45 -0500
Received: by mail-io0-f176.google.com with SMTP id h30so230839440iod.2
	for ; Tue, 13 Dec 2016 06:45:23 -0800 (PST)
In-Reply-To: 
List-Id: "General discussions about Org-mode." 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: "Emacs-orgmode"
	
To: Org Mode 

--001a113ea20673598805438b4132
Content-Type: text/plain; charset=UTF-8

(sent to Charles direcly by mistake. Charles, this resend gave me the
chance to modify my response)
On Mon, Dec 12, 2016 at 10:52 PM, Charles C. Berry  wrote:

> On Mon, 12 Dec 2016, Matt Price wrote:
>
> On Mon, Dec 12, 2016 at 12:16 PM, Charles C. Berry 
>> wrote:
>>
>> On Mon, 12 Dec 2016, Matt Price wrote:
>>>
>>>
>>> [snip]
>>>
>>>
>>> My questions are:
>>>> 1. can I pass this html attribute to the 
 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.
>

:-)  I think what I meant was, looks like (org-export-read-attribute
:attr_html src-block) RETURNS a plist.  But that doesn't seem to be quite
true, if I'm understanding properly what a plist is.

Instead it returns a list of this form:
(:code_attribs data-external-libs="https://cdnjs.cloudflare.com/ajax/
libs/jquery/3.1.1/jquery.js" data-other="other" :class some class list)

 Access to the :properties only seems reliable through
(org-export-read-attribute :attr_html src_plock :propname), which returns
what should be an odd list of symbols (?) as a string. Again, it seems
somewhat mysterious to me.

UPDATE: despite the tentative solution seen below, I guess maybe the
#+ATTR_XXX attributes are not intended for iteration as I describe, but
instead each such attribute should have a well-specified function that the
exporter knows about.  If I'm adding attributes -- and it turns out that
ox-reveal can interpret a :code_attribs attribute that I hadn't known about
-- then I feel like I should structure them in an expected way.  I haven't
found documentation about the best practice here and would definitely
appreciate further pointers.


> 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/under
>> score-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"))
>

ah, ok, thank you.   Someday I hope I really understand list objects and
how to transform them.  I think part of the problem is that, unlike in some
other languages, programming effectively requires a proper understanding of
*what the objects are that you're manipulating*, and I'm just a bit too
stupid to learn this effectively on my own.

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.
>
:-) Seems like I should be able to manage this now!


> 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 ...
>

This is the method i'm using, but for me it's veeeeerrrrry slow.



>
> Best,
>
> Chuck
>

Thank you Chuck!

--001a113ea20673598805438b4132
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

(sent to Charles direcly by mistake. Charles, this resend = gave me the chance to modify my response)
On Mon, Dec 12, 2016 at 10:52 PM, Charles C. Berry <ccbe= rry@ucsd.edu> wrote:
On Mon, 12 Dec 2016, Matt Price wrote:

On Mon, Dec 12, 2016 at 12:16 PM, Charles C. Berry <ccberry@ucsd.edu> 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 some= how?


Yes.

ATTR_HTML doesn't seem to work.=C2=A0 Is this a bug? If so, should I tr= y to fix
it?


No and no.

Did you try

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

in `org-html-src-block' ?


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

No, it is a property name. (cadr src-block) is the plist.
<= div>
:-)=C2=A0 I think what I meant was, looks like (o= rg-export-read-attribute :attr_html src-block) RETURNS a plist.=C2=A0 But t= hat doesn't seem to be quite true, if I'm understanding properly wh= at a plist is.=C2=A0

Instead it returns a list of this f= orm:
(:code_attribs data-external-libs=3D"https:/= /cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js" = data-other=3D"other" :class some class list)

= =C2=A0Access to the :properties only seems reliable through (org-export-rea= d-attribute :attr_html src_plock :propname), which returns what should be a= n odd list of symbols (?) as a string. Again, it seems somewhat mysterious = to me.

UPDATE: despite the tentative solution seen below= , I guess maybe the #+ATTR_XXX attributes are not intended for iteration as= I describe, but instead each such attribute should have a well-specified f= unction that the exporter knows about.=C2=A0 If I'm adding attributes -= - and it turns out that ox-reveal can interpret a :code_attribs attribute t= hat I hadn't known about -- then I feel like I should structure them in= an expected way.=C2=A0 I haven't found documentation about the best pr= actice here and would definitely appreciate further pointers.


See (info "(elisp) Property Lists")


(a) what is the appropriate way to identify an attribute here.=C2=A0 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
:=C2=A0 (car (plist-get (cadr src-block) :attr_html)))

will give you

: ((:data-external-libs . "http://underscorejs.org/und= erscore-min.js") :=C2=A0 =C2=A0(:class . "list of classe= s"))
=

ah, ok, thank you. =C2=A0 Someday I hope I reall= y understand list objects and how to transform them.=C2=A0 I think part of = the problem is that, unlike in some other languages, programming effectivel= y requires a proper understanding of *what the objects are that you're = manipulating*, and I'm just a bit too stupid to learn this effectively = on my own.=C2=A0

And then, if I want to transform this into:
=C2=A0
=

data-external-libs=3D"http://underscorejs.org/und= erscore-min.js" class=3D"list
of classes"

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

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

Well, I'd just try it and see.
:-) Seems like I should be able to man= age this now!


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).=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0The= Emacs Lisp Reference Manual.
* Emacs Lisp Intro: (eintr).=C2=A0 =C2=A0 A simple introduction to Emacs Li= sp 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 ...

This is the method i'm using, but for me it's veee= eerrrrry slow.=C2=A0

=C2=A0

Best,

Chuck

Thank you Chuck!
--001a113ea20673598805438b4132-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Fwd: including external file in src block execution; ATTR_HTML on src blocks Date: Tue, 13 Dec 2016 20:08:51 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cH0sF-0003fp-9i for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 23:09:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cH0sC-0007cj-49 for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 23:08:59 -0500 Received: from iport-acv1-out.ucsd.edu ([132.239.0.176]:25845) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cH0sB-0007cI-NI for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 23:08:56 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Matt Price Cc: Org Mode On Tue, 13 Dec 2016, Matt Price wrote: > (sent to Charles direcly by mistake. Charles, this resend gave me the > chance to modify my response) > On Mon, Dec 12, 2016 at 10:52 PM, Charles C. Berry wrote: [snipping throughout] >>>> >>>> My questions are: >>>>> 1. can I pass this html attribute to the
 block somehow?


>>>> : (plist-get (cadr src-block) :attr_html)
>>>>
>>>> in `org-html-src-block' ?
>>>>


>
> :-)  I think what I meant was, looks like (org-export-read-attribute
> :attr_html src-block) RETURNS a plist.  But that doesn't seem to be quite
> true, if I'm understanding properly what a plist is.
>

It looks to me like `org-export-read-attribute' reliably returns a
plist when used with three args.

> Instead it returns a list of this form:
> (:code_attribs data-external-libs="https://cdnjs.cloudflare.com/ajax/
> libs/jquery/3.1.1/jquery.js" data-other="other" :class some class list)

That isn't a plist. I don't believe that `org-export-read-attribute'
gave you that. Maybe you dropped some quotes? Do you have an ECM that
shows that behavior?

>
> Access to the :properties only seems reliable through
> (org-export-read-attribute :attr_html src_plock :propname), which returns
> what should be an odd list of symbols (?) as a string. Again, it seems
> somewhat mysterious to me.

You lost me here. I don't know what `src_plock' contains, so I can't
really say whether what that returns makes sense or not.

Chuck