From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC][PATCH v2] Allow to export to ascii custom link types as notes
Date: Wed, 08 Nov 2023 10:45:10 +0000 [thread overview]
Message-ID: <8734xgfrrd.fsf@localhost> (raw)
In-Reply-To: <uifnip$11eq$1@ciao.gmane.io>
Max Nikulin <manikulin@gmail.com> writes:
>> We can alternatively check function arity.
>
> 5 unnamed arguments for functions that are supposed to be implemented by
> users looks rather close to a border when it becomes fragile. The
> language does not enforce type checking for user-supplied functions and
> users would not bother as well. Multi-argument functions was a painful
> experience with FORTRAN for me (fortunately I was not deeply involved).
Makes sense.
>>> Do you mean something like the following?
>>>
>>> (defun org-man-export (link description backend)
>>> "Export a man page LINK with DESCRIPTION.
>>> BACKEND is the current export backend."
>>> (org-element-create-link
>>> (format "http://man.he.net/?topic=%s§ion=all" link)
>>> description))
>>
>> Yes.
>
> It is nice idea for most backends, but it is unclear for me what the
> following function should return for ox-ascii
>
> Ihor Radchenko. Re: Exporting elisp: and shell: links. Sun, 08 Oct 2023
> 09:48:07 +0000.
> https://list.orgmode.org/87r0m5phrc.fsf@localhost
>> +(defun org-link--export-code (path description _ info &optional lang)
>> + "Export executable link with PATH and DESCRIPTION.
>> +INFO is the current export info plist.
>> +LANG is the language name, as in #+begin_src lang. For example, \"elisp\"
>> +or \"shell\"."
>> + (concat
>> + (org-export-data
>> + (org-element-create
>> + 'inline-src-block
>> + `( :language ,lang
>> + :value ,path
>> + :parameters ":exports code :noweb no :eval never"))
>> + info)
>> + (when description (format " (%s)" description))))
>
> Source code should be exported inline or as a note depending on
> preferences. This case exported element is not a link, so description
> should be treated separately.
In this scenario, :filter function may transform :raw-path in the link
object, replacing it with
(org-export-data (org-element-create-inline-src-block ...) info).
Or we may arrange ox-ascii to export :raw-link object
(format "[%s] <%s>" anchor (org-export-data (org-element-property :raw-link link) info))
Then, I imagine `org-link--export-code' to do something like
(unless (org-element-property :org-link-code-exported link)
(setq link (org-element-copy link))
(org-element-put-property link :org-link-code-exported t)
(org-element-put-property :raw-link (org-element-create-inline-src-block ...)))
--
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>
next prev parent reply other threads:[~2023-11-08 10:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 17:21 [RFC][PATCH] Allow to export to ascii custom link types as notes Max Nikulin
2023-10-22 9:13 ` Ihor Radchenko
2023-10-22 17:05 ` Max Nikulin
2023-10-23 9:17 ` Ihor Radchenko
2023-10-23 11:00 ` Max Nikulin
2023-10-23 12:09 ` Ihor Radchenko
2023-10-24 8:11 ` Max Nikulin
2023-10-24 10:40 ` Ihor Radchenko
2023-10-24 15:06 ` [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-25 10:34 ` Ihor Radchenko
2023-10-26 16:46 ` man pages references (Re: [PATCH] ox-ascii.el: Consistently add brackets around links) Max Nikulin
2023-11-05 12:08 ` Ihor Radchenko
2023-10-27 14:36 ` [RFC][PATCH] Allow to export to ascii custom link types as notes Max Nikulin
2023-10-25 15:16 ` [RFC][PATCH v2] " Max Nikulin
2023-11-07 9:30 ` Ihor Radchenko
2023-11-07 11:48 ` Max Nikulin
2023-11-07 11:58 ` Ihor Radchenko
2023-11-08 10:23 ` Max Nikulin
2023-11-08 10:45 ` Ihor Radchenko [this message]
2023-11-08 10:57 ` Max Nikulin
2023-11-08 11:16 ` Ihor Radchenko
2023-11-09 11:12 ` Max Nikulin
2023-11-11 11:17 ` Ihor Radchenko
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8734xgfrrd.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=manikulin@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.