From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hrvoje Niksic Subject: Re: [PATCH] Markup on same line as text Date: Thu, 17 Feb 2011 22:58:05 +0100 Message-ID: <87ipwijpci.fsf@xemacs.org> References: <4D263E3B.5030407@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=52356 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqBrc-0006ai-Gt for emacs-orgmode@gnu.org; Thu, 17 Feb 2011 16:58:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqBrb-0000CK-KB for emacs-orgmode@gnu.org; Thu, 17 Feb 2011 16:58:16 -0500 Received: from smtp2.xnet.hr ([83.139.103.74]:47120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PqBrb-0000BY-Eq for emacs-orgmode@gnu.org; Thu, 17 Feb 2011 16:58:15 -0500 Received: from mail.globalnet.hr (cartman.bnet.hr [213.149.32.10]) by smtp2.xnet.hr (XnetMailOut) with ESMTP id F24518A41F for ; Thu, 17 Feb 2011 22:58:07 +0100 (CET) In-Reply-To: <4D263E3B.5030407@gmail.com> (Roland Kaufmann's message of "Thu, 06 Jan 2011 23:12:11 +0100") 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: Roland Kaufmann Cc: hniksic@xemacs.org, emacs-orgmode@gnu.org [ Please include me in the replies, as I'm not subscribed to emacs-orgmode. ] > > Your patch may work in this particular case, but the idea behind > > htmlize is to describe the state of the buffer. If a property ends > > after the newline, it is intended that the generated HTML reflect > > The philosophical question is then: Is the newline character part of the > syntax construct that is being fontified, or rather a "formatting code" > that should be kept separate? htmlize doesn't operate on the level of syntax-based fontification, it examines the display-related properties attached to buffer text (not necessarily by font-lock) and renders them into the corresponding HTML. If a display property includes the newline character, that will be reflected in the HTML. This works fine for displaying in a browser, but confuses org-mode's post-processing of HTML, which (if my understanding is correct) assumes that spans will be closed before the newline. This assumption is wrong in the case you present. However, using htmlize-before-hook, it is trivial to make the assumption correct by resetting the property. Here is your example, modified to do so: (let ((filename (expand-file-name "foo.org" temporary-file-directory))) (switch-to-buffer (find-file-noselect filename)) (erase-buffer) (insert "* #+BEGIN_SRC emacs-lisp (let ((x 42)) ; meaning of l.u.e. (print x)) ; (ref:2) #+END_SRC") (save-buffer) (org-mode) (let ((htmlize-before-hook htmlize-before-hook)) (add-hook 'htmlize-before-hook (lambda () (goto-char (point-min)) (while (progn (end-of-line) (not (eobp))) (put-text-property (point) (1+ (point)) 'face nil) (forward-char 1)))) (org-export-as-html nil)))