emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Cannot export a raw link
@ 2014-04-14  9:18 Bastien
  2014-04-14 11:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2014-04-14  9:18 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nicolas,

1. create a file with "http://orgmode.org" as its contents
2. export it to HTML
3. the exported link is wrong: http:orgmode.org

I guess it has to do with this commit:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=3589f6

Can you double-check?

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-14  9:18 [BUG] Cannot export a raw link Bastien
@ 2014-04-14 11:16 ` Nicolas Goaziou
  2014-04-14 17:07   ` Achim Gratz
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2014-04-14 11:16 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hello,

Bastien <bzg@gnu.org> writes:

> 1. create a file with "http://orgmode.org" as its contents
> 2. export it to HTML
> 3. the exported link is wrong: http:orgmode.org
>
> I guess it has to do with this commit:
> http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=3589f6
>
> Can you double-check?

Correct. It should be fixed.

Though, export back-ends in the wild implementing their own link
handling (i.e., not through a derived back-end) need to apply the
change.

IMO, this can still be part of Org 8.2.6, but it should be notified as
an incompatible change in Org News.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-14 11:16 ` Nicolas Goaziou
@ 2014-04-14 17:07   ` Achim Gratz
  2014-04-14 19:10     ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Achim Gratz @ 2014-04-14 17:07 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou writes:
> Correct. It should be fixed.

It still isn't correct.  If you put "//" after a "file:" scheme, then
you need to put an authority there (an empty authority means localhost
in some contexts, but then the path has to start with a slash).  Also,
with the new implementation relative file: links would stop working.  A
relative file link cannot have any slashes after the scheme, while an
absolute path must have three (not going into the vagaries of trying to
use UNC paths and file links that work around the security policies of
various web browsers).

http://www-archive.mozilla.org/quality/networking/testing/filetests.html


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-14 17:07   ` Achim Gratz
@ 2014-04-14 19:10     ` Nicolas Goaziou
  2014-04-14 19:19       ` Achim Gratz
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2014-04-14 19:10 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Hello,

Achim Gratz <Stromeko@nexgo.de> writes:

> It still isn't correct.  If you put "//" after a "file:" scheme, then
> you need to put an authority there (an empty authority means localhost
> in some contexts, but then the path has to start with a slash). 

The patch didn't change "file" scheme handling. It changed "http",
"https" and "ftp".

> Also, with the new implementation relative file: links would stop
> working. A relative file link cannot have any slashes after the
> scheme, while an absolute path must have three (not going into the
> vagaries of trying to use UNC paths and file links that work around
> the security policies of various web browsers).

With latest patch and following Org buffer

  file:test.org
  file:/test.org
  file:///test.org

I get (HTML export)

  <a href="test.html">test.html</a>
  <a href="file:///test.html">file:///test.html</a>
  <a href="file:///test.html">file:///test.html</a>

So, it looks good so far.

Unfortunately, it fails with a non-empty authority. E.g.,

  file://hostname/test.org

becomes

  <a href="hostname/test.html">test.html</a>

So it is not satisfactory.

One possibility is to store somewhere in the parsed link that the URI
provided the "//" part, and, if so, re-introduce it unconditionally when
building back the link.

Another one is to drop the whole thing, return to previous state, and
implement ad-hoc rules to fix "file:", which is probably the only scheme
introducing problems.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-14 19:10     ` Nicolas Goaziou
@ 2014-04-14 19:19       ` Achim Gratz
  2014-04-14 20:06         ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Achim Gratz @ 2014-04-14 19:19 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou writes:
> With latest patch and following Org buffer
>
>   file:test.org
>   file:/test.org
>   file:///test.org
>
> I get (HTML export)
>
>   <a href="test.html">test.html</a>
>   <a href="file:///test.html">file:///test.html</a>
>   <a href="file:///test.html">file:///test.html</a>
>
> So, it looks good so far.

groff has this snippet:

--8<---------------cut here---------------start------------->8---
                  (if (file-name-absolute-p raw-path)
                      (concat "file://" (expand-file-name raw-path))
                    (concat "file://" raw-path)))
--8<---------------cut here---------------end--------------->8---

which unconditionally adds an authority if I read it correctly.

> Unfortunately, it fails with a non-empty authority. E.g.,
>
>   file://hostname/test.org
>
> becomes
>
>   <a href="hostname/test.html">test.html</a>
>
> So it is not satisfactory.

Right, I didn't read as far into the patch.

> One possibility is to store somewhere in the parsed link that the URI
> provided the "//" part, and, if so, re-introduce it unconditionally when
> building back the link.

Well, there's the option of correctly parsing into scheme, authority,
path, query and fragment...  But that is probably not going into 8.2.6
in any case.

https://tools.ietf.org/html/rfc3986

> Another one is to drop the whole thing, return to previous state, and
> implement ad-hoc rules to fix "file:", which is probably the only scheme
> introducing problems.

I forgot what the previous state was, but trying to fix file: URIs
without correctly parsing them sounds like a losing proposition.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-14 19:19       ` Achim Gratz
@ 2014-04-14 20:06         ` Nicolas Goaziou
  2014-04-16  7:15           ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2014-04-14 20:06 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> groff has this snippet:
>
>
>                   (if (file-name-absolute-p raw-path)
>                       (concat "file://" (expand-file-name raw-path))
>                     (concat "file://" raw-path)))

This needs to be fixed, along with ox-man.el. Anyway, that wasn't
introduced with the patch being discussed.

> Well, there's the option of correctly parsing into scheme, authority,
> path, query and fragment...  But that is probably not going into 8.2.6
> in any case.

I don't think we need to completely parse the URI because:

  - we are not going to consume it,
  - Org syntax is not completely compatible with RFC3986 (e.g., search
    options like [[file:test.org::* My headline]]).

I think we need scheme, authority, path+query+fragment, and search
options. At the moment, the parser handles scheme,
authority+path+query+fragment and search options.
`url-generic-parse-url' may help, too.

We also need a function to build back the link, in order to make life of
back-end developers easier. This is why authority is needed.

>> Another one is to drop the whole thing, return to previous state, and
>> implement ad-hoc rules to fix "file:", which is probably the only scheme
>> introducing problems.
>
> I forgot what the previous state was, but trying to fix file: URIs
> without correctly parsing them sounds like a losing proposition.

Previous state was, in a nutshell, to recognize scheme:blob, which leads
to the same kind of problem since blob may or may not contain the
authority part.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-14 20:06         ` Nicolas Goaziou
@ 2014-04-16  7:15           ` Nicolas Goaziou
  2014-04-16 18:38             ` Achim Gratz
                               ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Nicolas Goaziou @ 2014-04-16  7:15 UTC (permalink / raw)
  To: Achim Gratz; +Cc: Bastien, emacs-orgmode

I suggest the following for the 8.2.6 release:

  - revert the whole patches line

  - at the parser level

    - if scheme is not "file" or derived (e.g., "file+sys" or
      "docview"), assume PATH is a correct URI and do not change
      anything ;

    - otherwise, if PATH is absolute and do not start with two or more
      slashes, append "//" to it ;

  - at the back-ends level, simply add "file:" if PATH is absolute and
    use PATH otherwise.

I think it is sufficient for 8.2.6.  We can still discuss if more
parsing is needed for 8.3.

WDYT?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-16  7:15           ` Nicolas Goaziou
@ 2014-04-16 18:38             ` Achim Gratz
  2014-04-17  6:35             ` Bastien
  2014-05-03 18:21             ` Michael Brand
  2 siblings, 0 replies; 15+ messages in thread
From: Achim Gratz @ 2014-04-16 18:38 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou writes:
[…]
> I think it is sufficient for 8.2.6.  We can still discuss if more
> parsing is needed for 8.3.

I agree that this should take care of it.  Unless Org honestly tries to
be RFC3986 conformant in the future, I don't really see the point in
further changes at the moment.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-16  7:15           ` Nicolas Goaziou
  2014-04-16 18:38             ` Achim Gratz
@ 2014-04-17  6:35             ` Bastien
  2014-04-17 11:06               ` Nicolas Goaziou
  2014-05-03 18:21             ` Michael Brand
  2 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2014-04-17  6:35 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Achim Gratz, emacs-orgmode

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> I suggest the following for the 8.2.6 release:
>
>   - revert the whole patches line
>
>   - at the parser level
>
>     - if scheme is not "file" or derived (e.g., "file+sys" or
>       "docview"), assume PATH is a correct URI and do not change
>       anything ;
>
>     - otherwise, if PATH is absolute and do not start with two or more
>       slashes, append "//" to it ;
>
>   - at the back-ends level, simply add "file:" if PATH is absolute and
>     use PATH otherwise.
>
> I think it is sufficient for 8.2.6.  We can still discuss if more
> parsing is needed for 8.3.

Indeed, please go ahead with this plan when you can.

Also, `org-open-at-point' needs to correctly deal with links
like mailto:john@doe.com?subject=Test -- I think it used to
work but the subject is not parsed correctly here.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-17  6:35             ` Bastien
@ 2014-04-17 11:06               ` Nicolas Goaziou
  2014-04-17 11:26                 ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2014-04-17 11:06 UTC (permalink / raw)
  To: Bastien; +Cc: Achim Gratz, emacs-orgmode

Hello,

Bastien <bzg@gnu.org> writes:

> Indeed, please go ahead with this plan when you can.

Done.

> Also, `org-open-at-point' needs to correctly deal with links
> like mailto:john@doe.com?subject=Test -- I think it used to
> work but the subject is not parsed correctly here.

I don't think it ever worked. According to `org-link-mailto-program',
Org provides its own syntax, which is

  mailto:john@doe.com::Test

Unfortunately, this is also buggy at the moment. But, before fixing it,
I think we should decide which syntax we are going to support
(supporting both is sub-optimal, IMO).

FWIW, I vote for regular URI mailto:john@doe.com?subject=Test. That
implies to get rid of `org-link-mailto-program' and delegate the parsing
job to `browse-url', which can be configured, in this case, through
`browse-url-mailto-function'.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-17 11:06               ` Nicolas Goaziou
@ 2014-04-17 11:26                 ` Bastien
  2014-04-17 19:51                   ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2014-04-17 11:26 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Achim Gratz, emacs-orgmode

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

>> Indeed, please go ahead with this plan when you can.
>
> Done.

Thanks,

> FWIW, I vote for regular URI mailto:john@doe.com?subject=Test.

Yep, 100% agreed.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-17 11:26                 ` Bastien
@ 2014-04-17 19:51                   ` Nicolas Goaziou
  2014-04-17 19:56                     ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2014-04-17 19:51 UTC (permalink / raw)
  To: Bastien; +Cc: Achim Gratz, emacs-orgmode

Bastien <bzg@gnu.org> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> FWIW, I vote for regular URI mailto:john@doe.com?subject=Test.
>
> Yep, 100% agreed.

Done in b9f2e17f07faf01109fc6f7f1eb5a34e0f97eafb.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-17 19:51                   ` Nicolas Goaziou
@ 2014-04-17 19:56                     ` Bastien
  0 siblings, 0 replies; 15+ messages in thread
From: Bastien @ 2014-04-17 19:56 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Achim Gratz, emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Bastien <bzg@gnu.org> writes:
>
>> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>>
>>> FWIW, I vote for regular URI mailto:john@doe.com?subject=Test.
>>
>> Yep, 100% agreed.
>
> Done in b9f2e17f07faf01109fc6f7f1eb5a34e0f97eafb.

Works fine, thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-04-16  7:15           ` Nicolas Goaziou
  2014-04-16 18:38             ` Achim Gratz
  2014-04-17  6:35             ` Bastien
@ 2014-05-03 18:21             ` Michael Brand
  2014-05-04 19:43               ` Nicolas Goaziou
  2 siblings, 1 reply; 15+ messages in thread
From: Michael Brand @ 2014-05-03 18:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

Hi Nicolas

On Wed, Apr 16, 2014 at 9:15 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> I suggest the following for the 8.2.6 release:
>
>   - revert the whole patches line
>
>   - at the parser level
>
>     - if scheme is not "file" or derived (e.g., "file+sys" or
>       "docview"), assume PATH is a correct URI and do not change
>       anything ;
>
>     - otherwise, if PATH is absolute and do not start with two or more
>       slashes, append "//" to it ;
>
>   - at the back-ends level, simply add "file:" if PATH is absolute and
>     use PATH otherwise.
>
> I think it is sufficient for 8.2.6.  We can still discuss if more
> parsing is needed for 8.3.
>
> WDYT?

I am not 100 % sure whether it is related with the above changes. But
could you please check again if the merge conflict in lisp/ox-html.el
between maint and master was resolved correctly with your merging
commit fffd055ac5e920e744e350a1ad164494aec9fa91 on master? I think on
master it should not be

    (org-link-escape
     (org-link-unescape
      (concat type ":" raw-path)) org-link-escape-chars-browser))

but

    (org-link-escape-browser
     (org-link-unescape (concat type ":" raw-path))))

like it was after my commit 54e3009d7319e4bece967be165061331070635e5.

Michael

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [BUG] Cannot export a raw link
  2014-05-03 18:21             ` Michael Brand
@ 2014-05-04 19:43               ` Nicolas Goaziou
  0 siblings, 0 replies; 15+ messages in thread
From: Nicolas Goaziou @ 2014-05-04 19:43 UTC (permalink / raw)
  To: Michael Brand; +Cc: Org Mode

Hello,

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

> I am not 100 % sure whether it is related with the above changes. But
> could you please check again if the merge conflict in lisp/ox-html.el
> between maint and master was resolved correctly with your merging
> commit fffd055ac5e920e744e350a1ad164494aec9fa91 on master? I think on
> master it should not be
>
>     (org-link-escape
>      (org-link-unescape
>       (concat type ":" raw-path)) org-link-escape-chars-browser))
>
> but
>
>     (org-link-escape-browser
>      (org-link-unescape (concat type ":" raw-path))))
>
> like it was after my commit 54e3009d7319e4bece967be165061331070635e5.

Fixed. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-05-04 19:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-14  9:18 [BUG] Cannot export a raw link Bastien
2014-04-14 11:16 ` Nicolas Goaziou
2014-04-14 17:07   ` Achim Gratz
2014-04-14 19:10     ` Nicolas Goaziou
2014-04-14 19:19       ` Achim Gratz
2014-04-14 20:06         ` Nicolas Goaziou
2014-04-16  7:15           ` Nicolas Goaziou
2014-04-16 18:38             ` Achim Gratz
2014-04-17  6:35             ` Bastien
2014-04-17 11:06               ` Nicolas Goaziou
2014-04-17 11:26                 ` Bastien
2014-04-17 19:51                   ` Nicolas Goaziou
2014-04-17 19:56                     ` Bastien
2014-05-03 18:21             ` Michael Brand
2014-05-04 19:43               ` Nicolas Goaziou

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).