* non-standard link errors @ 2016-02-26 18:25 Skip Collins 2016-02-26 21:56 ` Nicolas Goaziou 0 siblings, 1 reply; 9+ messages in thread From: Skip Collins @ 2016-02-26 18:25 UTC (permalink / raw) To: emacs-org list Org throws an error when I export html with a link type that it does not know about. I would like it to simply add the link to the exported document without checking its validity. For example, I have a link that, when tapped on an iPhone, will open a particular app. I would like the html to look something like: <a href="facetime:user@example.com">Connect using FaceTime</a> The link works on an iPhone. But Org won't generate the html. Other apps uses x-callback-url links formatted like this: x-appname://x-callback-url/import?&description=Open%20Mail.app..... These also do not work. Short of adding every type I might want to use with org-add-link-type, is it possible to disable the export error and just pass links through as written? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 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 0 siblings, 1 reply; 9+ messages in thread From: Nicolas Goaziou @ 2016-02-26 21:56 UTC (permalink / raw) To: Skip Collins; +Cc: emacs-org list Hello, Skip Collins <skip.collins@gmail.com> writes: > Org throws an error when I export html with a link type that it does > not know about. I would like it to simply add the link to the exported > document without checking its validity. For example, I have a link > that, when tapped on an iPhone, will open a particular app. I would > like the html to look something like: > <a href="facetime:user@example.com">Connect using FaceTime</a> > > The link works on an iPhone. But Org won't generate the html. Other > apps uses x-callback-url links formatted like this: > x-appname://x-callback-url/import?&description=Open%20Mail.app..... > > These also do not work. Short of adding every type I might want to use > with org-add-link-type, is it possible to disable the export error and > just pass links through as written? It is possible in development version, where a variable controlling how link errors should be handled was introduced. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 2016-02-26 21:56 ` Nicolas Goaziou @ 2016-02-27 18:23 ` Skip Collins 2016-02-28 8:28 ` Nicolas Goaziou 0 siblings, 1 reply; 9+ messages in thread From: Skip Collins @ 2016-02-27 18:23 UTC (permalink / raw) To: emacs-org list Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote: > Skip Collins <skip.collins@gmail.com> writes: > > Org throws an error when I export html with a link type that it does > > not know about. I would like it to simply add the link to the exported > > document without checking its validity. For example, I have a link > > that, when tapped on an iPhone, will open a particular app. I would > > like the html to look something like: > > <a href="facetime:user@example.com">Connect using FaceTime</a> > > > > The link works on an iPhone. But Org won't generate the html. Other > > apps uses x-callback-url links formatted like this: > > x-appname://x-callback-url/import?&description=Open%20Mail.app..... > > > > These also do not work. Short of adding every type I might want to use > > with org-add-link-type, is it possible to disable the export error and > > just pass links through as written? > > It is possible in development version, where a variable controlling how > link errors should be handled was introduced. I added this line to the top of my org file: #+OPTIONS: broken-links:t But that eliminates both the link and its description from the export. Changing it from 't' to 'mark' puts a BROKEN LINK message in the output. I suggest adding a new option 'pass' that would simply pass "broken" links verbatim into the output. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 2016-02-27 18:23 ` Skip Collins @ 2016-02-28 8:28 ` Nicolas Goaziou 2016-02-29 4:04 ` Skip Collins 0 siblings, 1 reply; 9+ messages in thread From: Nicolas Goaziou @ 2016-02-28 8:28 UTC (permalink / raw) To: Skip Collins; +Cc: emacs-org list Hello, Skip Collins <skip.collins@gmail.com> writes: > I added this line to the top of my org file: > #+OPTIONS: broken-links:t > > But that eliminates both the link and its description from the export. > Changing it from 't' to 'mark' puts a BROKEN LINK message in the > output. I suggest adding a new option 'pass' that would simply pass > "broken" links verbatim into the output. Not that I'm against the idea, but wouldn't it be a poor way to properly fix the issue, i.e., add new link types? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 2016-02-28 8:28 ` Nicolas Goaziou @ 2016-02-29 4:04 ` Skip Collins 2016-02-29 18:10 ` Nicolas Goaziou 0 siblings, 1 reply; 9+ messages in thread From: Skip Collins @ 2016-02-29 4:04 UTC (permalink / raw) To: emacs-org list Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote: > Not that I'm against the idea, but wouldn't it be a poor way to properly > fix the issue, i.e., add new link types? 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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 2016-02-29 4:04 ` Skip Collins @ 2016-02-29 18:10 ` Nicolas Goaziou 2016-03-02 9:11 ` Simon Thum 0 siblings, 1 reply; 9+ messages in thread From: Nicolas Goaziou @ 2016-02-29 18:10 UTC (permalink / raw) To: Skip Collins; +Cc: emacs-org list 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 2016-02-29 18:10 ` Nicolas Goaziou @ 2016-03-02 9:11 ` Simon Thum 2016-03-02 9:28 ` Nicolas Goaziou 0 siblings, 1 reply; 9+ messages in thread From: Simon Thum @ 2016-03-02 9:11 UTC (permalink / raw) To: Skip Collins, emacs-org list, Nicolas Goaziou Hi, this reminds me of my issue with tel: links. I also would have preferred to have them exported "pass-through", but AFAICT this requires me to come up with a trival function for every possible backend: those I know, those I don't, and those that may not exist yet. I cannot switch to the raw: solution (due to vcard export). I'm not currently experiencing problems, but I would like to suggest that maybe such a trival default handler could be added to the backends as some well-known property to be available to those who set the broken link handler to e.g. 'fallback. The onus would be on the user to do this, since correctness of output may suffer. Of course, basic sanitation should still be done in such a handler, but preferably no spectacular failure*. Cheers, Simon (*) Because I sync using org exporter, I tend to suffer from those. And yes, I'd rather have wrong output I can diagnose than nothing. On 02/29/2016 07:10 PM, Nicolas Goaziou wrote: > 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, > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 2016-03-02 9:11 ` Simon Thum @ 2016-03-02 9:28 ` Nicolas Goaziou 2016-03-02 10:46 ` Simon Thum 0 siblings, 1 reply; 9+ messages in thread From: Nicolas Goaziou @ 2016-03-02 9:28 UTC (permalink / raw) To: Simon Thum; +Cc: Skip Collins, emacs-org list Hello, Simon Thum <simon.thum@gmx.de> writes: > this reminds me of my issue with tel: links. I also would have > preferred to have them exported "pass-through", but AFAICT this > requires me to come up with a trival function for every possible > backend: those I know, those I don't, and those that may not exist > yet. > > I cannot switch to the raw: solution (due to vcard export). I'm not > currently experiencing problems, but I would like to suggest that > maybe such a trival default handler could be added to the backends as > some well-known property to be available to those who set the broken > link handler to e.g. 'fallback. The onus would be on the user to do > this, since correctness of output may suffer. Of course, basic > sanitation should still be done in such a handler, but preferably no > spectacular failure*. As I explained, there is already a default handler in every major back-end. However, Org needs to tell links with a type from the others (internal links). This is what `org-add-link-type' is for. This has nothing to do with export. To put it differently, when Org encounters a foo:bar link, there are two options. Either "foo" is a registered link type, or not. If the former, Org tries to use whatever export function was provided, or fall-backs to the default handler. In the latter, Org considers it to be an internal link. Since there is probably no #+NAME: foo:bar, <<foo:bar>> or * foo:bar in the document, the export process returns an error, by default. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: non-standard link errors 2016-03-02 9:28 ` Nicolas Goaziou @ 2016-03-02 10:46 ` Simon Thum 0 siblings, 0 replies; 9+ messages in thread From: Simon Thum @ 2016-03-02 10:46 UTC (permalink / raw) To: Nicolas Goaziou, emacs-org list Hi, after some testing I see my assumption that without export function no links are generated was wrong. All fine, and thanks for your tirelessness in explaining it so even I get it ;) Cheers, Simon On 03/02/2016 10:28 AM, Nicolas Goaziou wrote: > Hello, > > Simon Thum <simon.thum@gmx.de> writes: > >> this reminds me of my issue with tel: links. I also would have >> preferred to have them exported "pass-through", but AFAICT this >> requires me to come up with a trival function for every possible >> backend: those I know, those I don't, and those that may not exist >> yet. >> >> I cannot switch to the raw: solution (due to vcard export). I'm not >> currently experiencing problems, but I would like to suggest that >> maybe such a trival default handler could be added to the backends as >> some well-known property to be available to those who set the broken >> link handler to e.g. 'fallback. The onus would be on the user to do >> this, since correctness of output may suffer. Of course, basic >> sanitation should still be done in such a handler, but preferably no >> spectacular failure*. > > As I explained, there is already a default handler in every major > back-end. > > However, Org needs to tell links with a type from the others (internal > links). This is what `org-add-link-type' is for. This has nothing to do > with export. > > To put it differently, when Org encounters a foo:bar link, there are two > options. Either "foo" is a registered link type, or not. If the former, > Org tries to use whatever export function was provided, or fall-backs to > the default handler. In the latter, Org considers it to be an internal > link. Since there is probably no #+NAME: foo:bar, <<foo:bar>> > or * foo:bar in the document, the export process returns an error, by > default. > > > Regards, > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-03-02 10:45 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2016-03-02 9:11 ` Simon Thum 2016-03-02 9:28 ` Nicolas Goaziou 2016-03-02 10:46 ` Simon Thum
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).