From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: setting a custom flag for src blocks Date: Sat, 10 Dec 2016 14:24:57 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f403045d9bbe754ccf054352d3d4 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cFnHW-0007Iw-Jr for emacs-orgmode@gnu.org; Sat, 10 Dec 2016 14:26:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cFnHT-0002Zf-65 for emacs-orgmode@gnu.org; Sat, 10 Dec 2016 14:26:02 -0500 Received: from mail-io0-f170.google.com ([209.85.223.170]:33519) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cFnHS-0002ZZ-Vd for emacs-orgmode@gnu.org; Sat, 10 Dec 2016 14:25:59 -0500 Received: by mail-io0-f170.google.com with SMTP id d9so110269159ioe.0 for ; Sat, 10 Dec 2016 11:25:58 -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 --f403045d9bbe754ccf054352d3d4 Content-Type: text/plain; charset=UTF-8 On Sat, Dec 10, 2016 at 12:19 AM, Matt Price wrote: > > > On Fri, Dec 9, 2016 at 12:19 PM, Eric S Fraga wrote: > >> On Friday, 9 Dec 2016 at 16:42, Matt Price wrote: >> > I think I am getting closer, actually (details soon, when I have a >> > fully working solution)). >> >> I look forward to seeing it! >> > > OK, I've run into the limits of my knowledge. > > There are at least 2 plugins that will give a live code execution > environemnt within an HTML presentation: > - RevealEditor, which adds one global Ace editor instance to the > presentation, and which shows the live rendering of HTML, CSS, and JS code > when the html encoding follows the format: > >
[1,2,3].map ((x) => x + 1)
> 
> > > - klipse, which instantiates a new instance of CodeMirror for every > appropriately formatted set of tags in the form: > > [1,2,3].map ((x) => x + 1) > > Meanwhile, html export (and also reveal export) will give something more like: > >
[1,2,3].map ((x) => x + 1)
>
> I would like to conditionally export
>
> - revealeditor-compatible code if (a) a flag "org-reveal-use-editor" is set AND (b) the code block meets certain criteria, e.g. language and maybe something in the header like "make-live t"
>
> - klipse-compatible code if (a) a flag "org-reveal-klipsify is set AND similar conditions to (b) above
>
> - standard html output if neither of the above conditions is met.
>
> What are the best ways do achieve this, do you think? Thanks guys,
>
>
I *think* that I'm looking for an export filter. From what I can see, it
has access to all the information that  the  initial export function does.
So now I'm wondering what the easiest way is to set a simple flag for a src
block, and make that flag available to the export filter.  For instance, if
I want a particular block to be renderd in klipse on export, could I
specify somehow:

#+HEADER: klipsify t
#+BEGIN_SRC: javascript
console.log("success");
#+END_SRC

or alternatively in a subtree:

* Lots of Examples
:PROPERTIES:
#+PROPERTY: header-args:javascript  :klipsify t
:END:

#+BEGIN_SRC: javascript
console.log("success");
#+END_SRC

 Thanks again, matt

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



On Sat, Dec 10, 2016 at 12:19 AM, Matt Price <= ;moptop99@gmail.com= > wrote:


On Fri, Dec 9, 2016 at 12:19 PM, Eric S Fraga <= span dir=3D"ltr"><e.fraga@ucl.ac.uk> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">On Friday,=C2=A0 9 Dec 2016 at 16:42, Matt Price wro= te:
> I think I am getting closer, actually (details soon, when I have a
> fully working=C2=A0 solution)).

I look forward to seeing it!
<= br>
OK, I've run into the limits of my knowledge.
=
There are at least 2 plugins that will give a live code exec= ution environemnt within an HTML presentation:
- RevealEdito= r, which adds one global Ace editor instance to the presentation, and which= shows the live rendering of HTML, CSS, and JS code when the html encoding = follows the format:
<pre><code =
class=3D"hljs js" data-trim contenteditable>
[1,2,3].ma=
p ((x) =3D> x + 1)
</code>=
</pre><=
/pre>
- klipse, which=C2=A0 instantiates a new instance of Co= deMirror for every appropriately formatted set of tags in the form:
<klipse-snippet data-language=3D= "javascri= pt"> [1,2,3].map ((x)= =3D> x + 1) <= ;/klipse-snippet&g= t;

Mea=
nwhile, html export (and also reveal export) will give something more like:=


<pr= e cl= ass=3D"src src-javascript"><span style=3D"color: #8c8c8c;<= /a>">[</span>1,2,3<span style=3D"<= a class=3D"gmail-m_-38404612444332903gmail-attribute-value">color: #8c8c8c;= ">]</span>.map <span style=3D"= color: #8c8c8c= ;">((</span>x<span style=3D"color: #8c8c8c;<= /a>">)</span> =3D&gt; x + 1&l= t;span style=3D= "color: #= 8c8c8c;">)</span>

I would like to c=
onditionally export 
- revealeditor-compatible code if (a) a flag "org-re=
veal-use-editor" is set AND (b) the code block meets certain criteria,=
 e.g. language and maybe something in the header like "make-live t&quo=
t;
=
- klipse-compatible code if (a) a flag "org-reveal-klipsify is set AND=
 similar conditions to (b) above

- standard html output if neither of the=
 above conditions is met.

What are the best ways do achieve this, do you t=
hink? Thanks guys,

I *think* that I'm looking for an export filter. Fr= om what I can see, it has access to all the information that=C2=A0 the=C2= =A0 initial export function does. So now I'm wondering what the easiest= way is to set a simple flag for a src block, and make that flag available = to the export filter.=C2=A0 For instance, if I want a particular block to b= e renderd in klipse on export, could I specify somehow:

#= +HEADER: klipsify t
#+BEGIN_SRC: javascript
con= sole.log("success");
#+END_SRC

or= alternatively in a subtree:

* Lots of Examples
=
:PROPERTIES:
#+PROPERTY: header-args:javascript =C2=A0:klipsify t:END:

#+BEGIN_SRC: javascript
console.log("suc= cess");
#+END_SRC

=C2=A0Thanks again= , matt
--f403045d9bbe754ccf054352d3d4--