[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `:export' attribute?: Re: Experimental public branch for inline spec
From: |
Juan Manuel Macías |
Subject: |
Re: `:export' attribute?: Re: Experimental public branch for inline special blocks |
Date: |
Fri, 15 Mar 2024 16:26:15 +0000 |
Max Nikulin writes:
> (ignore
> (pp
> (let ((rules
> (org-export--inline-special-block-make-backend-alist
> (org-split-string "latex/ html./ ascii+ *"))))
> (mapcar (lambda (backend)
> (list backend
> (org-export--inline-special-block-export-decision
> rules backend)))
> '(odt latex beamer html md ascii)))))
>
> Gives
>
> ((odt content)
> (latex nil)
> (beamer nil)
> (html nil)
> (md content)
> (ascii full))
>
> Function definitions:
>
> (defun org-export--inline-special-block-make-backend-alist
> (rules)
> (nconc
> (let (result)
> (dolist (spec rules)
> (if (string-match
>
> "\\`\\([-_a-zA-Z0-9]*\\)\\(?:\\([/+*]\\)\\|\\([=.]\\)\\([/+*]\\)?\\)?\\'"
> spec)
> (let ((name (match-string 1 spec))
> (inherit (match-string 3 spec))
> (what (or (match-string 2 spec)
> (match-string 4 spec))))
> (push (cons
> (if (string-equal "" name) '@ (intern name))
> (cons (or (not inherit) (string-equal inherit "="))
> (if what (string-to-char what) ?+)))
> result))
> (message "invalid :export specification %S" spec)))
> result)))
>
> (defun org-export--inline-special-block-export-decision
> (rules-alist backend)
> (when (symbolp backend)
> (setq backend (org-export-get-backend backend)))
> (let* ((rule (assoc (org-export-backend-name backend) rules-alist))
> (decision (and rule (cddr rule))))
> (while (and (not decision)
> (setq backend (org-export-backend-parent backend)))
> (setq backend (org-export-get-backend backend))
> (when (and (setq rule (assq (org-export-backend-name backend)
> rules-alist))
> rule
> (cadr rule))
> (setq decision (cddr rule))))
> (unless decision
> (setq rule (assq '@ rules-alist))
> (setq decision (and rule (cddr rule))))
> (pcase decision
> (?+ 'full)
> (?* 'content)
> (?/ nil)
> (_ 'full))))
I've been testing your code and it works very well. It is certainly
finer than the current approach. I think it could be implemented, and we
are testing that.
Tomorrow I will make a new commit with your code.
--
Juan Manuel Macías -- Composición tipográfica, tratamiento de datos, diseño
editorial y ortotipografía
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, (continued)
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Max Nikulin, 2024/03/13
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Juan Manuel Macías, 2024/03/13
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Juan Manuel Macías, 2024/03/13
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Juan Manuel Macías, 2024/03/14
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Max Nikulin, 2024/03/15
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Ihor Radchenko, 2024/03/15
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Max Nikulin, 2024/03/15
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Ihor Radchenko, 2024/03/15
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Juan Manuel Macías, 2024/03/15
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Max Nikulin, 2024/03/15
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks,
Juan Manuel Macías <=
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Max Nikulin, 2024/03/16
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Juan Manuel Macías, 2024/03/18
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Max Nikulin, 2024/03/19
- Re: `:export' attribute?: Re: Experimental public branch for inline special blocks, Juan Manuel Macías, 2024/03/19
- inline-special-block: export rules (was: `:export' attribute?: Re: Experimental public branch for inline special blocks), Juan Manuel Macías, 2024/03/21
- Re: inline-special-block: export rules, Max Nikulin, 2024/03/26
naming: Re: Experimental public branch for inline special blocks, Max Nikulin, 2024/03/04