From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id IIsKDlKn+WXG6wAAqHPOHw:P1 (envelope-from ) for ; Tue, 19 Mar 2024 15:55:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id IIsKDlKn+WXG6wAAqHPOHw (envelope-from ) for ; Tue, 19 Mar 2024 15:55:14 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1710860114; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2uCfaEmBSw4ntzAYo751Rg7DkHhsStJEvWD+ghq/saE=; b=SgFxTFDqr93fcTunYNsXcFPXpc9anWJ5WYomuAgO0YDz/h3+bBtHj1EM/3H8E/3ZUFSDQJ gSYMKNazFR3YW5jsAnzKjLt8mshys/egLJTPhuIIWFU6Uf69kKnlTG3dKyiWALA0DsI3rr uFSbxFlhE3eqcskQyze5P5iFkl+wTzA4v9zCdowhSSaAPkOiI/l5Pws3fLeEHvjj5iSQUF Eqplz8D9jC+wDjwHOyacS0GFcIbfzVaZ8AFcPCq8VqbLtgxKe/b6VSZHFV0Mr/Z1+My8UI XyCWU0ypsNw/YP7mNtnzxK1TpNKI2atOL7VZFLzTwvDKk7k90nnFgFhcf4nH7Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1710860114; a=rsa-sha256; cv=none; b=HKwfrc1mioNK0YCiL9zQC3AI9tJRdFn1ZlHqR35jRH468kBD97TOOPY5p3HSiNBG+5Q+QH cTd7P9lH10Cr8dBfu2rc9lG2sl8Blzcl9CuysyvNWJ84OnLdFD3z7HHHg6966bVpqwymYj JKLnPMPchJoYnQrJ/u0EjuMfJNnkXPJSDhOnQitaxW4V3TQT5kxHFXfCKp1ULEmGugfgS8 hw2TjpwvVVgCk7GPxmq1k+ZINWdwb8LCdWNfxnNW96gXgY0FRyv6Pu6YRah4ZZAvzAMH5/ VeeckQvEFfklV2qW0ykN6x5Hf15o4Gqx99dG0LfQVARuMNtgabMfOds+wtzfOA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 16A126CA32 for ; Tue, 19 Mar 2024 15:55:14 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmarI-0006ma-F6; Tue, 19 Mar 2024 10:54:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmarG-0006mP-Ne for emacs-orgmode@gnu.org; Tue, 19 Mar 2024 10:54:30 -0400 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmarA-00047L-2C for emacs-orgmode@gnu.org; Tue, 19 Mar 2024 10:54:30 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rmar4-0007H0-K7 for emacs-orgmode@gnu.org; Tue, 19 Mar 2024 15:54:18 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: `:export' attribute?: Re: Experimental public branch for inline special blocks Date: Tue, 19 Mar 2024 21:54:12 +0700 Message-ID: References: <87wmql6690.fsf@posteo.net> <87cysb2h68.fsf@posteo.net> <877ciavnwo.fsf_-_@posteo.net> <87bk7k7tuf.fsf@posteo.net> <87wmq85xn9.fsf@posteo.net> <877ci7bm2b.fsf@posteo.net> <87y1an9wkj.fsf@posteo.net> <87il1qm61y.fsf@posteo.net> <87edcem4rw.fsf@posteo.net> <87wmq4me2k.fsf@posteo.net> <875xxn4g2g.fsf@posteo.net> <87r0g7qqcg.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla Thunderbird Content-Language: en-US, ru-RU In-Reply-To: <87r0g7qqcg.fsf@posteo.net> Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 26 X-Spam_score: 2.6 X-Spam_bar: ++ X-Spam_report: (2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -5.70 X-Spam-Score: -5.70 X-Migadu-Queue-Id: 16A126CA32 X-Migadu-Scanner: mx11.migadu.com X-TUID: nFNrp57PyA0x On 19/03/2024 02:42, Juan Manuel MacĂ­as wrote: > As I mentioned in a past email, these days I will be somewhat busy, but > I will try to keep up to date with your comments. Although it may take a > while to respond. Would you mind against new thread as an umbrella for next bunch of topics? Current one becomes too large from my point of view. For a while a couple of questions related to :export to think on. I am afraid that :export will cause confusion with :exports for source code blocks. Its name differs by just "s" but possible values have nothing common. Another issue is more general and should apply e.g. to HTML attributes as well. Consider --- 8< --- #+options: inline-special-block-aliases:(("kbd" :export "html*" :html-tag kbd)) @kbd{Default} and @kbd[:export "latex*"]{LaTeX} --- >8 --- It exports to

\nDefault and LaTeX

I would expect that "html*" is inherited from the parent declaration and "latex*" does not override it, so

\nDefault and LaTeX

On the other hand it should be possible to specify that declared earlier rules should be taken into consideration. E.g. "#" might stop further processing: --- 8< --- #+options: inline-special-block-aliases:(("kbd" :export "html*" :html-tag kbd)) @kbd{Default} and @kbd[:export "latex* #"]{LaTeX} --- >8 --- makes

\nDefault and LaTeX

result valid. In the meanwhile I have realized that there is no point in the list of parsed rules. You may consider code organized in a bit different way. I hope, just a single extra line in these helpers is required to support "#". (defun org-export--parse-export-rule (spec) (and (string-match "\\`\\([-_a-zA-Z0-9]*\\)\\(?:\\([/+*]\\)\\([=.]\\)?\\|\\([=.]\\)\\([/+*]\\)?\\)?\\'" spec) (let ((name (match-string 1 spec)) (inherit (or (match-string 3 spec) (match-string 4 spec))) (what (or (match-string 2 spec) (match-string 5 spec)))) (cons (if (string-equal "" name) '@ (intern name)) (cons (or (not inherit) (string-equal inherit "=")) (pcase (and what (string-to-char what)) ((or ?+ (pred null)) 'full) (?* 'content) (?/ nil))))))) ;; (org-export--parse-export-rule "html+=") (defun org-export--backend-hierarchy (backend) "Result may be cached in INFO." (let ((hierarchy)) (when (not (symbolp backend)) (setq backend (org-export-backend-name backend))) (while backend (push backend hierarchy) (setq backend (org-export-backend-parent (org-export-get-backend backend)))) hierarchy)) ;; (org-export--backend-hierarchy 'md) (defun org-export--inline-special-block-export-decision (spec-list hierarchy &optional default-rule) "Returns (backend inherit . what). so use `cddr' to get decision." (let ((decision '(@ t . full)) (hierarchy (cons '@ hierarchy))) (while (and hierarchy spec-list) (let* ((rule (org-export--parse-export-rule (pop spec-list))) (tail (and rule (memq (car rule) hierarchy)))) (if (not rule) (message "invalid :export specification %S" (car spec-list))) (when (and tail (or (not (cdr tail)) ; Current backend. (cadr rule))) ; Inherits. (setq hierarchy (cdr tail)) (setq decision rule)))) (if (and default-rule (memq (car default-rule) hierarchy)) default-rule decision))) ---- (ignore (pp (let ((rules (org-split-string "latex/ html./ html+= ascii+ *"))) (mapcar (lambda (backend) (let ((hierarchy (org-export--backend-hierarchy backend))) (list backend (cddr (org-export--inline-special-block-export-decision rules hierarchy))))) '(odt latex beamer html md ascii))))) ((odt content) (latex nil) (beamer nil) (html nil) (md full) (ascii full))