emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Disable org-babel-inline-result-wrap per inline code?
@ 2016-09-21  6:07 David A. Gershman
  2016-09-21 11:49 ` Adam Porter
  2016-09-21 14:11 ` Nick Dokos
  0 siblings, 2 replies; 7+ messages in thread
From: David A. Gershman @ 2016-09-21  6:07 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]

Forgive my several questions/emails.  I'm working on getting lecture
notes ready for next week and thus am running into several questions
with Org HTML Export.  Unfortunately, my searches typically result in
manual page hits, but my problems seem to be a-typical.  So...

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

Any ideas?

--dag

P.S.  In reality, 2016 will be replaced with a function call which takes
an integer and converts it to a full blown date based on a starting
point.  Thus, the headlines will result in "Date: September 20, 2016"
where each date is different based on the integer.  This will allow me
to set the starting date at the top of the .org file and all the
date-based headlines can be computed.

[-- Attachment #2: Type: text/html, Size: 2039 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Disable org-babel-inline-result-wrap per inline code?
       [not found] <d406cbbb44ac455abd5c0a77c95b63ab@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2016-09-21  7:11 ` Eric S Fraga
  2016-09-21 14:15   ` David A. Gershman
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2016-09-21  7:11 UTC (permalink / raw)
  To: David A. Gershman; +Cc: emacs-orgmode@gnu.org

On Wednesday, 21 Sep 2016 at 06:07, David A. Gershman wrote:
> Given the following line:
>
> * Date: src_perl[:results output :exports none]{print 2016;}

How about 

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

?

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.90.1, Org release_8.3.3-535-g7213aa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Disable org-babel-inline-result-wrap per inline code?
  2016-09-21  6:07 Disable org-babel-inline-result-wrap per inline code? David A. Gershman
@ 2016-09-21 11:49 ` Adam Porter
  2016-09-21 14:23   ` David A. Gershman
  2016-09-21 14:11 ` Nick Dokos
  1 sibling, 1 reply; 7+ messages in thread
From: Adam Porter @ 2016-09-21 11:49 UTC (permalink / raw)
  To: emacs-orgmode

"David A. Gershman" <dagershman@dagertech.net> 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
> <code></code> 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.  :)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Disable org-babel-inline-result-wrap per inline code?
  2016-09-21  6:07 Disable org-babel-inline-result-wrap per inline code? David A. Gershman
  2016-09-21 11:49 ` Adam Porter
@ 2016-09-21 14:11 ` Nick Dokos
  1 sibling, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2016-09-21 14:11 UTC (permalink / raw)
  To: emacs-orgmode

"David A. Gershman" <dagershman@dagertech.net> writes:

> Forgive my several questions/emails.  I'm working on getting lecture
> notes ready for next week and thus am running into several questions
> with Org HTML Export.  Unfortunately, my searches typically result
> in manual page hits, but my problems seem to be a-typical.  So...
>
> 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 <code></code> tags surrounding the '2016'. 
>

I think that should be :exports results, not none.

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

C-h v org-babel-inline-result-wrap says that it has to have a %s in
it: you can't just set it to "".

> 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=")}
>

OTOH, modifying your attempt a bit to conform to the above did not work for me either:

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

still gives me the <code></code> tags. When I C-c C-c by hand on the
lisp src blocks, the variable does change value, so I don't understand
why putting the whole thing together does not work.

> 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.
>
> Any ideas?
>
> --dag
>
> P.S.  In reality, 2016 will be replaced with a function call which
> takes an integer and converts it to a full blown date based on a
> starting point.  Thus, the headlines will result in "Date: September
> 20, 2016" where each date is different based on the integer.  This
> will allow me to set the starting date at the top of the .org file
> and all the date-based headlines can be computed.
>

-- 
Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Disable org-babel-inline-result-wrap per inline code?
  2016-09-21  7:11 ` Eric S Fraga
@ 2016-09-21 14:15   ` David A. Gershman
  0 siblings, 0 replies; 7+ messages in thread
From: David A. Gershman @ 2016-09-21 14:15 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

Perfect!!  Thank you!!

I saw this option in the Manual (14.8.2.2) under /Format/, but it said
it "The results are interpreted asraw Org mode code..." so it didn't
click the results would "left alone".

Thanks again!

On 09/21/2016 12:11 AM, Eric S Fraga wrote:
> On Wednesday, 21 Sep 2016 at 06:07, David A. Gershman wrote:
>> Given the following line:
>>
>> * Date: src_perl[:results output :exports none]{print 2016;}
> How about 
>
> * Date: src_perl[:results output raw]{print 2016;}
>
> ?
>


[-- Attachment #2: Type: text/html, Size: 1099 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Disable org-babel-inline-result-wrap per inline code?
  2016-09-21 11:49 ` Adam Porter
@ 2016-09-21 14:23   ` David A. Gershman
  2016-09-21 20:04     ` Adam Porter
  0 siblings, 1 reply; 7+ messages in thread
From: David A. Gershman @ 2016-09-21 14:23 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2369 bytes --]



On 09/21/2016 04:49 AM, Adam Porter wrote:
> "David A. Gershman" <dagershman@dagertech.net> 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
>> <code></code> 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. :)



[-- Attachment #2: Type: text/html, Size: 3294 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Disable org-babel-inline-result-wrap per inline code?
  2016-09-21 14:23   ` David A. Gershman
@ 2016-09-21 20:04     ` Adam Porter
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Porter @ 2016-09-21 20:04 UTC (permalink / raw)
  To: emacs-orgmode

"David A. Gershman" <dagershman@dagertech.net> writes:

> FWIW, Eric had the solution:
>
> #+MACRO: gendate src_perl[:results output raw]{print ($1*5);}

Ah, yes, I tend to forget that :results can take multiple args.

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

Yes, you definitely should!

By the way, did you know that your client is sending HTML mail to the
list?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-21 20:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21  6:07 Disable org-babel-inline-result-wrap per inline code? David A. Gershman
2016-09-21 11:49 ` Adam Porter
2016-09-21 14:23   ` David A. Gershman
2016-09-21 20:04     ` Adam Porter
2016-09-21 14:11 ` Nick Dokos
     [not found] <d406cbbb44ac455abd5c0a77c95b63ab@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-09-21  7:11 ` Eric S Fraga
2016-09-21 14:15   ` David A. Gershman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).