[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] non-standard link errors
From: |
Nicolas Goaziou |
Subject: |
Re: [O] non-standard link errors |
Date: |
Mon, 29 Feb 2016 19:10:34 +0100 |
Hello,
Skip Collins <address@hidden> 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