On 19/09/2023 07:10, Rudolf Adamkovič wrote:
Max Nikulin <maniku...@gmail.com> writes:

Do you think a label specifying language should be added to code
snippets, e.g. <code title="elisp">(identity "a")</code> or it is
useless and may cause undesired noise for screen reader users? What
about LaTeX?

As a user, I would expect

   [[elisp:(identity "a")]]

to be export-equivalent to

   src_elisp[:exports code]{(identity "a")}

across all backends.

(defun org-link-export-eval-link-no-descr
    (type path descr backend info)
  (unless descr
    (let ((element
           (org-element-create
            'inline-src-block
            (list :language type
                  :value path
                  :parameters ":exports code :noweb no :eval never"))))
      (org-export-data element info))))

(defun org-link-make-export-eval-link-no-descr (type)
  (lambda (path descr backend info)
           (org-link-export-eval-link-no-descr
            type path descr backend info)))

(dolist (type '("elisp" "shell"))
  (org-link-set-parameters
   type
   :export (org-link-make-export-eval-link-no-descr type)))

What is your expectation for links having description?

    [[elisp:(identity "a")][Run it]]

Good point!  Perhaps we just need to find a
good symbol that would work well between the
Elisp code and the description?

For example

   /Run it/ \to src_elisp[:exports code]{(identity "a")}

exports to ASCII as

   /Run it/ -> `(identity "a")'

Of course, \to could be something else...

I have another example:

   [[elisp:(server-start)][=M-x server-start RET=]]

suitable for a printed document.

From my point of view, it is better either to drop link path completely or to add a button to copy the code to clipboard. Repetition is undesired.

So I am unsure if it is possible to choose unambiguous rules for export of elisp and shell links.


Reply via email to