From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Raw Org AST snippets for "impossible" markup
Date: Thu, 9 Dec 2021 21:56:16 +0700 [thread overview]
Message-ID: <sot5en$g1b$1@ciao.gmane.io> (raw)
In-Reply-To: <87lf0u8dnf.fsf@posteo.net>
On 09/12/2021 14:01, Juan Manuel Macías wrote:
> John Kitchin writes:
>
>> Have you seen
>> https://github.com/tj64/org-dp? It seems to do a lot with creating and
>> manipulating org elements. It might either be handy or lead to some
>> inspiration.
>
> Interesting package. Thanks for sharing.
Either I missed something or its purpose is completely different. It
maps Org markup to Org markup. I am experimenting with fragments that
should allow to get something that is really tricky or even impossible
with established syntax, so it has to run immediately before exporters.
> It gave me an idea, also borrowing part of Maxim's code, but evaluating
> in this case the path. To continue playing with links... The goal is
> to obtain a link with this structure `[[quote-lang:lang][quote]]':
>
> #+BEGIN_SRC emacs-lisp :results silent
> (org-link-set-parameters
> "quote-lang"
> :display 'full
> :export (lambda (path desc bck)
> (let* ((bck org-export-current-backend)
> (attr (list (format
> ":environment foreigndisplayquote :options {%s}"
> path)))
> (info (org-export-get-environment
> bck nil nil)))
> (org-no-properties
> (org-export-data-with-backend
> `(quote-block (:attr_latex ,attr)
> ,desc)
> bck info)))))
> #+END_SRC
Looking into your code I have realized that it should be implemented
using filter, not through :export property of links. Maybe without
working proof of concept with link exporters, this session of
monkey-typing would not be successful.
#+begin_src elisp :results silent
(defun orgia-element-replace (current new destructive?)
(if (eq current new)
current
(let* ((lst? (and (listp new) (not (symbolp (car new)))))
(new-lst (if lst?
(if destructive? (nconc new) (reverse new))
(list new))))
(dolist (element new-lst)
(org-element-insert-before element current)))
(org-element-extract-element current)
new))
(defun orgia--transform-link (data)
(if (not (string-equal "orgia" (org-element-property :type data)))
data
(let* ((path (org-element-property :path data)))
(if (not (eq ?\( (aref path 0)))
(or path (org-element-contents data))
(read path)))))
(defun orgia-parse-tree-filter (data _backend info)
(org-element-map data 'link
(lambda (data)
(orgia-element-replace data (orgia--transform-link data) t))
info nil nil t)
data)
#+end_src
#+begin_src elisp :results silent
(add-to-list 'org-export-filter-parse-tree-functions
#'orgia-parse-tree-filter)
(org-link-set-parameters "orgia")
#+end_src
#+begin_src elisp
(org-export-string-as "An <orgia:(\"in\" (italic () \"ter\"))>word"
'html t)
#+end_src
#+RESULTS:
: <p>
: An in<i>ter</i>word</p>
next prev parent reply other threads:[~2021-12-09 15:00 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-02 10:50 Org-syntax: Intra-word markup Denis Maier
2021-12-02 11:18 ` Ihor Radchenko
2021-12-02 11:30 ` Juan Manuel Macías
2021-12-02 11:36 ` Denis Maier
2021-12-02 12:01 ` Ihor Radchenko
2021-12-02 11:42 ` Marco Wahl
2021-12-02 11:50 ` Denis Maier
2021-12-02 12:10 ` Ihor Radchenko
2021-12-02 12:40 ` Denis Maier
2021-12-02 12:54 ` Ihor Radchenko
2021-12-02 13:14 ` Juan Manuel Macías
2021-12-02 13:28 ` Denis Maier
2021-12-02 12:48 ` Max Nikulin
2021-12-02 12:02 ` Ihor Radchenko
2021-12-02 12:00 ` Ihor Radchenko
[not found] ` <87r1avtdjy.fsf@ucl.ac.uk>
2021-12-02 12:27 ` Denis Maier
2021-12-02 13:06 ` Eric S Fraga
2021-12-02 12:28 ` Denis Maier
2021-12-02 12:55 ` Ihor Radchenko
2021-12-02 11:58 ` Timothy
2021-12-02 12:26 ` Denis Maier
2021-12-02 13:07 ` Ihor Radchenko
2021-12-02 15:51 ` Max Nikulin
2021-12-02 18:11 ` Tom Gillespie
2021-12-02 19:09 ` Juan Manuel Macías
2021-12-04 13:07 ` Org-syntax: emphasis and not English punctuation Max Nikulin
2021-12-04 16:42 ` Juan Manuel Macías
2021-12-02 20:47 ` Org-syntax: Intra-word markup Denis Maier
2021-12-02 22:44 ` Samuel Wales
2021-12-03 14:53 ` Max Nikulin
2021-12-03 23:51 ` Tim Cross
2021-12-04 15:01 ` Max Nikulin
2021-12-05 23:34 ` Russell Adams
2021-12-05 23:37 ` Russell Adams
2021-12-06 1:39 ` Samuel Wales
2021-12-02 19:03 ` Nicolas Goaziou
2021-12-02 19:34 ` Juan Manuel Macías
2021-12-02 23:05 ` Nicolas Goaziou
2021-12-02 23:24 ` Juan Manuel Macías
2021-12-03 14:24 ` Max Nikulin
2021-12-03 15:01 ` Juan Manuel Macías
2021-12-04 15:57 ` Denis Maier
2021-12-04 17:53 ` Tom Gillespie
2021-12-04 18:37 ` John Kitchin
2021-12-04 21:16 ` Juan Manuel Macías
2021-12-06 10:57 ` Raw Org AST snippets for "impossible" markup Max Nikulin
2021-12-06 15:45 ` Juan Manuel Macías
2021-12-06 16:56 ` Juan Manuel Macías
2021-12-08 13:09 ` Max Nikulin
2021-12-08 23:19 ` Juan Manuel Macías
2021-12-08 23:35 ` John Kitchin
2021-12-09 7:01 ` Juan Manuel Macías
2021-12-09 14:56 ` Max Nikulin [this message]
2021-12-09 16:11 ` Juan Manuel Macías
2021-12-09 22:27 ` Juan Manuel Macías
2022-01-03 14:34 ` Max Nikulin
2021-12-04 19:04 ` Org-syntax: Intra-word markup Timothy
2021-12-04 21:48 ` Tom Gillespie
2021-12-06 10:59 ` Max Nikulin
2022-01-28 14:52 ` Max Nikulin
2022-01-29 3:13 ` Ihor Radchenko
2022-01-29 13:05 ` Juan Manuel Macías
2022-02-02 15:28 ` Max Nikulin
2022-02-02 20:01 ` Juan Manuel Macías
2022-02-03 12:10 ` Max Nikulin
2021-12-06 11:01 ` Denis Maier
2022-01-28 12:12 ` [PATCH] Intra-word markup: \relax Max Nikulin
2022-01-28 13:13 ` Juan Manuel Macías
2022-02-02 15:42 ` Max Nikulin
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='sot5en$g1b$1@ciao.gmane.io' \
--to=manikulin@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).