all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Sebastien Vauban <wxhgmqzgwmuf@spammotel.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Code blocks in lists?
Date: Sat, 19 May 2012 18:48:45 -0400	[thread overview]
Message-ID: <87havbbxde.fsf@gmx.com> (raw)
In-Reply-To: <80bollteav.fsf@somewhere.org> (Sebastien Vauban's message of "Fri, 18 May 2012 22:38:48 +0200")

>>> The export (see HTML), while being semantically correct in the sense that code
>>> blocks do belong to the items, seems wrong wrt the indentation, something like
>>> this:
>>>
>>> 1. Download and install color-theme.
>>>
>>>       #+begin_src emacs-lisp
>>>       (add-to-list 'load-path "/path/to/color-theme-6.6.0")
>>>       (require 'color-theme)
>>>       #+end_src
>>>
>>>    1. Download and install color-theme-leuven.
>>>
>>>             #+begin_src emacs-lisp
>>>             (add-to-list 'load-path "/path/to/color-theme-leuven")
>>>             (require 'color-theme-leuven)
>>>             #+end_src
>>>
>>>       1. Restart Emacs.
>>>
>>>                   #+begin_src emacs-lisp
>>>                   (restart)
>>>                   #+end_src
>>>
>>> A bit like if the indentation was "doubled" each time. What do you think of
>>> that?
>>
>> This indentation is an HTML/CSS issue, as far as I can tell Org-mode is
>> generating the correct HTML.
>
> I don't think it's a HTML/CSS issue: if you look at the produced HTML, you see
> respectively 3 whitespaces (or 6 or 9) in front of every line of the code
> block.
>
> That is: the "indentation" whitespaces in your Org buffer are copied over to
> HTML. And, as the code blocks are now correctly indented under their parent
> item, the leading whitespaces are further indenting the code blocks.
>
> So, for me, there should be no extra whitespace added to the code block in the
> PRE tags.
>

My fault, I thought you were talking about the indentation of the code
block as a whole, not the code *within* the code block.

Currently when the `org-src-preserve-indentation' variable is set it
preserves the indentation between the beginning of the line and the
beginning of the code, not the indentation between the beginning of the
code block and the beginning of the code, so for example the following
un-intuitive option would control the indentation within the code
blocks.

1. Download and install color-theme.

      #+begin_src emacs-lisp
(add-to-list 'load-path "/path/to/color-theme-6.6.0")
(require 'color-theme)
      #+end_src

   1. Download and install color-theme-leuven.

            #+begin_src emacs-lisp
(add-to-list 'load-path "/path/to/color-theme-leuven")
(require 'color-theme-leuven)
            #+end_src

      1. Restart Emacs.

                  #+begin_src emacs-lisp
(restart)
                  #+end_src

I think this is a feature of `org-src-preserve-indentation' which should
probably be changed to make using it with indented code blocks more
natural.  In this case, unless you need to preserve indentation within a
code block a simpler solution is to set `org-src-preserve-indentation'
to nil.

Hope this helps,

>
>>> [1] BTW, GitHub seems to use that setting, as they show the same problem as I
>>> had initially, when exporting README.org to HTML.
>>
>> Github uses a ruby library named "org-ruby" to export, it is an entirely
>> separate export implementation.
>
> OK.
>
> Best regards,
>   Seb

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

      reply	other threads:[~2012-05-20  0:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18  8:39 Code blocks in lists? Sebastien Vauban
2012-05-18  9:02 ` Nicolas Goaziou
     [not found]   ` <87obpl3lre.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-18 11:50     ` **: " Sebastien Vauban
2012-05-18 11:50     ` Sebastien Vauban
     [not found]   ` <1337342641.WXHGMQZGWMUF@spammotel.com>
2012-05-18 13:44     ` Nicolas Goaziou
2012-05-18 12:09 ` Eric Schulte
2012-05-18 14:40 ` Sebastien Vauban
2012-05-18 13:08   ` Eric Schulte
2012-05-18 18:55     ` Sebastien Vauban
2012-05-18 17:11       ` Eric Schulte
2012-05-18 20:38         ` Sebastien Vauban
2012-05-19 22:48           ` Eric Schulte [this message]

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

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

  git send-email \
    --in-reply-to=87havbbxde.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wxhgmqzgwmuf@spammotel.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.