From: Hrvoje Niksic <hniksic@xemacs.org>
To: Roland Kaufmann <roland.kaufmann@gmail.com>
Cc: hniksic@xemacs.org, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Markup on same line as text
Date: Thu, 17 Feb 2011 22:58:05 +0100 [thread overview]
Message-ID: <87ipwijpci.fsf@xemacs.org> (raw)
In-Reply-To: <4D263E3B.5030407@gmail.com> (Roland Kaufmann's message of "Thu, 06 Jan 2011 23:12:11 +0100")
[ 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)))
next prev parent reply other threads:[~2011-02-17 21:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-06 22:12 [PATCH] Markup on same line as text Roland Kaufmann
2011-02-16 20:04 ` Hrvoje Niksic
2011-02-16 21:53 ` Roland Kaufmann
2011-02-17 21:58 ` Hrvoje Niksic [this message]
2011-02-19 14:26 ` Roland Kaufmann
2011-02-19 23:49 ` Hrvoje Niksic
2011-02-26 9:39 ` Bastien
2011-02-27 21:09 ` Roland Kaufmann
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=87ipwijpci.fsf@xemacs.org \
--to=hniksic@xemacs.org \
--cc=emacs-orgmode@gnu.org \
--cc=roland.kaufmann@gmail.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).