emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] new exporter: link abbrev


From: Nicolas Goaziou
Subject: Re: [O] new exporter: link abbrev
Date: Wed, 05 Dec 2012 22:05:32 +0100

Hello,

Michael Brand <address@hidden> 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’s 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:
>     <h2 id="sec-1"><span class="section-number-2">1</span> Org Mode doc
>     <a 
> href="http://www.orgmode.org/#docs";>http://www.orgmode.org/#docs</a></h2>
>   - new exporter leaves link abbreviated:
>     <h2 id="sec-1"><span class="section-number-2">1</span> Org Mode doc
>     <i>orgmode:#docs</i></h2>
>
> - 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. 

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,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]