emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: René <jlr_0@yahoo.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: How to add comments in a plain list
Date: Tue, 22 Sep 2009 13:10:09 +0100	[thread overview]
Message-ID: <F5CB1BC8-8F84-415F-B229-719D4DB331A5@gmail.com> (raw)
In-Reply-To: <loom.20090922T132420-706@post.gmane.org>


On Sep 22, 2009, at 12:32 PM, René wrote:

> Bernt Hansen <bernt <at> norang.ca> writes:
>> You can ident the comment like this
>>
>> 1. first
>> 2. second
>>
>>    # comment about second item
>>
>> 3. third
>> 4. fourth
>
> Unfortunately in this case your comment gets exported since the `#'  
> is indented.
>
> Of course one doesn't want the comments to appear in the html  
> version of the
> document.
>
> Is there a way to easily solve this issue?

You can always add a function to one of the org-export-preprocess-...  
hooks.
However, if you are not careful, you might remove something like

    #!/bin/sh

    in a source code block, or some normal text where,
    #25 starts a new line by accident.

It may be relatively safe to look for # followed by space, or
lines that have only "#" ad the only nonwhite character on a line.

Something like this might work (untested)

(add-hook
  'org-export-preprocess-before-backend-specifics-hook
  (lambda ()
    (goto-char (point-min))
    (while (re-search-forward "^[ \t]+#\\([ \t]*$\\| .*$\\)\n?" nil t)
      (org-if-unprotected-at (match-beginning 1)
       (replace-match "")))))


HTH

- Carsten

      reply	other threads:[~2009-09-22 12:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-22  2:37 How to add comments in a plain list René
2009-09-22  4:16 ` Bernt Hansen
2009-09-22 11:20   ` Eric S Fraga
2009-09-22 12:52     ` Bernt Hansen
2009-09-22 13:20       ` Eric S Fraga
2009-09-22 14:10         ` Bernt Hansen
2009-09-22 15:53           ` Eric S Fraga
2009-09-22 18:30             ` René
2009-09-24  9:27               ` Carsten Dominik
2009-09-25 10:10                 ` Eric S Fraga
2009-09-28  7:21                   ` Carsten Dominik
2009-09-22 11:32   ` René
2009-09-22 12:10     ` Carsten Dominik [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

  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=F5CB1BC8-8F84-415F-B229-719D4DB331A5@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jlr_0@yahoo.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 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).