Timothy <orgm...@tec.tecosaur.net> writes: > Here is a list of terms which I’d feel comfortable applying to the system: > ⁃ export features > ⁃ export capabilities > ⁃ export snippets
I am looking at the concept again, and I feel that we may be missing some flexibility here. I do not like the fact that each feature can only have a simple implementation within specific backend. Imagine that we would like add a top _and also_ bottom comment when the Org buffer contains emoji. With the proposed patch, it will be impossible. I am thinking about something conceptually similar, but more general. Instead of detecting "features" in the whole document, let's consider that for every exported Org element (including org-data, representing the whole document) we may emit different export output depending on certain condition being satisfied for either original Org raw source of the exported element, the element AST, or the exported element contents. Let's call it "transcoder conditions". What I have in mind is an ability to parametrize the transcoders like the following: (org-export-define-backend 'html '((paragraph . ((paragraph-is-a-link? figure-transcoder :name figure) (:unless 'figure paragraph-transcoder)))) :transcoder-conditions '((paragraph . ((paragraph-is-a-link? (lambda (paragraph contents info)...)))))) Several ideas in the above: 1. Name features as "transcoder conditions" 2. The transcoder conditions are now linked to specific Org AST element. They may not only be matched against the whole parse tree + whole raw Org text, but also against the specific branch of AST + chunk of raw Org text corresponding to the branch + the actual exported contents of the AST children. 3. "feature implementations" are no longer needed. Instead, export transcoders can contain the implementation lists inline. Each implementation is selected not only depending on the presence of the "feature"/transcoder condition, but also depending on multiple features or arbitrary lisp expression results. 4. :when/:prevents apply to specific (possibly named) implementations. This makes more sense than matching against feature. For example, presence of svg images in latex export may or may not mean that \usepackage{svg} is being used, depending on svg implementation. We want to match against \usepackage{svg} specifically rather than only against the presence of svg images. WDYT? -- 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>