From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thibault Marin Subject: Possible bug with coderef highlighting in HTML export Date: Sun, 03 Dec 2017 04:35:30 -0600 Message-ID: <87lgikp099.fsf@dell-desktop.WORKGROUP> Reply-To: thibault.marin@gmx.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLRcb-0006OX-1Z for emacs-orgmode@gnu.org; Sun, 03 Dec 2017 05:35:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLRcW-0000uV-3z for emacs-orgmode@gnu.org; Sun, 03 Dec 2017 05:35:41 -0500 Received: from mout.gmx.net ([212.227.17.21]:56660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eLRcV-0000ty-QD for emacs-orgmode@gnu.org; Sun, 03 Dec 2017 05:35:36 -0500 Received: from dell-desktop ([99.47.196.62]) by mail.gmx.com (mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MJSuF-1eMpCR2xwZ-0036L5 for ; Sun, 03 Dec 2017 11:35:32 +0100 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" To: org mode Hi all, I am using Org mode version 9.1.3 (release_9.1.3-216-g259656 @ /.../org-mode/lisp/) and I am experiencing an issue with the exported HTML of the following org file: ,---- | this links get highlighted [[(link0)]]. | | this link does not get highlighted [[(link1)]]. | | #+begin_src emacs-lisp -r | 0(ref:link0) | #+end_src | | #+begin_src emacs-lisp -r | | 1(ref:link1) | #+end_src `---- The relevant HTML output is: ,---- |

| this links get highlighted 1. |

| |

| this link does not get highlighted 1. |

| |
|
0
| 
|
| |
|
1
| 
|
`---- The issue is that the link to the line in the second source block is not highlighted (it does not get the "coderef-off" span markup). I tried to dig a little and it appears that `org-html-do-format-code' does not handle empty lines at the beginning of a block. `(org-split-string "\n1")' returns '("1") which looses the first empty line. The line reference received via the `refs' variable (which has value ((2 . link1))) then becomes out of sync with the `code' variable (split by lines) used for formatting of the code block. I am not sure what is the best way to handle this: 1. Should the `refs' variable be built accounting for the top empty lines? 2. Alternatively, should the `org-html-do-format-code' and `org-export-format-code' functions count the number of top empty lines and adjust the line number accordingly? 3. Should top empty lines be completely deleted, before the `refs' array is built? I can try to propose a patch if the best option can be decided. Option 2 seems relatively simple but feels like a hack. I would appreciate any suggestions on how to best fix this. Thanks in advance. thibault