From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eNeTHPy+7WFpIAEAgWs5BA (envelope-from ) for ; Sun, 23 Jan 2022 21:47:56 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id EF5eFfy+7WEJagAAG6o9tA (envelope-from ) for ; Sun, 23 Jan 2022 21:47:56 +0100 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 F08C515783 for ; Sun, 23 Jan 2022 21:47:55 +0100 (CET) Received: from localhost ([::1]:52070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBjmE-0000f3-5R for larch@yhetil.org; Sun, 23 Jan 2022 15:47:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBjSq-000185-6I for emacs-orgmode@gnu.org; Sun, 23 Jan 2022 15:27:53 -0500 Received: from mail.hostpark.net ([212.243.197.30]:33720) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBjSl-0003ou-TL for emacs-orgmode@gnu.org; Sun, 23 Jan 2022 15:27:51 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 804E31647F for ; Sun, 23 Jan 2022 21:27:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1642969661; bh=OLpeXig3qoIKBcM 6f//oqtO+KNwAOsYNrlp7+u9+efY=; b=HifxbRLUilY6KycZX1ssBX7RP2iOO5J G4uYQgNf9tavoKJdGJ1WXQRIbxQO39To3dRZM0MVKSDI3/fgiFQE4NwqmRYslzNV 4h8lA17I91EVErjnFZxatu7ncI5SYUA8uzWYyjIfBFGua6xj8TpqnI8oq8Ah9ZAC ZK91lOgx9h7U= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id 0iasoMbEIbqR for ; Sun, 23 Jan 2022 21:27:41 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 46556164BA for ; Sun, 23 Jan 2022 21:27:41 +0100 (CET) From: Jonas Bernoulli To: emacs-orgmode@gnu.org Subject: [PATCH v4 2/3] ox-texinfo: Optionally use @itemx for certain description list items Date: Sun, 23 Jan 2022 21:27:39 +0100 Message-Id: <20220123202740.512619-3-jonas@bernoul.li> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220123202740.512619-1-jonas@bernoul.li> References: <20211218214038.9459-1-jonas@bernoul.li> <20220123202740.512619-1-jonas@bernoul.li> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642970876; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=8MlKz69Mi7HD+f0HxAHB89/N1B+yKZ8Z3yw0NVh3M4w=; b=Dlu6mSPEXK8ER3TzFPJsinL4A4zsdRPgqlzvOdQHkhq5CjKvBxejdvlfyen9DnXxNAF1Rq ewSyvEbtM7pgPiM+s+09Ql/6jLhxsb7BzGsasPhMNGO4XkgQAJPPE5asOC0v4ekkJHyIu5 QQak9EiVLXQ9MV+yAh00tMYap0adWh1XccSZ9h02VwbBYGsvoRqiVYoR816TQQw8eAqhgD KFZLlGRhnokzen3LaA3W1DVxd4XUElW3KpmSFmQOas/0c2EffEP9s2Zs4yyxIMP0VPkQzk jrx6+X+lUzoWCszRbKc8SQR1ZhtDC4QKiaEW2vem4wnYmzdxtOErpnTI5xAa4g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642970876; a=rsa-sha256; cv=none; b=tS5dKi1idZNnQbzYciAtnYIzjTcApKof2OX1q+yEROB8OUXGhQziJbmT2dCjju6wTp1fqk ZcIr2BG55rBo9EhuXq9nzcHVhFrZK6ODrpC6wzmx3HKEP3rotoDY6ioXgAQrqCeW+UR9Tw XLfovqjkkGLzIaChbGBwFtNKwtJJceFG3AoCZDxxes5115+CQ9hftO+9GbSVu/30/ebGWs toZJpoCu6eV2fuzzzy/2MCyrlBvj5AV0U6nT4brhU0IDWbIxIrwe5iqKeVl48v3yXoi6Qk vcM94UNhj9aR44mfXROsVyBWw8xezpK3nr2bJtkf2aA4hJmextkelD0CmNvxKA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=bernoul.li header.s=sel2011a header.b=HifxbRLU; dmarc=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" X-Migadu-Spam-Score: -2.43 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=bernoul.li header.s=sel2011a header.b=HifxbRLU; dmarc=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" X-Migadu-Queue-Id: F08C515783 X-Spam-Score: -2.43 X-Migadu-Scanner: scn1.migadu.com X-TUID: eoEm4caTdXMW * doc/org-manual.org (Plain lists in Texinfo export): Reorder and document new functionality. * lisp/ox-texinfo.el (org-texinfo-item): In a description list when its :compact attribute is non-nil, then transcode consecutive items using one @item and one or more @itemx commands, if all of them except for the last one lack content. --- doc/org-manual.org | 36 +++++++++++++++++++++--------- lisp/ox-texinfo.el | 55 ++++++++++++++++++++++++++++++---------------- 2 files changed, 62 insertions(+), 29 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index e88cf1ed9..344aaf3e7 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -15236,6 +15236,23 @@ This paragraph is preceded by... :DESCRIPTION: List attributes. :END: +#+cindex: lettered lists, in Texinfo export +#+cindex: enum, Texinfo attribute +The Texinfo export back-end converts unordered and ordered lists in +the Org file using the default command =@itemize=. + +Ordered lists are numbered when exported to Texinfo format. Such +numbering obeys any counter (see [[*Plain Lists]]) in the first item of +the list. The =:enum= attribute also let you start the list at a +specific number, or switch to a lettered list, as illustrated here: + +#+begin_example +#+ATTR_TEXINFO: :enum A +1. Alpha +2. Bravo +3. Charlie +#+end_example + #+cindex: @samp{ATTR_TEXINFO}, keyword #+cindex: two-column tables, in Texinfo export #+cindex: table-type, Texinfo attribute @@ -15277,18 +15294,17 @@ This is the common text for variables foo and bar. @end table #+end_example -#+cindex: lettered lists, in Texinfo export -#+cindex: enum, Texinfo attribute -Ordered lists are numbered when exported to Texinfo format. Such -numbering obeys any counter (see [[*Plain Lists]]) in the first item of -the list. The =:enum= attribute also let you start the list at -a specific number, or switch to a lettered list, as illustrated here +The =:compact= attribute is an alternative to the =:sep= attribute, +which allows writing each entry on its own line. If this attribute is +non-nil and an item in a description list has no body but is followed +by another item, then the second item is transcoded to =@itemx=. This +example is transcoded to the same output as above. #+begin_example -#+ATTR_TEXINFO: :enum A -1. Alpha -2. Bravo -3. Charlie +,#+ATTR_TEXINFO: :table-type vtable :indic asis :compact t +- foo :: +- bar :: + This is the common text for variables foo and bar. #+end_example *** Tables in Texinfo export diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index ddd405d05..9b2c0616c 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -997,25 +997,42 @@ (defun org-texinfo-item (item contents info) CONTENTS holds the contents of the item. INFO is a plist holding contextual information." (let* ((tag (org-element-property :tag item)) - (split (org-string-nw-p - (org-export-read-attribute :attr_texinfo - (org-element-property :parent item) - :sep))) - (items (and tag - (let ((tag (org-export-data tag info))) - (if split - (split-string tag (regexp-quote split) t "[ \t\n]+") - (list tag)))))) - (format "%s\n%s" - (pcase items - (`nil "@item") - (`(,item) (concat "@item " item)) - (`(,item . ,items) - (concat "@item " item "\n" - (mapconcat (lambda (i) (concat "@itemx " i)) - items - "\n")))) - (or contents "")))) + (plain-list (org-element-property :parent item)) + (compact (and (eq (org-element-property :type plain-list) 'descriptive) + (org-not-nil (org-export-read-attribute + :attr_texinfo plain-list :compact)))) + (previous-item nil)) + (when (and compact + (org-export-get-next-element item info) + (not (org-element-contents item)) + (memq (org-element-property :post-blank previous-item) + '(1 nil))) + (org-element-put-property item :post-blank 0)) + (if (and compact + (setq previous-item (org-export-get-previous-element item info)) + (not (org-element-contents previous-item)) + (eq 0 (org-element-property :post-blank previous-item))) + (format "@itemx%s\n%s" + (if tag (concat " " (org-export-data tag info)) "") + (or contents "")) + (let* ((split (org-string-nw-p (org-export-read-attribute + :attr_texinfo plain-list :sep))) + (items (and tag + (let ((tag (org-export-data tag info))) + (if split + (split-string tag (regexp-quote split) + t "[ \t\n]+") + (list tag)))))) + (format "%s\n%s" + (pcase items + (`nil "@item") + (`(,item) (concat "@item " item)) + (`(,item . ,items) + (concat "@item " item "\n" + (mapconcat (lambda (i) (concat "@itemx " i)) + items + "\n")))) + (or contents "")))))) ;;;; Keyword -- 2.34.1