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:

   <http://thread.gmane.org/gmane.emacs.orgmode/35810>

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.
>From 98e2a586eb0e911ec6b5bedeec4af5f00ee2bf6c Mon Sep 17 00:00:00 2001
From: Roland Kaufmann <rlndkfmn+orgm...@gmail.com>
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

Reply via email to