From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [dev] Implement "ref" link types Date: Mon, 20 Feb 2012 11:59:05 +0100 Message-ID: <87y5rx22km.fsf@gmail.com> References: <87vcn2vgq7.fsf@gmail.com> <8739a62upy.fsf@gmail.com> <763A8736-3DB8-492D-95CB-2E2D90982BAE@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzQyp-0007Jg-JR for emacs-orgmode@gnu.org; Mon, 20 Feb 2012 06:00:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RzQye-000879-4K for emacs-orgmode@gnu.org; Mon, 20 Feb 2012 06:00:27 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:57467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzQyd-00086q-SN for emacs-orgmode@gnu.org; Mon, 20 Feb 2012 06:00:16 -0500 Received: by wibhj13 with SMTP id hj13so3719531wib.0 for ; Mon, 20 Feb 2012 03:00:14 -0800 (PST) In-Reply-To: <763A8736-3DB8-492D-95CB-2E2D90982BAE@gmail.com> (Carsten Dominik's message of "Mon, 20 Feb 2012 08:09:38 +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: Carsten Dominik Cc: Org Mode List Hello, Carsten Dominik writes: > On Feb 20, 2012, at 1:51 AM, Nicolas Goaziou wrote: >> There are still a few limitations. For example, you cannot reference >> a precise list item since items do not accept affiliated keywords. > Ah, yes, this is right. Thinking about it, there may exist a better alternative to [[ref:name]] links: fuzzy links. In other words, "#+name: something" could be made an alternate of "<>", with a lower priority. On the Org side, when a link like [[something]] or [[something][text]] is encountered in a buffer, the search would go on like this: 1. Search any "<>" or "#+target: something"[1]. 2. If none is found, search any "#+name: something". 3. If it fails, try to find the headline "* something". 4. Eventually offer to create such headline. This step doesn't apply during export. On the export side, it depends on the description part of the link: - If there's a description (i.e. [[something][description]]), display it and link to target if possible, whatever that target is. - If there's no description: 1. A link to an invisible target will be replaced with _nothing_ (that's the point of being invisible). 2. A link to a target (i.e. <>) will be replaced with the sequence number of the closest item or headline[2]. Examples: #+begin_src org - item one - item two - <> item two dot one #+end_src Any link like [[here]] will be replaced with "2.1" during export. #+begin_src org * Headline one * Headline two * Headline two dot one Some paragraph. Another paragraph <>. #+end_src Here [[warning]] will also be replaced with "2.1" during export. Note that [[Headline two dot one]] would also be replaced with "2.1". 3. An link to an element (i.e. "#+name: something") would return the sequence number of that element among elements of the same type with a caption, a name affiliated keyword, or both. Example: #+begin_src org #+name: letters #+caption: I know my alphabet. |a|b|c| |foo|bar| #+name: numbers |1|2|3| #+end_src Here, a [[numbers]] link would be replaced with 2, since middle table has no name nor caption. To sum it up, at a quick glance, I can see the following: - Pros :: + No new syntax, + Possibly number every element, including items. - Cons :: + Fuzzy links are a bit overloaded, but, on the other hand, linking to headlines is not very useful since custom-id and id implementation. + There is more documentation to write. Again, what do you think? Regards, [1] This is the replacement for invisible targets, since they cannot live in comments anymore. [2] If headlines are not numbered (i.e. num:nil), replace link with headline's title instead. -- Nicolas Goaziou