emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jay Kamat <jaygkamat@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Fixing mailto and irc links in ox-md.el
Date: Sun, 9 Jul 2017 18:20:34 -0700	[thread overview]
Message-ID: <CACe_Yv9Y74ACCgoE-pT918NPYRFnFp9uvDwpWgQ-WsLYhHAA8w@mail.gmail.com> (raw)

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

Hi!

I would like to submit a patch to org mode, which fixes the behavior
of mailto and irc links in markdown export.

Previously, these org mode snippets:

[[mailto:some.email@server.net][Jane Doe]]
[[irc:/irc.com/#emacs/bob][bob]]

would export to:

 [Jane Doe](some.email@server.net)
 [bob](/irc.com/#emacs/bob)

which causes broken links in browsers when they try to view exported markdown.

The new behavior exports them to:

[Jane Doe](mailto:some.email@server.net)
[bob](irc:/irc.com/#emacs/bob)

so that browsers can open the proper respective application when
opening said links.

The patch that I have made is very small (only one line), and is attached.

There is an external report of this bug here:
https://github.com/larstvei/ox-gfm/issues/17

This is my first time submitting a patch to anything big like org
mode, so please let me know if I've done anything wrong or if anything
seems amiss.

Thanks for looking at this, and thanks for making/developing on org
mode (it's changed my life completely)!

-Jay Kamat

[-- Attachment #2: 0001-ox-md.el-Fix-export-of-irc-and-mailto-links.patch --]
[-- Type: text/x-patch, Size: 971 bytes --]

From 0ef21fcd6394b3551a94a5878d414f2e7d17e372 Mon Sep 17 00:00:00 2001
From: Jay Kamat <jaygkamat@gmail.com>
Date: Sun, 9 Jul 2017 17:50:09 -0700
Subject: [PATCH] ox-md.el: Fix export of irc and mailto links

* lisp/ox-md.el (org-md-link): Add mailto and irc to links that pass
their types through to markdown export

See: https://github.com/larstvei/ox-gfm/issues/17  for an external
bug report

TINYCHANGE
---
 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 e2b3d29e1..08e385282 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -448,7 +448,7 @@ a communication channel."
      (t (let* ((raw-path (org-element-property :path link))
 	       (path
 		(cond
-		 ((member type '("http" "https" "ftp"))
+		 ((member type '("http" "https" "ftp" "mailto" "irc"))
 		  (concat type ":" raw-path))
 		 ((string= type "file")
 		  (org-export-file-uri (funcall link-org-files-as-md raw-path)))
-- 
2.11.0


             reply	other threads:[~2017-07-10  1:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10  1:20 Jay Kamat [this message]
2017-07-10  8:26 ` Fixing mailto and irc links in ox-md.el 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=CACe_Yv9Y74ACCgoE-pT918NPYRFnFp9uvDwpWgQ-WsLYhHAA8w@mail.gmail.com \
    --to=jaygkamat@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).