emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [dev] Implement "ref" link types
Date: Mon, 20 Feb 2012 11:59:05 +0100	[thread overview]
Message-ID: <87y5rx22km.fsf@gmail.com> (raw)
In-Reply-To: <763A8736-3DB8-492D-95CB-2E2D90982BAE@gmail.com> (Carsten Dominik's message of "Mon, 20 Feb 2012 08:09:38 +0100")

Hello,

Carsten Dominik <carsten.dominik@gmail.com> 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 "<<something>>", 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 "<<something>>" 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. <<something>>) will be replaced with the
       sequence number of the closest item or headline[2]. Examples:

       #+begin_src org
       - item one
       - item two
         - <<here>> 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 <<warning>>.
       #+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

  reply	other threads:[~2012-02-20 11:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-19 18:08 [dev] Implement "ref" link types Nicolas Goaziou
2012-02-19 19:28 ` Christian Moe
2012-02-19 19:41   ` Nicolas Goaziou
2012-02-19 20:11     ` Toby Cubitt
2012-02-19 20:20     ` Christian Moe
2012-02-19 19:41 ` Samuel Wales
2012-02-19 20:02   ` Nicolas Goaziou
2012-02-19 20:48     ` Samuel Wales
2012-02-19 20:10 ` Carsten Dominik
2012-02-20  0:51   ` Nicolas Goaziou
2012-02-20  7:09     ` Carsten Dominik
2012-02-20 10:59       ` Nicolas Goaziou [this message]
2012-02-20 22:06         ` Nicolas Goaziou
2012-02-21  1:26           ` Thomas S. Dye
2012-02-21  5:14           ` David Maus
2012-02-21  9:18             ` Nicolas Goaziou
2012-02-27 19:38               ` Nicolas Goaziou
2012-02-27 20:38               ` David Maus
2012-03-05  9:37         ` Jambunathan K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y5rx22km.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).