emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] [babel] exports, caching, remote execution


From: David Maus
Subject: Re: [Orgmode] [babel] exports, caching, remote execution
Date: Fri, 18 Jun 2010 17:35:39 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/23.2 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Eric Schulte wrote:

>Is "scpc" in the line above a transport protocol?  Maybe this should be
>an org-mode wide features, i.e. the ability to resolve remote file
>references with C-c C-o and on export.  Does that sound reasonable, and
>would it take care of the need in this particular case?

I've created two IDEA issue in the issue file for this and another
operation on links especially during export: Link resolving and link
dereferencing.

Just out of my head without many thoughs about how to implement:

1.

Following the URI specs (RFC 3986) resolving and dereferencing means:

"the process of determining an access mechanism and the appropriate
parameters necessary to dereference a URI (sc. resolving, D.M.); this
resolution may require several iterations.  To use that access
mechanism to perform an action on the URI's resource is to
"dereference" the URI." (1.2.2)

The basic idea is, that an Org mode link is a URI identifying a
resource; upon export it might be necessary or desired to provide
either an access mechanism suitable for the output format to access
the entity referenced by the URI or another URI (see below).

E.g.: An info reference to the Org mode manual [[info:org]] could be
resolved to a web link [[http://orgmode.org/manual/]] when exporting
to html.

Resolving is already done for files when exporting to html:
[[file:foo.baz]] is resolved to a relative web link, pointing to
foo.baz.

Dereferencing a link like

[[file:/scpc:address@hidden:/users/home/user/test.png]]

could or would hence be part of resolving a file link.  It fetches the
resource (test.png), puts it into current directory and returns a link
suitable for the export context.

Another example would be a hypothetical Org mode link type "rfc" that
opens and stores links to RFCs using rfcview-mode.

When exporting an Org mode document to html, the function
`org-rfc-resolve-link' is called and returns a web link pointing to a
web resource of the RFC.  When exporting to latex, the function
`org-rfc-resolve-link' returns a link of type "bib" with the BibTeX
key of the RFC (e.g. rfc:4287 -> bib:RFC4287), assuming that a
reference to a RFC in a LaTeX document is a bibliographic reference.

2.

To complete this way of link handling we require a third function:
Link markup.  An Org mode link handler may provide a markup-link
function that takes the exporting context and the link and returns
suitable markup of LINK in CONTEXT.

E.g. the handler for BibTeX links provides the function
`org-bib-markup-link' that returns proper markup of a bibliographic
reference.  In context of LaTeX export his would be a \cite command
with the BibTeX key of the bib link (bib:RFC4287 -> \cite{4287}).

3.

For the sake of Lispness and to avoid repeated parsing, we define a
Lisp representation of an Org link to be:

((TYPE AI RESOURCE) . PROPS)

Where

  - TYPE :: Is a symbol of the type ("scheme") of the link

  - RESOURCE :: Is the path or name of the referenced resource

  - AI :: Is t, if RESOURCE contains an authority, otherwise it is nil.

          Cf. RFC3986, 3.2; in the written representation of a URI the
          presence of an authority is indicated by the two slashes
          after the colon.

  - PROPS :: Is a property list of additional link properties
             (e.g. description)

Examples:

  - [[http://orgmode.org/manual/][Org mode manual]] is represented as:

    ((http t "orgmode.org/manual/") . (:description "Org mode manual"))

  - [[info:org][Org mode manual]] is represented as

    ((info nil "org") . (:description "Org mode manual"))

  - [[file:foo/baz.org]] is represented as

    ((file nil "foo/baz.org"))

Having this, resolving a link is modifying TYPE, RESOURCE and AI.

E.g. ((file nil "foo/baz.org")) -> ((http nil "foo/baz.html"))

     ((file nil "/scp:address@hidden:/users/home/user/test.png"))

     -> ((file nil "test.png")) [dereferenced]

     -> ((http nil "test.png")) [finally resolved]

4.

The question of how to actually resolve a link is up to the respective
link handler and I am not sure how to provide easy customization of
such a system.

Comments are welcome,

 -- David


--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgpL1joaBcluK.pgp
Description: PGP signature


reply via email to

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