emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-md.el/markdown-hyperlink
@ 2020-11-04  6:40 turbo.cafe
  2021-01-03 10:06 ` TEC
  2021-01-22  5:13 ` Kyle Meyer
  0 siblings, 2 replies; 3+ messages in thread
From: turbo.cafe @ 2020-11-04  6:40 UTC (permalink / raw)
  To: emacs-orgmode

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

exporting to markdown loses radio target hyperlinks.



-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
 
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-md.el-markdown-hyperlink.patch --]
[-- Type: text/x-patch, Size: 1073 bytes --]

From bbe8ef631467f9f5f097412a946a82d38e96235c Mon Sep 17 00:00:00 2001
From: "turbo.cafe@clovermail.net" <turbo.cafe@clovermail.net>
Date: Tue, 3 Nov 2020 22:24:03 +0200
Subject: [PATCH] ox-md.el/markdown-hyperlink

* ox-md.el (org-md-link): format markdown hyperlink from org radio target


---
 lisp/ox-md.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 1d20c04f4..a63815e43 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -543,7 +543,13 @@ INFO is a plist holding contextual information.  See
      ((string= type "coderef")
       (format (org-export-get-coderef-format path desc)
 	      (org-export-resolve-coderef path info)))
-     ((equal type "radio") desc)
+     ((string= type "radio")
+      (let ((destination (org-export-resolve-radio-link link info)))
+	(if (not destination) desc
+	  (format "<a href=\"#%s\"%s>%s</a>"
+		  (org-export-get-reference destination info)
+		  ""
+		  desc))))
      (t (if (not desc) (format "<%s>" path)
 	  (format "[%s](%s)" desc path))))))
 
-- 
2.29.1


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

* Re: [PATCH] ox-md.el/markdown-hyperlink
  2020-11-04  6:40 [PATCH] ox-md.el/markdown-hyperlink turbo.cafe
@ 2021-01-03 10:06 ` TEC
  2021-01-22  5:13 ` Kyle Meyer
  1 sibling, 0 replies; 3+ messages in thread
From: TEC @ 2021-01-03 10:06 UTC (permalink / raw)
  To: turbo.cafe@clovermail.net; +Cc: emacs-orgmode


Thanks for the patch turbo.

I was able to test this with a simple Org file, and both observed the
issue with radio targets in generated markdown files, and observed the
patch fixing it, as intended.

--
Timothy

turbo.cafe@clovermail.net <turbo.cafe@clovermail.net> writes:

> exporting to markdown loses radio target hyperlinks.


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

* Re: [PATCH] ox-md.el/markdown-hyperlink
  2020-11-04  6:40 [PATCH] ox-md.el/markdown-hyperlink turbo.cafe
  2021-01-03 10:06 ` TEC
@ 2021-01-22  5:13 ` Kyle Meyer
  1 sibling, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2021-01-22  5:13 UTC (permalink / raw)
  To: turbo.cafe@clovermail.net; +Cc: emacs-orgmode, TEC

[ Sorry for the delay. ]

turbo.cafe@clovermail.net writes:

> exporting to markdown loses radio target hyperlinks.

Thanks for the patch, and thanks TEC for testing it out.

Pushed (3916a5740).

> Subject: [PATCH] ox-md.el/markdown-hyperlink
>
> * ox-md.el (org-md-link): format markdown hyperlink from org radio target

The subject you posted in the other thread at
<https://orgmode.org/list/87wnz2fa2h.fsf@atk.sk> was a bit more
descriptive, so I've used that and made a few other tweaks to the commit
message when applying.

> diff --git a/lisp/ox-md.el b/lisp/ox-md.el
> index 1d20c04f4..a63815e43 100644
> --- a/lisp/ox-md.el
> +++ b/lisp/ox-md.el
> @@ -543,7 +543,13 @@ INFO is a plist holding contextual information.  See
>       ((string= type "coderef")
>        (format (org-export-get-coderef-format path desc)
>  	      (org-export-resolve-coderef path info)))
> -     ((equal type "radio") desc)
> +     ((string= type "radio")
> +      (let ((destination (org-export-resolve-radio-link link info)))
> +	(if (not destination) desc
> +	  (format "<a href=\"#%s\"%s>%s</a>"
> +		  (org-export-get-reference destination info)
> +		  ""

I dropped this second argument, which is unnecessary (and I suspect a
leftover from copying and adjusting what's in ox-html).

> +		  desc))))


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

end of thread, other threads:[~2021-01-22  5:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04  6:40 [PATCH] ox-md.el/markdown-hyperlink turbo.cafe
2021-01-03 10:06 ` TEC
2021-01-22  5:13 ` Kyle Meyer

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