From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roland Kaufmann Subject: Markup problems when using references in source fragments (was: Markup on same line as text) Date: Wed, 11 May 2011 21:41:20 +0200 Message-ID: <4DCAE660.2020008@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010201080106080800050308" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKFHd-0007vF-Ap for emacs-orgmode@gnu.org; Wed, 11 May 2011 15:41:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QKFHb-0005Pd-VB for emacs-orgmode@gnu.org; Wed, 11 May 2011 15:41:21 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:60589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKFHb-0005PX-QW for emacs-orgmode@gnu.org; Wed, 11 May 2011 15:41:19 -0400 Received: by ewy9 with SMTP id 9so291037ewy.0 for ; Wed, 11 May 2011 12:41:18 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------010201080106080800050308 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On February 27th I submitted a patch proposal to fix HTML export of line number references in source code fragments. The discussion leading up to the patch can be found in the thread: As far as I can see, it is not in the source tree as of revision 62d4dd, but the problem still remains. I am grateful for feedback on its lackings, if the patch is deemed unsatisfactory in any way. In case it simply got lost amidst all the other traffic, I resubmit it, updated so it applies to the current revision. -- Roland. --------------010201080106080800050308 Content-Type: text/plain; name="0001-Fix-markup-problems-when-using-ref.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-markup-problems-when-using-ref.patch" >From 98e2a586eb0e911ec6b5bedeec4af5f00ee2bf6c Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Sun, 27 Feb 2011 20:52:31 +0100 Subject: [PATCH] Fix markup problems when using references in source fragments * org-exp.el (org-export-format-source-code-or-example): fontify one line at the time to avoid partial overlap between fontification and reference markup. --- lisp/org-exp.el | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 9a35b00..dbcf105 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2446,6 +2446,15 @@ in the list) and remove property and value from the list in LISTVAR." (defvar org-export-latex-listings-options) ;; defined in org-latex.el (defvar org-export-latex-minted-options) ;; defined in org-latex.el +(defun org-remove-formatting-on-newlines-in-region (beg end) + "Remove formatting on newline characters" + (interactive "r") + (save-excursion + (goto-char beg) + (while (progn (end-of-line) (< (point) end)) + (put-text-property (point) (1+ (point)) 'face nil) + (forward-char 1)))) + (defun org-export-format-source-code-or-example (lang code &optional opts indent caption) "Format CODE from language LANG and return it formatted for export. @@ -2532,6 +2541,8 @@ INDENT was the original indentation of the block." (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) + ;; markup each line separately + (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste -- 1.7.1 --------------010201080106080800050308--