From mboxrd@z Thu Jan 1 00:00:00 1970 From: "David A. Gershman" Subject: Re: Disable org-babel-inline-result-wrap per inline code? Date: Wed, 21 Sep 2016 07:23:49 -0700 Message-ID: References: <87k2e5scay.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------457801FD86C5D78E86F46ED6" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmiRF-00056w-FH for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 10:23:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmiR9-00053z-Ru for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 10:23:52 -0400 Received: from dagertech.net ([64.183.98.170]:47184 helo=mail.dagertech.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmiR9-00053W-IS for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 10:23:47 -0400 Received: from [192.168.133.106] (unknown [192.168.176.200]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.dagertech.net (Postfix) with ESMTPSA id B60D3A0254 for ; Wed, 21 Sep 2016 07:23:45 -0700 (PDT) In-Reply-To: <87k2e5scay.fsf@alphapapa.net> 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: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------457801FD86C5D78E86F46ED6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 09/21/2016 04:49 AM, Adam Porter wrote: > "David A. Gershman" writes: > >> Given the following line: >> >> * Date: src_perl[:results output :exports none]{print 2016;} >> >> The result '2016' is surrounded by '=' so that HTML export results in >> tags surrounding >> the '2016'. >> >> According to the manual section 14.5, 'org-babel-inline-result-wrap' >> defines how the results are wrapped. Executing a (print >> org-babel-inline-result-wrap), I get: >> >> {blank line} >> =%s= >> =%s= >> >> so I attempted the following: >> >> * Date: src_emacs-lisp[:exports none]{(setq >> org-babel-inline-result-wrap "")} src_perl[:results output :exports >> none]{print 2016;} src_emacs-lisp[:exports none]{(setq >> org-babel-inline-result-wrap "=%s=")} >> >> in the hopes of temporarily disabling the '=' wrapping. Sadly no luck. >> >> I don't want to globally, or even for the whole buffer turn off the >> '=%s='...just on a case-by-case basis. > Hi David, > > I haven't done anything quite like this in Org before, but I think maybe > Org macros would do what you need: > > http://orgmode.org/manual/Macro-replacement.html > > According to that, "Macro expansion takes place during the very > beginning of the export process." So it should be easy to write a macro > that evaluates to a date in the format you need, and it should take > effect when you export it to HTML. At least, that's what it sounds like > to me. Please let me know what you find out. :) > That's actually how I'm doing it, but I'm not fully up on how macros work short of just being text replacements. Currently, at the top of my file, I have: #+MACRO: gendate src_perl[:results output]{print ($1*5);} # Where 'print ($1*5);' will later be replaced with a perl function that takes the first day of class and an integer # ex: /print find_date( '20160926', 6 );/ # 6 = Sixth lecture day, output: "6, Oct 12, 2016" assuming MW class. and in the org file, I can have headlines: * Day {{{gendate(6)}}} ... * Day {{{gendate(10)}}} and so on. During export, the result desired is: /Day 6, Oct 12, 2016/ {etc.} FWIW, Eric had the solution: #+MACRO: gendate src_perl[:results output _/*raw*/_]{print ($1*5);} Thank everyone! --dag P.S. I should start a blog with all I learn on this. /Someone/ could benefit from my struggles. :) --------------457801FD86C5D78E86F46ED6 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable

On 09/21/2016 04:49 AM, Adam Porter wrote:
"David A. Gershman" <dagershman@dagertech.net&=
gt; writes:

Given the following line:

* Date: src_perl[:results output :exports none]{print 2016;}

The result '2016' is surrounded by '=3D' so that HTML export results in
<code></code> tags surrounding
the '2016'.=20

According to the manual section 14.5, 'org-babel-inline-result-wrap'
defines how the results are wrapped. Executing a (print
org-babel-inline-result-wrap), I get:

{blank line}
=3D%s=3D
=3D%s=3D

so I attempted the following:

* Date: src_emacs-lisp[:exports none]{(setq
org-babel-inline-result-wrap "")} src_perl[:results output :exports
none]{print 2016;} src_emacs-lisp[:exports none]{(setq
org-babel-inline-result-wrap "=3D%s=3D")}

in the hopes of temporarily disabling the '=3D' wrapping. Sadly no luck.

I don't want to globally, or even for the whole buffer turn off the
'=3D%s=3D'...just on a case-by-case basis.
Hi David,

I haven't done anything quite like this in Org before, but I think maybe
Org macros would do what you need:

http://orgmode.org/manual/Macro-replacement.html

According to that, "Macro expansion takes place during the very
beginning of the export process."  So it should be easy to write a macro
that evaluates to a date in the format you need, and it should take
effect when you export it to HTML.  At least, that's what it sounds like
to me.  Please let me know what you find out.  :)

That's actually how I'm doing it, but I'm not fully up on how macros work short of just being text replacements.=A0 Currently, at the top of my file, I have:

#+MACRO: gendate src_perl[:results output]{print ($1*5);}
# Where 'print ($1*5);' will later be replaced with a perl function that takes the first day of class and an integer
#=A0=A0=A0=A0 ex:=A0 print find_date( '20160926', 6 ); # 6 =3D= Sixth lecture day, output: "6, Oct 12, 2016" assuming MW class.

and in the org file, I can have headlines:

* Day {{{gendate(6)}}}
...
* Day {{{gendate(10)}}}

and so on.=A0 During export, the result desired is:

=A0=A0 Day 6, Oct 12, 2016
=A0=A0=A0 {etc.}

FWIW, Eric had the solution:

=A0=A0=A0 #+MACRO: gendate src_perl[:results output raw<= /i>]{print ($1*5);}

Thank everyone!

--dag

P.S. I should start a blog with all I learn on this.=A0 Someone could benefit from my struggles. :)


--------------457801FD86C5D78E86F46ED6--