[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Raw Org AST snippets for "impossible" markup

From: Max Nikulin
Subject: Re: Raw Org AST snippets for "impossible" markup
Date: Wed, 8 Dec 2021 20:09:29 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 06/12/2021 22:45, Juan Manuel Macías wrote:

I understand that with this method the emphases could be nested, which
it seems also very productive. I like it.

I would suggest, however, not to use the term 'italics', since is a
'typographic' term, but a term that is agnostic of format and
typography, something like as 'emphasis' or 'emph'. For example, in a
format agnostic environment like Org, which is concerned only with
structure, an emphasis is always an emphasis. But in a typographic
environment that emphasis may or may not be be in italics. That is why
in LaTeX you can write constructions like:

As you have guessed, It is not my choice, it is interface of ox.el and org-element.el.

However if you strongly want to use proper terminology in markup, you may try to trade it for +your soul+ compatibility and portability issues. The following almost works:

#+begin_src elisp :results silent
  (defun orgia-link (link-data desc info)
    (let* ((backend-struct (plist-get info :back-end))
           (backend-name (org-export-backend-name backend-struct)))
       (org-export-custom-protocol-maybe link-data desc backend-name info)
       (let* ((parent (org-export-backend-parent backend-struct))
              (transcoders-alist (org-export-get-all-transcoders parent))
              (link-transcoder (alist-get 'link transcoders-alist)))
         (if link-transcoder
             (funcall link-transcoder link-data desc info)

  (defun evilatex-emph (_emph content info)
    ;; I have no idea yet why newline is appended.
    (format "\\textit{%s}%%" content))

  (org-export-define-derived-backend 'evilatex 'latex
    :translate-alist '((emph . evilatex-emph)
                       (link . orgia-link)))

#+begin_src elisp
  (let ((org-export-with-broken-links 'mark))
"An [[orgia:(italic () \"ex\")]]ample of <orgia:(emph () \"inter\")>word and [[http://te.st][link]] [[unknown:prefix][desc]]!"
     'evilatex t))

: An \emph{ex}ample of \textit{inter}%
: word and \href{http://te.st}{link} [BROKEN LINK: unknown:prefix]!

Actually, I believe that something like orgia-link code should be added by `org-exprot-define-derived-backend' if "link" is missed in translate-alist. I suspect that `org-export-get-all-transcoders' may be avoided.

   (setq org-export-global-macros
        '(("emph" . "(eval (my-macro-emph $1))")))

Sorry, I have not prepared better variant to solve comma in macro problem yet.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]