emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Roland Kaufmann <rlndkfmn+orgmode@gmail.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <4DCAE660.2020008@gmail.com> (raw)

[-- 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


             reply	other threads:[~2011-05-11 19:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11 19:41 Roland Kaufmann [this message]
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

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=4DCAE660.2020008@gmail.com \
    --to=rlndkfmn+orgmode@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).