[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Clicking on URL does convert some special characters
From: |
David Maus |
Subject: |
Re: [O] Clicking on URL does convert some special characters |
Date: |
Sun, 11 Sep 2011 19:40:10 +0200 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.2 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
At Wed, 07 Sep 2011 16:01:48 +0530,
Jambunathan K wrote:
> > Hello,
> >
> > I just realized a diff in behavior between 3 URL entered in the Org buffer
> > with slight differences:
> >
> > - http://web.com/file.php?name=Rep&path=%2FPROJ%2FSomeFile.txt
> > This one is correctly exported, but when clicking on it from the Org
> > buffer,
> > the URL opened in the browser is
> > http://web.com/file.php?name=Rep&path=%252FPROJ%252FSomeFile.txt,
> > ^^ ^^
> > hence path not found error.
> >
> > - [[http://web.com/file.php?name=Rep&path=%2FPROJ%2FSomeFile.txt]]
> > Works OK in Org and in exported HTML file.
> >
> > -
> > [[http://web.com/file.php?name=Rep&path=%2FPROJ%2FSomeFile.txt][Description]]
> > Idem.
>
> 2. When the Org buffer is exported to html or odt
>
> ,---- In org-html-handle-links
> | (setq path (save-match-data (org-link-unescape <==
> | (match-string 3 line))))
> | (setq type (cond
> | ((match-end 2) (match-string 2 line))
> | ((save-match-data
> | (or (file-name-absolute-p path)
> | (string-match "^\\.\\.?/" path)))
> | "file")
> | (t "internal")))
> | (setq path (org-extract-attributes (org-link-unescape path))) <==
> `----
>
> link unescape happens twice. Asymmetry due to One link escape + two link
> unescape asymmetry creates problem on export.
>
> Based on historical research, the second org-link-unescape can be
> removed. The fact that attributes can be entered at C-c C-l prompt is
> largely documented and so the second call to org-link-unescape can
> largely be removed.
The three issues (plain links, enter link via C-c C-l, and
double-unescape) are not related in a strict sense. I just pushed:
- a fix for `org-open-at-point' and plain links; problem was, that in
contrast to bracket links the plain link was not unescaped when
read from buffer
- removed the second `org-link-unescape' in `org-html-handle-links';
PATH is already unescaped, does not change between first and third
`setq' and should always be escaped only once. Attached patch is
for org-lparse.el.
The inconsistency C-c C-l vs. copy'n'paste vs. manually entering a
link is under further review. The base problem is, that we
(a) need to escape certain characters for Org mode (i.e. square brackets)
(b) need to treat links in a Org buffer either as escaped -or- as
unescaped; you can't always tell the difference from the string alone
(e.g. "%25" could be the escaped percent sign or the unescaped
sequence "%25")
(c) don't know if the user enters or pastes a escaped or unescaped
link; if the user manually enters a link with the sequence "%5B" and
we later read that link, we can't tell if it is a bracket escaped by
us or a percent escaped bracket in the original link
Best,
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden
0001-Remove-unecessary-link-unescape.patch
Description: Text document
pgpLZpBsCWS3r.pgp
Description: PGP signature