From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Bach Subject: Re: LaTeX export: Handle hash symbol in footnote url links Date: Thu, 10 Apr 2014 19:25:16 +0200 Message-ID: <5346D3FC.2090104@gmail.com> References: <20140221111408.GH904@smoon> <53074D4F.4090808@gmail.com> <8738j6t141.fsf@gmail.com> Reply-To: phaebz@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYIj7-0005uX-Kp for emacs-orgmode@gnu.org; Thu, 10 Apr 2014 13:25:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYIj2-0003k4-MQ for emacs-orgmode@gnu.org; Thu, 10 Apr 2014 13:25:25 -0400 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]:44423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYIj2-0003ji-GX for emacs-orgmode@gnu.org; Thu, 10 Apr 2014 13:25:20 -0400 Received: by mail-ee0-f43.google.com with SMTP id e53so3275889eek.2 for ; Thu, 10 Apr 2014 10:25:19 -0700 (PDT) In-Reply-To: <8738j6t141.fsf@gmail.com> 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: Nicolas Goaziou Cc: Vladimir Lomov , emacs-orgmode@gnu.org On 2/26/14 3:11 PM, Nicolas Goaziou wrote: > Hello, > > Michael Bach writes: > >> Thanks for your answer. `\url` can handle hash symbols in its argument >> without escaping alright - as can be expected. AFAICS, the problem lies >> in the `\footnote` command. And yes, I was thinking of `ox-latex` >> figuring out that the url is in a footnote and escape accordingly. >> >> I can see that the export engine should not and cannot cover all special >> cases, but since links and footnotes are `first-class` org-mode >> concepts, it would be nice to have them play along in this situation. >> From a typographic point of view, I figured url links in footnotes are >> not that unusual. > > This needs to be properly defined. > > Where protecting characters in verbatim parts of the buffer should > happen? Within footnotes only? In every verbatim part? And on which > characters? > Ok, using org-element, we could escape special symbols - for now, only '#', '%' and '&' come to mind - in http links iff they are inside a footnote and exporter backend is latex. As I said, if this is too special a case to be supported, I was playing around with regexps and `org-export-filter-final-output-functions' as seen e.g. in [1]. On other occasions that involved in-buffer replacements, I had success using group matching with the `re-search-forward', `replace-match' and `match-string' functions (see also [2]). But IIUC, since the export filter function gets passed a string with the .tex export results, I need a function that operates on a string such as `replace-regexp-in-string' as seen in [1]. Now I assume for in-string regexp replacement and the use case at hand I would need a (missing) lookbehind feature [3], don't I? Please let me know whether you think this is feasible. Best Regards, Michael [1] https://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00146.html [2] http://stackoverflow.com/questions/6395898/emacs-how-do-i-replace-regexp-with-a-lisp-function-in-a-defun [3] http://comments.gmane.org/gmane.emacs.devel/147844