emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: export to markdown invalid URL
@ 2017-08-22 21:16 Fabio Leimgruber
  2017-08-22 21:33 ` Jay Kamat
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio Leimgruber @ 2017-08-22 21:16 UTC (permalink / raw)
  To: emacs-orgmode

Hello everyone,

using latest master, an org file containing just the link

#+BEGIN_SRC org
[[http://orgmode.org/img/org-mode-unicorn-logo.png]]
#+END_SRC

on export to markdown with =C-c C-e m m= produces the md file

#+BEGIN_EXAMPLE
# Table of Contents



![img](http//orgmode.org/img/org-mode-unicorn-logo.png)
#+END_EXAMPLE

containing an invalid URL.

Best Regards,

--
Fabio Leimgruber

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

* Re: Bug: export to markdown invalid URL
  2017-08-22 21:16 Bug: export to markdown invalid URL Fabio Leimgruber
@ 2017-08-22 21:33 ` Jay Kamat
  2017-08-22 21:47   ` Nicolas Goaziou
  2017-08-22 21:50   ` Jay Kamat
  0 siblings, 2 replies; 6+ messages in thread
From: Jay Kamat @ 2017-08-22 21:33 UTC (permalink / raw)
  To: fabio.leimgruber; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

Hi,

Thanks for catching that. That was my fault, for failing to test
commit f3d7284ebd0c6e8248f7c3c444937270402b0ba6 properly.

See http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00147.html
for the previous thread.

I've attached a trivial patch which appears to fix the issue for me,
but I don't know if there's a cleaner way to do it or not (is there a
link property that keeps the ':' in either the link or the type?).

Thanks,
-Jay

On Tue, Aug 22, 2017 at 5:16 PM, Fabio Leimgruber
<fabio.leimgruber@posteo.eu> wrote:
> Hello everyone,
>
> using latest master, an org file containing just the link
>
> #+BEGIN_SRC org
> [[http://orgmode.org/img/org-mode-unicorn-logo.png]]
> #+END_SRC
>
> on export to markdown with =C-c C-e m m= produces the md file
>
> #+BEGIN_EXAMPLE
> # Table of Contents
>
>
>
> ![img](http//orgmode.org/img/org-mode-unicorn-logo.png)
> #+END_EXAMPLE
>
> containing an invalid URL.
>
> Best Regards,
>
> --
> Fabio Leimgruber
>

[-- Attachment #2: 0001-ox-md.el-Fix-missing-in-exported-markdown-image-link.patch --]
[-- Type: text/x-patch, Size: 1014 bytes --]

From 5d92257575e497e0955b3414fb1e1a69e5ea97f8 Mon Sep 17 00:00:00 2001
From: Jay Kamat <jaygkamat@gmail.com>
Date: Tue, 22 Aug 2017 17:28:28 -0400
Subject: [PATCH] ox-md.el: Fix missing ':' in exported markdown image links

* lisp/ox-md.el (org-md-link): Append ':' to the type of non-file
  image links.
---
 lisp/ox-md.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 0dd1be095..ac94ba648 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -432,7 +432,7 @@ a communication channel."
 		       (org-export-get-reference destination info))))))))
      ((org-export-inline-image-p link org-html-inline-image-rules)
       (let ((path (let ((raw-path (org-element-property :path link)))
-		    (cond ((not (equal "file" type)) (concat type raw-path))
+		    (cond ((not (equal "file" type)) (concat type ":" raw-path))
 			  ((not (file-name-absolute-p raw-path)) raw-path)
 			  (t (expand-file-name raw-path)))))
 	    (caption (org-export-data
-- 
2.11.0


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

* Re: Bug: export to markdown invalid URL
  2017-08-22 21:33 ` Jay Kamat
@ 2017-08-22 21:47   ` Nicolas Goaziou
  2017-08-22 21:50   ` Jay Kamat
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2017-08-22 21:47 UTC (permalink / raw)
  To: Jay Kamat; +Cc: fabio.leimgruber, emacs-orgmode

Hello,

Jay Kamat <jaygkamat@gmail.com> writes:

> Subject: [PATCH] ox-md.el: Fix missing ':' in exported markdown image links
>
> * lisp/ox-md.el (org-md-link): Append ':' to the type of non-file
>   image links.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: export to markdown invalid URL
  2017-08-22 21:33 ` Jay Kamat
  2017-08-22 21:47   ` Nicolas Goaziou
@ 2017-08-22 21:50   ` Jay Kamat
  2017-08-22 22:31     ` Nicolas Goaziou
  1 sibling, 1 reply; 6+ messages in thread
From: Jay Kamat @ 2017-08-22 21:50 UTC (permalink / raw)
  To: fabio.leimgruber; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

Hi again,

sorry for the repeated emails, but I think I've come up with a better
solution to this issue, to just use the raw link target in the target
of the markdown export, which I've attached to this email. Feel free
to pick either one of these patches or come up with something better.

Hope this gets fixed soon,
-Jay


On Tue, Aug 22, 2017 at 5:33 PM, Jay Kamat <jaygkamat@gmail.com> wrote:
> Hi,
>
> Thanks for catching that. That was my fault, for failing to test
> commit f3d7284ebd0c6e8248f7c3c444937270402b0ba6 properly.
>
> See http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00147.html
> for the previous thread.
>
> I've attached a trivial patch which appears to fix the issue for me,
> but I don't know if there's a cleaner way to do it or not (is there a
> link property that keeps the ':' in either the link or the type?).
>
> Thanks,
> -Jay
>
> On Tue, Aug 22, 2017 at 5:16 PM, Fabio Leimgruber
> <fabio.leimgruber@posteo.eu> wrote:
>> Hello everyone,
>>
>> using latest master, an org file containing just the link
>>
>> #+BEGIN_SRC org
>> [[http://orgmode.org/img/org-mode-unicorn-logo.png]]
>> #+END_SRC
>>
>> on export to markdown with =C-c C-e m m= produces the md file
>>
>> #+BEGIN_EXAMPLE
>> # Table of Contents
>>
>>
>>
>> ![img](http//orgmode.org/img/org-mode-unicorn-logo.png)
>> #+END_EXAMPLE
>>
>> containing an invalid URL.
>>
>> Best Regards,
>>
>> --
>> Fabio Leimgruber
>>

[-- Attachment #2: 0001-ox-md.el-Fix-missing-in-exported-markdown-image-link.patch --]
[-- Type: text/x-patch, Size: 1177 bytes --]

From 743daf53843a29b1202553345b4fc298ac87c74e Mon Sep 17 00:00:00 2001
From: Jay Kamat <jaygkamat@gmail.com>
Date: Tue, 22 Aug 2017 17:28:28 -0400
Subject: [PATCH] ox-md.el: Fix missing ':' in exported markdown image links

* lisp/ox-md.el (org-md-link): Use raw-link for markdown link target
  instead of merging type and raw-path
---
 lisp/ox-md.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 0dd1be095..9afb5227e 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -431,8 +431,9 @@ a communication channel."
 		       description
 		       (org-export-get-reference destination info))))))))
      ((org-export-inline-image-p link org-html-inline-image-rules)
-      (let ((path (let ((raw-path (org-element-property :path link)))
-		    (cond ((not (equal "file" type)) (concat type raw-path))
+       (let ((path (let ((raw-path (org-element-property :path link))
+			  (raw-link (org-element-property :raw-link link)))
+		    (cond ((not (equal "file" type)) raw-link)
 			  ((not (file-name-absolute-p raw-path)) raw-path)
 			  (t (expand-file-name raw-path)))))
 	    (caption (org-export-data
-- 
2.11.0


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

* Re: Bug: export to markdown invalid URL
  2017-08-22 21:50   ` Jay Kamat
@ 2017-08-22 22:31     ` Nicolas Goaziou
  2017-08-23  2:27       ` Jay Kamat
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2017-08-22 22:31 UTC (permalink / raw)
  To: Jay Kamat; +Cc: fabio.leimgruber, emacs-orgmode

Jay Kamat <jaygkamat@gmail.com> writes:

> sorry for the repeated emails, but I think I've come up with a better
> solution to this issue, to just use the raw link target in the target
> of the markdown export, which I've attached to this email. Feel free
> to pick either one of these patches or come up with something better.

I think the current patch is fine. Yours is equivalent, but since we
already bound `raw-path', we might as well use it.

> Hope this gets fixed soon,

Isn't it already the case?

Regards,

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

* Re: Bug: export to markdown invalid URL
  2017-08-22 22:31     ` Nicolas Goaziou
@ 2017-08-23  2:27       ` Jay Kamat
  0 siblings, 0 replies; 6+ messages in thread
From: Jay Kamat @ 2017-08-23  2:27 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: fabio.leimgruber, emacs-orgmode

Hi,

> Isn't it already the case?

Sorry, I sent that email without reading the 'applied' email, so it
was premature. The fix looks good currently.

> I think the current patch is fine. Yours is equivalent, but since we
> already bound `raw-path', we might as well use it.

yup, that is true, I'm happy with the current patch for now, since we
don't have to bind additional variables it ends up being simpler.

Thanks,
-Jay

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

end of thread, other threads:[~2017-08-23  2:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 21:16 Bug: export to markdown invalid URL Fabio Leimgruber
2017-08-22 21:33 ` Jay Kamat
2017-08-22 21:47   ` Nicolas Goaziou
2017-08-22 21:50   ` Jay Kamat
2017-08-22 22:31     ` Nicolas Goaziou
2017-08-23  2:27       ` Jay Kamat

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