emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Michael Brand <michael.ch.brand@gmail.com>
Cc: org mode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] External unicode links without a description in ox-html
Date: Mon, 25 Jul 2016 14:52:59 +0200	[thread overview]
Message-ID: <87y44pvqyy.fsf@saiph.selenimh> (raw)
In-Reply-To: <CALn3zogj4=dCk8Z4YiUkkuYJg--gOgTUwoc3648nAGjgu5ekAw@mail.gmail.com> (Michael Brand's message of "Sat, 23 Jul 2016 17:34:09 +0200")

Hello,

Michael Brand <michael.ch.brand@gmail.com> writes:

> There seems to be a related issue with an inconsistency between HTML
> and other export formats in using org-link-unescape for the link
> _destination_ part: With the Org file
>
> 1) https://duckduckgo.com/?q=Org+mode+%252B+Worg
> 2) https://duckduckgo.com/?q=Org+mode+%2B+Worg
>
> org-open-at-point on link 1) opens a web browser with the search field
> filled with "Org mode + Worg" as expected by me.

This looks like an error to me. 

If I type https://duckduckgo.com/?q=Org+mode+%252B+Worg in my browser,
I get

  "Org mode %2B Worg"

as the search string. It should be the same when opening the link from
an Org document. These URI are /not/ equivalent.

> The same happens when using link 1) of the HTML export. But when
> exporting to PDF (via LaTeX), ODT or ASCII (browse-url-at-point)
> I have to use link 2) to get the same result. I think one should be
> able to consistently use link 1) for all export formats.

It looks as we're trying to paper over an Org problem here, which is the
redundant link escaping that happens when calling `org-insert-link' (C-c
C-l).

AFAICT, there are two reasons for Org to escape a link: when the link
contains either "]]" or multiple consecutive spaces. The former
obviously breaks Org link syntax. The latter doesn't survive a call to
`fill-paragraph'.

Alas, Org handles it the wrong way, by using a mechanism that cannot be
properly undone; you cannot possibly know how many times the desired URI
has been encoded, if at all. Moreover, this mechanism isn't user
friendly, i.e., you cannot reasonably ask a user to encode an URI on the
fly when jolting notes.

I can see two ways out:

1. Do not escape anything. 

   This prevent any link with a description to contain either "]]" or
   multiple spaces, but these requirements are so uncommon we probably
   shouldn't bother.

2. Use a different internal escape mechanism.

   By providing our own simple escape mechanism, e.g., \]\], we can
   solve the issues raised above.

In any case, Org should not create something as

  https://duckduckgo.com/?q=Org+mode+%252B+Worg

if the real URI is

  https://duckduckgo.com/?q=Org+mode+%2B+Worg

WDYT?


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-07-25 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 14:44 [BUG] External unicode links without a description in ox-html Arun Isaac
2016-07-20 20:04 ` Nicolas Goaziou
2016-07-23 15:34   ` Michael Brand
2016-07-25 12:52     ` Nicolas Goaziou [this message]
2016-07-25 20:33       ` Michael Brand
2016-07-26 19:05         ` Nicolas Goaziou

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=87y44pvqyy.fsf@saiph.selenimh \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.ch.brand@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).