From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: [PATCH] HTML export - Do not add spaces to the data in
 sections
Date: Wed, 03 Sep 2008 08:00:20 -0400
Message-ID: <87zlmpqw17.fsf@gollum.intra.norang.ca>
References: <87abflt00u.fsf@gollum.intra.norang.ca>
	<4F9AE931-E700-4F32-A079-EDC2D451FF98@uva.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-path: 
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kar2H-0007IO-0C
	for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 08:00:33 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kar2E-0007Ge-CL
	for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 08:00:30 -0400
Received: from [199.232.76.173] (port=49060 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kar2D-0007GM-Af
	for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 08:00:29 -0400
Received: from mho-02-bos.mailhop.org ([63.208.196.179]:54258)
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from ) id 1Kar2C-0006A2-Kg
	for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 08:00:28 -0400
In-Reply-To: <4F9AE931-E700-4F32-A079-EDC2D451FF98@uva.nl> (Carsten Dominik's
	message of "Wed\, 3 Sep 2008 11\:36\:57 +0200")
List-Id: "General discussions about Org-mode." 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
To: Carsten Dominik 
Cc: org-mode mailing list 

Carsten Dominik  writes:

> Hi Bernt,  I am not sure if I understand your patch correctly:

Hi Carsten!  Welcome back :)

> 
>
> On Aug 10, 2008, at 4:30 PM, Bernt Hansen wrote:
>
>     
 sections for HTML export should be clean.  We can use styles
>     to indent the text if that is desired.
>    
>     This allows copying and pasting the text from the HTML document
>     so that you get the original data in the
>     #+BEGIN_EXAMPLE
>     ..
>     #+END_EXAMPLE
>     block.
>     ---
>    
>     I use 
..
sections to save commands I use regularly in my > system documentation. I copy and paste data directly from these > sections and noticed the extra 2 blanks preceeding the data. > > This change removes the blanks only for HTML export. The latex and > Ascii exports are unchanged. > > lisp/org-exp.el | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lisp/org-exp.el b/lisp/org-exp.el > index 32fa819..98fb4fe 100644 > --- a/lisp/org-exp.el > +++ b/lisp/org-exp.el > @@ -2953,7 +2953,7 @@ lang=\"%s\" xml:lang=\"%s\"> > > ;; Fixed-width, verbatim lines (examples) > (when (and org-export-with-fixed-width > - (string-match "^[ \t]*:\\(.*\\)" line)) > + (string-match "^[ \t]*: \\(.*\\)" line)) > > Why are you matching exactly two spaces here? Ah, I guess I am inserting > these when processing the examples.... > Maybe it would be better to not insert the spaces, or insert them for ascii > export only. I will do that. Thanks. Basically I don't want blanks put into the
 section as part of the
data.

I originally took out the 2 spaces instead of inserting them but that
affected both latex and ASCII exports and didn't look 'better' IMO.  My
goal here is just to keep the HTML output identical to what is in the
#+BEGIN_EXAMPLE..#+END_EXAMPLE block.  If we want preceeding blanks on
the data we can just put it in the original source text.

------------------------------------------------------------------------

If I do this

,----
| #+BEGIN_EXAMPLE
| $ somecommand
| data for the
| command goes here
| #+END_EXAMPLE
`----

the exported HTML output has 2 spaces in front of the data like this:

,----
| 
|   $ somecommand
|   data for the
|   command goes here
| 
`---- The 2 preceeding blanks are put in during preprocessing of the example section. I don't want the preceeding 2 blanks. They are mostly a formatting issue and with CSS we can format the
 
data anyway we want so adding the blanks isn't really helpful. It's easy to indent the
..
section with CSS to get the same result as the embedded blanks without resorting to adding preceeding blanks to the lines. When cutting and pasting data from the resulting HTML I don't want the extra blanks in the data since that's not really part of the original data. For some programs the data lines (following the $ somecommand) needs to be verbatim and I have to cut and paste each line separately instead of the entire block from the example. The patch makes the output look like this instead: ,---- |
| $ somecommand
| data for the
| command goes here
| 
`---- and if you select it, copy it from the HTML page and paste it to a buffer you get the original text. Thanks! -Bernt