From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Orgmode fails to export specific web-links as latex/pdf Date: Tue, 09 Jul 2013 15:48:01 +0200 Message-ID: <877ggzn8tq.fsf@gmail.com> References: <87y59gt27c.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwYGm-0002Lr-OK for emacs-orgmode@gnu.org; Tue, 09 Jul 2013 09:47:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwYGk-0007K2-E3 for emacs-orgmode@gnu.org; Tue, 09 Jul 2013 09:47:52 -0400 In-Reply-To: <87y59gt27c.fsf@bzg.ath.cx> (Bastien's message of "Tue, 09 Jul 2013 13:14:31 +0200") 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: Bastien Cc: emacs-orgmode , Mark Edgington Hello, Bastien writes: > I confirm this bug: "%" in links breaks the export. > > The attached patch is a quick fix, but it needs to be double-checked > and surely amended. Also, I didn't check other link-related functions. > > Thanks for reporting this bad bug, > > > diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el > index aa30cf1..650b7cc 100644 > --- a/lisp/ox-latex.el > +++ b/lisp/ox-latex.el > @@ -1748,7 +1748,9 @@ DESC is the description part of the link, or the empty string. > INFO is a plist holding contextual information. See > `org-export-data'." > (let* ((type (org-element-property :type link)) > - (raw-path (org-element-property :path link)) > + (raw-path (org-latex-plain-text > + (org-link-escape (org-element-property :path link)) > + info)) > ;; Ensure DESC really exists, or set it to nil. > (desc (and (not (string= desc "")) desc)) > (imagep (org-export-inline-image-p Actually, some characters need to be escaped when used in a URL within a \href command, but not all of them. `org-latex-plain-text' escapes too many of them and `org-link-escape' doesn't escape enough (and we don't need to rely on it). According to hyperref documentation # and ~ need not be escaped. Though, %, { and } do. I'm not sure about \, ^ and _. Also, I don't think \url command has the same problem, so escaping can happen later in the function, not at the `raw-path' level. Regards, -- Nicolas Goaziou