From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: new exporter: link abbrev Date: Wed, 05 Dec 2012 22:05:32 +0100 Message-ID: <87y5hctdk3.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:32878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgMDy-0001yv-6l for emacs-orgmode@gnu.org; Wed, 05 Dec 2012 16:09:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgMDw-0000Ue-N2 for emacs-orgmode@gnu.org; Wed, 05 Dec 2012 16:09:46 -0500 Received: from mail-wg0-f51.google.com ([74.125.82.51]:34802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgMDw-0000UW-Fu for emacs-orgmode@gnu.org; Wed, 05 Dec 2012 16:09:44 -0500 Received: by mail-wg0-f51.google.com with SMTP id gg4so2462331wgb.30 for ; Wed, 05 Dec 2012 13:09:43 -0800 (PST) In-Reply-To: (Michael Brand's message of "Mon, 3 Dec 2012 16:20:22 +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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Brand Cc: Org Mode Hello, Michael Brand writes: > I think the new exporter should still expand link abbreviations also > when in the heading and for all backends. Example with html link on > today=E2=80=99s release_7.9.2-646-g664217: > > - Org file: > #+LINK: orgmode http://www.orgmode.org/ > * Org Mode doc [[orgmode:#docs]] > > - export to html: > - old exporter expands link: >

1 Org Mode d= oc > http://www.orgmode.org/#docs=

> - new exporter leaves link abbreviated: >

1 Org Mode d= oc > orgmode:#docs

> > - export to ascii: > - old exporter expands link: > 1 Org Mode doc [http://www.orgmode.org/#docs] > - new exporter omits link: > 1 Org Mode doc There are two things going on here.=20 The first one, which is minor, is that e-ascii back-end currently doesn't handle correctly translated links anywhere. This is easy to fix. The second one is a more difficult problem. Org Elements usually translates links on the fly when parsing them: `org-element-link-parser' calls `org-translate-link'. This function requires `org-link-abbrev-alist' and `org-link-abbrev-alist-local' variables to be set properly, the second one being a local variable. Unfortunately, parsing of secondary strings (in particular headline titles or inline footnote definitions) happens in a temporary buffer, where no local variable is set. There `org-link-abbrev-alist-local' is nil, no matter what your #+LINK: keyword says, and link translation can't happen. Also, local variables cannot be send to the temporary buffer, because secondary string parsing can sometimes happen when the original buffer isn't supposed to exist, that is during export (when the parse tree is the only trusted data). A possible solution would be to move link translation from org-element.el to org-export.el. But that would require to explicitly call a translator function on links, which would be an additional task for back-end developers. Also, `org-element-context' would not return anymore the real path of the abbreviated link, only its raw path. Regards, --=20 Nicolas Goaziou