emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "David A. Gershman" <dagershman@dagertech.net>
To: emacs-orgmode@gnu.org
Subject: Re: Disable org-babel-inline-result-wrap per inline code?
Date: Wed, 21 Sep 2016 07:23:49 -0700	[thread overview]
Message-ID: <d7497dcc-6676-3229-55ef-a3b5dc5a3608@dagertech.net> (raw)
In-Reply-To: <87k2e5scay.fsf@alphapapa.net>

[-- 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 --]

  reply	other threads:[~2016-09-21 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7497dcc-6676-3229-55ef-a3b5dc5a3608@dagertech.net \
    --to=dagershman@dagertech.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).