emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: How to add comments in a plain list


From: Carsten Dominik
Subject: Re: [Orgmode] Re: How to add comments in a plain list
Date: Tue, 22 Sep 2009 13:10:09 +0100


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 via email to

[Prev in Thread] Current Thread [Next in Thread]