emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Skip Collins <skip.collins@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: non-standard link errors
Date: Mon, 29 Feb 2016 19:10:34 +0100	[thread overview]
Message-ID: <87wppnz8th.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CABUh-748yUj7zHxhR+cscfY3T9ri+Uz15mzcnCDoff0BuKPYug@mail.gmail.com> (Skip Collins's message of "Sun, 28 Feb 2016 23:04:24 -0500")

Hello,

Skip Collins <skip.collins@gmail.com> writes:

> I have come up with a better solution than globally passing "broken"
> links. I defined a new "raw" link type. So now if I want to put a
> non-standard link in my export, I can do something like:
> Here is a [[raw:foo:/\bar, baz][bad link]].
> which is exported in html as:
> Here is a <a href="foo:/\bar, baz">bad link</a>.
>
> Now I can have non-standard links included in the output without
> disabling link checking for all standard link types. This is how it is
> defined in my .emacs:
> (org-add-link-type "raw" 'org-raw-follow 'org-raw-export)
> (defun org-raw-follow (path))
> (defun org-raw-export (path desc format)
>   "Export a raw link.
> See `org-add-link-type' for details about PATH, DESC and FORMAT."
>   (cond
>    ((eq format 'html) (format "<a href=\"%s\">%s</a>" path desc))
>    ((eq format 'latex) (format "\\href{%s}{%s}" path desc))
>    ((eq format 'ascii) (format "%s (%s)" desc path))
>    (t path)))
>
> Perhaps this could be included in the standard Org distribution as a
> fallback option for exporting non-standard link types. Emacs/Org does
> nothing with the link. The user is responsible for ensuring the output
> is correct.

This is already the default behavior for custom types. You don't even
need to use `org-raw-export' or `org-raw-open'. All is needed, is

 (org-add-link-type "raw")

Org requires it so it can tell if the link is an internal link or not.
However, I don't think we need to introduce a particular link type for
that. Users can define whatever they want.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-02-29 18:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 18:25 non-standard link errors Skip Collins
2016-02-26 21:56 ` Nicolas Goaziou
2016-02-27 18:23   ` Skip Collins
2016-02-28  8:28     ` Nicolas Goaziou
2016-02-29  4:04       ` Skip Collins
2016-02-29 18:10         ` Nicolas Goaziou [this message]
2016-03-02  9:11           ` Simon Thum
2016-03-02  9:28             ` Nicolas Goaziou
2016-03-02 10:46               ` Simon Thum

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=87wppnz8th.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=skip.collins@gmail.com \
    /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).