From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Leech-Pepin Subject: Re: src blocks in texinfo export Date: Sun, 10 Mar 2013 15:49:29 -0400 Message-ID: References: <87liat35ny.fsf@sofia.zeitform.net> <8738x1p4l3.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5016299c3d99e04d7975af6 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:44816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEmFR-0002JA-3W for emacs-orgmode@gnu.org; Sun, 10 Mar 2013 15:49:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEmFO-0006bs-Bx for emacs-orgmode@gnu.org; Sun, 10 Mar 2013 15:49:32 -0400 Received: from mail-ve0-f181.google.com ([209.85.128.181]:44952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEmFO-0006bo-6N for emacs-orgmode@gnu.org; Sun, 10 Mar 2013 15:49:30 -0400 Received: by mail-ve0-f181.google.com with SMTP id d10so2231381vea.40 for ; Sun, 10 Mar 2013 12:49:29 -0700 (PDT) In-Reply-To: <8738x1p4l3.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dario Hamidi Cc: emacs-orgmode@gnu.org --bcaec5016299c3d99e04d7975af6 Content-Type: text/plain; charset=UTF-8 Hello Dario, On 12 February 2013 17:09, Dario Hamidi wrote: > > Hello Jonathan, > > > Using your patch as is would wrap the source blocks in both example and > > verbatim blocks. If going with verbatim it would be better to remove all > > references to @example/@end example. > > I don't understand where the problem lies with having a `@verbatim' > within a `@example'. Could you maybe explain to me why this is > problematic? > > Using both environments seems to achieve the goal of having an idented > source block in the resulting info file without having to further > process the source block before export. > > Consider exporting > > #+BEGIN_SRC sh > function fails > { > echo "this causes an error with makeinfo" > } > #+END_SRC > > with only the verbatim environment: > > File: test.info, Node: Top, Up: (dir) > > Manual > ****** > > function fails > { > echo "this causes an error with makeinfo" > } > > and with verbatim in example: > > File: test.info, Node: Top, Up: (dir) > > Manual > ****** > > function fails > { > echo "this causes an error with makeinfo" > } > > > It should be possible to escape any braces or @ before inserting them > into > > the > > example block to ensure there is no expansion. > > While it certainly is possible, it would also mean to properly escape > *all* characters with a special meaning to TeX. I suppose that making > text containing such characters visible in a document without having to > escape them is what the verbatim environment is for. > > > The only differences in using @verbatim over escaping any characters in > > @example are the following: > > - Tabs are treated as tabs and not as single spaces > > - The code block is not indented. > > Preserving whitespace seems like a good idea when displaying python > source code or makefiles. > > Dario > I've implemented a fix for this that should resolve the issue. `@ { }` are now properly escaped before export within source blocks. I didn't wrap the one block in the other since the issue also existed within lisp blocks (where inserting a verbatim block within a lisp block would have likely caused issues had someone wanted to extract any @lisp code from the info file. Regards, Jon --bcaec5016299c3d99e04d7975af6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello Dario,

On 12 February 2013 17:09, D= ario Hamidi <dario.hamidi@gmail.com> wrote:

Hello Jonathan,

> Using your patch as is would wrap the source blocks in both example an= d
> verbatim blocks. =C2=A0If going with verbatim it would be better to re= move all
> references to @example/@end example.

I don't understand where the problem lies with having a `@verbati= m'
within a `@example'. Could you maybe explain to me why this is
problematic?

Using both environments seems to achieve the goal of having an idented
source block in the resulting info file without having to further
process the source block before export.

Consider exporting

=C2=A0 =C2=A0 #+BEGIN_SRC sh
=C2=A0 =C2=A0 function fails
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "this causes an error with makeinfo&q= uot;
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 #+END_SRC

with only the verbatim environment:

=C2=A0 =C2=A0 File: test.inf= o, =C2=A0Node: Top, =C2=A0Up: (dir)

=C2=A0 =C2=A0 Manual
=C2=A0 =C2=A0 ******

=C2=A0 =C2=A0 function fails
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "this causes an error with makeinfo&q= uot;
=C2=A0 =C2=A0 }

and with verbatim in example:

=C2=A0 =C2=A0 File: test.inf= o, =C2=A0Node: Top, =C2=A0Up: (dir)

=C2=A0 =C2=A0 Manual
=C2=A0 =C2=A0 ******

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0function fails
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0echo "this causes an e= rror with makeinfo"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}

> It should be possible to escape any braces or @ before inserting them = into
> the
> example block to ensure there is no expansion.

While it certainly is possible, it would also mean to properly escape=
*all* characters with a special meaning to TeX. =C2=A0I suppose that making=
text containing such characters visible in a document without having to
escape them is what the verbatim environment is for.

> The only differences in using @verbatim over escaping any characters i= n
> @example are the following:
> =C2=A0 - Tabs are treated as tabs and not as single spaces
> =C2=A0 - The code block is not indented.

Preserving whitespace seems like a good idea when displaying python source code or makefiles.

Dario

I've implemented a fix for this th= at should resolve the issue.=C2=A0 `@ { }` are now
properly escaped bef= ore export within source blocks.=C2=A0 I didn't wrap the one
block i= n the other since the issue also existed within lisp blocks (where
inserting a verbatim block within a lisp block would have likely caused iss= ues
had someone wanted to extract any @lisp code from the info file.
=
Regards,

Jon
--bcaec5016299c3d99e04d7975af6--