From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 6B4DHjB3+GFOtwAAgWs5BA (envelope-from ) for ; Tue, 01 Feb 2022 00:56:32 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mPCTGjB3+GE9hAEAauVa8A (envelope-from ) for ; Tue, 01 Feb 2022 00:56:32 +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 10A381097C for ; Tue, 1 Feb 2022 00:56:32 +0100 (CET) Received: from localhost ([::1]:40920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEgX9-0000Q1-06 for larch@yhetil.org; Mon, 31 Jan 2022 18:56:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEgMo-0003Mm-Nq for emacs-orgmode@gnu.org; Mon, 31 Jan 2022 18:45:54 -0500 Received: from mail.hostpark.net ([212.243.197.30]:45128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEgMl-0001yj-6W for emacs-orgmode@gnu.org; Mon, 31 Jan 2022 18:45:50 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id ACF5B164BA for ; Tue, 1 Feb 2022 00:45:42 +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=1643672740; bh=MMb/6aJtNTBsgRK cfcJuBv+1DcXA5eLBhZfP3S5efJc=; b=ywDyd4aic1LKAVfmHd0golbx5nznDPK c4dfHUT9RSK98UXvP0s39DvN9AUcGOxurWApLJxmh+6D+S64qjty9U9CO2ychvW5 9+94g39EoBG+8OIHZb6e3QbinRDzl+D1zuTtQxb/kKDMg5sbFN0VZeTzQOE4J3J7 PxPke80fnzvo= 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 PJ8mSDcN6tFd for ; Tue, 1 Feb 2022 00:45:40 +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 765CA164A6 for ; Tue, 1 Feb 2022 00:45:40 +0100 (CET) From: Jonas Bernoulli To: emacs-orgmode@gnu.org Subject: [PATCH v5 2/4] ox-texinfo: Optionally use @itemx for certain description list items Date: Tue, 1 Feb 2022 00:45:38 +0100 Message-Id: <20220131234540.762181-3-jonas@bernoul.li> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131234540.762181-1-jonas@bernoul.li> References: <20211218214038.9459-1-jonas@bernoul.li> <20220131234540.762181-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.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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=1643673392; 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=Sq4t1Qa6q4V1pbR24YZ6jWibsLmUuPZGTvBWsQzA0jM=; b=lhuVOJuVKQKHrG9x+FZOk4phje+0vKdXGMMUN4aOAnEfX36NP6IPMNqg4W+Gfe0lxOnbfg f2Av97+Mh2MiviUN5tyZDYbAH4maeS0e1pFQ/WSISmkAZ/9gCT74qp74JLyBpnLw9b7CQU p25UH8JPxDOaZW5JH6GVigaAB8r0RijVbwcNEINfau5EpBa+qrcHX6OtuKqLiWiwZ0zamp K9mdVUCEy6Hq+OeyTkYw2bR11XkYi0gJfl3zeYxmg2oh4USGAuotB8YQj6BrQTLiVrYUyP kJ3gqGf2Ax9EMycIo1SAiNtUusLPVezjAlIvX7TAH1PQWgeL2JFEiy9mrS4SMQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643673392; a=rsa-sha256; cv=none; b=NhsXBQxtDfRGeANbYLl7wL0K2vDz/DgI2A/NCUWOwDfMwXk/Sp26SKCAGN8IMESzq8rVVN /KHmHgLVNuUBIKYG1LlHC2MhYvXpW3zrNp8run0bEwsiLw6QF/M4fLnw++xF+pq/ZMVwxZ QtF4HvAytobYGbfmZGlnkkD2SgsJfUkFrykzny9R+G7i1HDvT5JByEPWC2EK4k87OqLT7U pNrlXAFYWrUGJZ/TGC+qveJxFjXjYtTZhWy9DhIV5Kql86oKjGkWx76pTpUrtVpNeGB6Dn zKaqOladHXO/EZsm/AZ7MoXGg5OeokT+J92kaClqDsYhIXxYEh/SRgbRuGhq4Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=bernoul.li header.s=sel2011a header.b=ywDyd4ai; 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=ywDyd4ai; 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: 10A381097C X-Spam-Score: -2.43 X-Migadu-Scanner: scn1.migadu.com X-TUID: t5yin1eUjT3j * 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 | 54 ++++++++++++++++++++++++++++++---------------- 2 files changed, 61 insertions(+), 29 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index bd11e05f6..4a4a048aa 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..83868a69e 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -997,25 +997,41 @@ (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)) + (eq 1 (org-element-property :post-blank item))) + (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.35.1