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 IL4iEwE69GWxCwAAqHPOHw:P1 (envelope-from ) for ; Fri, 15 Mar 2024 13:07:29 +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 IL4iEwE69GWxCwAAqHPOHw (envelope-from ) for ; Fri, 15 Mar 2024 13:07:29 +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=1710504448; 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=Hjuj/gKMAsRXOEROjefcOCjDKYFdtmA3OaQy5Z2E2Go=; b=fsPRXe2/qhc0LQZY7glpORB4bqlUToo5Ja+DhnX4WqWJFBVPiM60fQofYJo2otadoB3Urv M5iuv/Yn6MmqPJsLX7GYcB2hhSZy/fOgdMGFs0hZUIjBzjltjVxlRJP2QcoTN8rugzpYv4 hvM7EWLtCn0axun3PtlSNerdzZOCsM9YGm1df/dPeRm5MLYvi2WKTG1BGdzSOk2X2V2PYS fPMz0Qx3bmja7RNqMQd+do0Mt2+dhZqH3rGYEpbC709ark3fQ6IryjDvE81lDgt5Qv662v QXsbOLDH2ziqQHfIVPDwIPqBJYq94Xv9PTTMtTT+Jdk9I5H2oOI7QmLA4w74tA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1710504448; a=rsa-sha256; cv=none; b=BefH1aB8wVol/9jkjHKJvMKYPsZnFxEQpBsQ0ehIyb56Ccynp2pdsDxQZQl90nWaEMh3aU c2FEP9lCMqBMtgAwSNo6iDA6NQWxux0/l+t7+T5xKTN+dG5Jf259GELHSAMuPbLVjI39cz 2sfkQANDQsK9xnw2KHAWDeElHjtKNkH54rX0QhnQhIHtSRxMpMK5KD0uoNzlPwNjpfcZcb tEpEbH3ojfQUBk2UlvvukarOK/U8FJuytbFIysWL5MSfJSGFKGBRaYZkPUbTPQAXwAVs89 D8sF/zT7FmsybbBvIrXo13EsT02IRmcRxp4UPrD2U4DD9U1Dcshcif7PV/ibLg== 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 650505B242 for ; Fri, 15 Mar 2024 13:07:28 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl5BO-00017W-Th; Fri, 15 Mar 2024 06:53:02 -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 1rl5BK-00014o-Sz for emacs-orgmode@gnu.org; Fri, 15 Mar 2024 06:52:59 -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 1rl5BJ-0002YI-Cb for emacs-orgmode@gnu.org; Fri, 15 Mar 2024 06:52:58 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rl5BG-000111-7o for emacs-orgmode@gnu.org; Fri, 15 Mar 2024 11:52:54 +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: Fri, 15 Mar 2024 17:52:48 +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> 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: <87wmq4me2k.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: 25 X-Spam_score: 2.5 X-Spam_bar: ++ X-Spam_report: (2.5 / 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.248, 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.45 X-Spam-Score: -5.45 X-Migadu-Queue-Id: 650505B242 X-Migadu-Scanner: mx11.migadu.com X-TUID: 7m3C2YRd2Enh On 15/03/2024 09:19, Juan Manuel MacĂ­as wrote: > The attribute supports one or more elements separated by a space. Each > element can be any of the following signs: "*" (export only the > content), "-" (do not export), "=" (export the rest normally), "=*" > (export the rest, but only the content), "=-" (do not export the rest). > Additionally, backend names can be given explicitly, alone or > accompanied by the "*" or "-" signs, that is (where "backend" equals the > name of the backend): 1. "-" is a valid backend name and valid last character of backend name 2. From the description it is not clear to me what is effect of "rest" specified for more than one backend. I have had into the code. I would expect something like the following (characters may be changed, the code is not heavily tested). Two characters from the following groups may be appended to backend name: + full (default) * content / skip (these ones may be used without backed name to specify fallback action) = this and derived backends (default) . this, but not derived backends Perhaps it is necessary to add possibility that these rules may coexist (use loop instead of assoc) (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))))