emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Markup problems when using references in source fragments (was: Markup on same line as text)
@ 2011-05-11 19:41 Roland Kaufmann
  2011-05-11 19:51 ` Markup problems when using references in source fragments Bernt Hansen
  2011-05-25  7:41 ` Markup problems when using references in source fragments (was: Markup on same line as text) Carsten Dominik
  0 siblings, 2 replies; 10+ messages in thread
From: Roland Kaufmann @ 2011-05-11 19:41 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

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.

[-- Attachment #2: 0001-Fix-markup-problems-when-using-ref.patch --]
[-- Type: text/plain, Size: 1708 bytes --]

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-05-25 14:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-11 19:41 Markup problems when using references in source fragments (was: Markup on same line as text) Roland Kaufmann
2011-05-11 19:51 ` Markup problems when using references in source fragments Bernt Hansen
2011-05-11 20:06   ` Roland Kaufmann
2011-05-11 20:21     ` Bernt Hansen
2011-05-12  6:59       ` Nick Dokos
2011-05-12 10:56         ` Giovanni Ridolfi
2011-05-12 12:43         ` Bernt Hansen
2011-05-12 13:48           ` Nick Dokos
2011-05-25  7:41 ` Markup problems when using references in source fragments (was: Markup on same line as text) Carsten Dominik
2011-05-25 10:31   ` Carsten Dominik

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).