From 3434fdf9b1669304ed2051c89554efc9922c5feb Mon Sep 17 00:00:00 2001 From: Max Nikulin Date: Tue, 24 Oct 2023 21:45:36 +0700 Subject: [PATCH] ox-ascii.el: Consistently add brackets around links * lisp/ox-ascii.el (org-ascii-link): Add square brackets around description of fuzzy links when they are exported inline. * lisp/ol-docview.el (org-docview-export): * lisp/ox-ascii.el (org-ascii-link): Export links with square brackets around description and angle brackets around path. This make export of links inline (when `org-ascii-links-to-notes' is nil) consistent with "http:" links: "[DESC] ()". I would drop brackets for "http:" and similar links instead ("DESC ()" or even "DESC "), but any case I prefer consistency. Ihor Radchenko to emacs-orgmode. Re: [RFC][PATCH] Allow to export to ascii custom link types as notes. Tue, 24 Oct 2023 10:40:41 +0000. --- lisp/ol-docview.el | 2 +- lisp/ol-man.el | 2 +- lisp/ox-ascii.el | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/ol-docview.el b/lisp/ol-docview.el index bb9b34a17..bcb26520b 100644 --- a/lisp/ol-docview.el +++ b/lisp/ol-docview.el @@ -67,7 +67,7 @@ (defun org-docview-export (link description backend _info) (cond ((eq backend 'html) (format "%s" path desc)) ((eq backend 'latex) (format "\\href{%s}{%s}" path desc)) - ((eq backend 'ascii) (format "%s (%s)" desc path)) + ((eq backend 'ascii) (format "[%s] (<%s>)" desc path)) (t path))))) (defun org-docview-open (link _) diff --git a/lisp/ol-man.el b/lisp/ol-man.el index abe79086a..645a6108e 100644 --- a/lisp/ol-man.el +++ b/lisp/ol-man.el @@ -91,7 +91,7 @@ (defun org-man-export (link description backend) ((eq backend 'html) (format "%s" path desc)) ((eq backend 'latex) (format "\\href{%s}{%s}" path desc)) ((eq backend 'texinfo) (format "@uref{%s,%s}" path desc)) - ((eq backend 'ascii) (format "%s (%s)" desc path)) + ((eq backend 'ascii) (format "[%s] (<%s>)" desc path)) ((eq backend 'md) (format "[%s](%s)" desc path)) (t path)))) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 110bb4601..ae4273489 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -1607,9 +1607,9 @@ (defun org-ascii-link (link desc info) ((guard desc) (if (plist-get info :ascii-links-to-notes) (format "[%s]" desc) - (concat desc - (format " (%s)" - (org-ascii--describe-datum destination info))))) + (format "[%s] (%s)" + desc + (org-ascii--describe-datum destination info)))) ;; External file. (`plain-text destination) (`headline -- 2.39.2