Re: org-mode export to html fails for unknown link types - telephone links

2023-04-23 Thread Ihor Radchenko
Eugen Stan  writes:

> I am building my wedding page with org mode. Yay!.
> I tried to add telephone links so people can click on the link and it 
> will do something useful.
>
> I used this markup [[tel:(+40)55-555-555][(+40)55-555-555]] to produce 
> something like (+40)55-555-555 .
>
> However It failed because the tel: is not recognized link.

It is not what is happening.
[[arbitrary text not matching known link type]] links are treated as
fuzzy links searching within current buffer. See 4.2 Internal Links
section of Org manual.

So, Org tries to search for tel:... targets and named elements in
current buffer, fails to do so, and reports that the link is broken to
the user.

> I believe the default behavior of failing to export when encountering an 
> unknown link type is not ok.

I hope it is clear now that it is not unknown link type. There is no
such notion in Org as a link with unknown link type.

> Support for tel: links might be added to org-mode by default since it is 
> simple to add and quite useful, at least in HTML export .
> See https://css-tricks.com/the-current-state-of-telephone-links/ .

Agree. Patches welcome!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



org-mode export to html fails for unknown link types - telephone links

2023-04-22 Thread Eugen Stan

Hi,

I am building my wedding page with org mode. Yay!.
I tried to add telephone links so people can click on the link and it 
will do something useful.


I used this markup [[tel:(+40)55-555-555][(+40)55-555-555]] to produce 
something like (+40)55-555-555 .


However It failed because the tel: is not recognized link.
I believe the default behavior of failing to export when encountering an 
unknown link type is not ok.


IMO org-mode export should allow export for unknown links.
Support for tel: links might be added to org-mode by default since it is 
simple to add and quite useful, at least in HTML export .

See https://css-tricks.com/the-current-state-of-telephone-links/ .

It seems it might work in PDF exports as well 
https://community.adobe.com/t5/acrobat-reader-discussions/how-to-make-clickable-phone-numbers-in-pdfs/m-p/5822600 
.


Regardless, having the export fail is a bug IMO.


To build my website I followed a slightly updated version of 
https://systemcrafters.net/publishing-websites-with-org-mode/building-the-site/ 
.


I made it work with some customization but I do believe the default

(require 'ox-publish)
(require 'ol)

(org-link-set-parameters "tel"
 :export #'org-tel-export)

(defun org-tel-export (link description format _)
  "Export a tel link from Org files."
  (let ((path link)
(desc (or description link)))
(pcase format
  (`html (format "%s" 
path desc))

  (`latex (format "\\href{%s}{%s}" path desc))
  (`texinfo (format "@uref{%s,%s}" path desc))
  (`ascii (format "%s (%s)" desc path))
  (t path

(setq org-publish-project-alist
  `(("nunta-org-site"
 :recursive t
 .. )

(org-publish-all t)