emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: emacs org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [babel] options to the example directive
Date: Tue, 03 Nov 2009 12:34:52 -0500	[thread overview]
Message-ID: <87ws27jyv7.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <87ljinwtdm.wl%ucecesf@ucl.ac.uk> (Eric S. Fraga's message of "Tue, 03 Nov 2009 14:55:01 +0000")

Eric S Fraga <ucecesf@ucl.ac.uk> writes:

> I am finding org-babel incredibly useful in the preparation of
> documentation for didactic purposes.  Kudos to the developers!  
>
> I have two queries that I cannot seem to find an answer to in the
> documentation: 
>
> 1. is there any way to specify arguments that should be generated for
>    the #+begin_example line for the results of a babel invocation?

Not currently. When exporting the *code* contained in a block, then any
switches placed after begin_src are reinstated in the output code
block. I.e.

begin_src XXX <switches> :exports code
...

becomes

begin_src XXX <switches>
...

However when a begin_example block is created as *results*, it is
created without any switches. I'm tending to think that it would be
inappropriate to simply reinstate the src block switches in the results
block. How do you suggest this option should be made available? Perhaps
a new header arg, or as a variable org-babel-results-block-switches, or
both?

Note that you will need to set org-babel-min-lines-for-block-output to
zero in order to guarantee that output is enclosed in a begin_example
block. Otherwise small chunks of output will be made verbatim by
prepending lines with ': ', in which case (I believe) the -t switch is
unavailable.


>    Specifically, I would like to append automatically, for instance,
>    arguments such as "-t -w 100 -h 20" so that the export to HTML
>    output is presented in a text box that has scroll bars etc.

>
> 2. even if I manually put the options on the begin_example line, the
>    export to HTML creates a '<pre class="example">' directive instead
>    of what I would expect: '<textarea cols="40" rows="10">' or
>    something similar.  I don't understand why exporting a file without
>    babel constructs should behave differently from exporting with

This is a consequence of the same issue: org-exp-blocks preprocesses
your src block in a pre-export buffer (a copy of the original), hands it
to org-babel, which creates the results block (overwriting the version
where you had manually inserted switches), and that results block lacks
any switches.

Dan

>    babel.  Should a begin_example section not export the same in both
>    cases?
>
> I am using org-mode and babel up to date as of this morning.
>
> Any pointers highly welcome!
>
> Thanks,
> eric
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2009-11-03 17:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 14:55 [babel] options to the example directive Eric S Fraga
2009-11-03 17:34 ` Dan Davison [this message]
2009-11-03 20:57   ` Eric Schulte
2009-11-04  9:45     ` Eric S Fraga
2009-11-04 18:52       ` Dan Davison
2009-11-04 22:01         ` Eric Schulte

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=87ws27jyv7.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=e.fraga@ucl.ac.uk \
    --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).