[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC][PATCH] Allow to export to ascii custom link types as notes
From: |
Ihor Radchenko |
Subject: |
Re: [RFC][PATCH] Allow to export to ascii custom link types as notes |
Date: |
Mon, 23 Oct 2023 12:09:17 +0000 |
Max Nikulin <manikulin@gmail.com> writes:
>> I am not sure what you mean by callback.
>
> Originally I had an idea that :export should call some function that
> adds a note to info. Now I have another proposal. Instead of returning a
> cons, :export function should return result of some new function, e.g.
> (org-ascii-make-link-with-note NOTE DESCRIPTION), so a `cons' or a plist
> becomes an implementation detail that may be changed any time.
Then, `org-ascii-make-link-with-note' may as well receive and modify
INFO plist. This way, ((org-export-custom-protocol-maybe link desc 'ascii
info))
cond form will work without changes as `org-ascii-make-link-with-note`
will do all the necessary processing.
> ... The only
> inconvenience is necessity to declare this function to allow lazy
> loading of ox-ascii and perhaps to avoid circular dependencies.
This is not a problem.
If lazy loading is desired, one may simply use (require 'ox-ascii)
inside :export function to trigger loading when necessary.
>> May you provide an example when the angle brackets are not added?
>
> angle and square brackets inconsistency
>
> --- 8< ---
> # (require 'ol-man)
> # (setq org-ascii-links-to-notes nil)
>
> - web :: [[http://orgmode.org][Org mode]]
> - man :: [[man:man][man]]
> - internal :: [[Heading][heading]]
>
> * Heading
> --- >8 ---
> --- 8< ---
> web
> [Org mode] (<http://orgmode.org>)
> man
> man (http://man.he.net/?topic=man§ion=all)
This is probably a bug in ol-man.
> internal
> heading (See section 1)
I see no problem here - internal links are special, and it makes sense to
drop angle brackets, unlike external web links that are often marked
with angle brackets in the wild.
> 1 Heading
> ═════════
> --- >8 ---
>
>>>>> + (if (string-match-p "\\`\u200b*\\[.*\\]\u200b*\\'" anchor)
>>>>> + anchor
>>>>> + (format "[%s]" anchor))
>>>>
>>>> This is out of scope of the patch, isn't it?
>>>
>>> Not really.
>>
>> Do you mean "this is out of scope"?
>
> I mean, it is a related change. E.g. ox-html and ox-latex do not add
> square brackets around link descriptions, it is specifics of ox-ascii.
> Square brackets are sometimes added for inline links, sometimes they are
> not. Square brackets are always added for links as notes. I would avoid
> duplicated square brackets when links are formatted as notes and for
> inline links when description is formatted with brackets.
I did not mean unrelated to ox-ascii. I meant unrelated to "add new
feature allowing more flexibility for :export property of links when
exporting to ASCII".
I see handling anchors as a bugfix that should be discussed and
committed separately.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- [RFC][PATCH] Allow to export to ascii custom link types as notes, Max Nikulin, 2023/10/20
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes, Ihor Radchenko, 2023/10/22
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes, Max Nikulin, 2023/10/22
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes, Ihor Radchenko, 2023/10/23
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes, Max Nikulin, 2023/10/23
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes,
Ihor Radchenko <=
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes, Max Nikulin, 2023/10/24
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes, Ihor Radchenko, 2023/10/24
- [PATCH] ox-ascii.el: Consistently add brackets around links (was: Re: [RFC][PATCH] Allow to export to ascii custom link types as notes), Max Nikulin, 2023/10/24
- Re: [PATCH] ox-ascii.el: Consistently add brackets around links (was: Re: [RFC][PATCH] Allow to export to ascii custom link types as notes), Ihor Radchenko, 2023/10/25
- man pages references (Re: [PATCH] ox-ascii.el: Consistently add brackets around links), Max Nikulin, 2023/10/26
- Re: [RFC][PATCH] Allow to export to ascii custom link types as notes, Max Nikulin, 2023/10/27
- [RFC][PATCH v2] Allow to export to ascii custom link types as notes, Max Nikulin, 2023/10/25