From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4EyhDhpWvmElBgEAgWs5BA (envelope-from ) for ; Sat, 18 Dec 2021 22:43:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id cJJrChpWvmF5OAAA1q6Kng (envelope-from ) for ; Sat, 18 Dec 2021 21:43:54 +0000 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 DDE87E2A0 for ; Sat, 18 Dec 2021 22:43:53 +0100 (CET) Received: from localhost ([::1]:39700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myhUe-0003cy-AJ for larch@yhetil.org; Sat, 18 Dec 2021 16:43:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myhRg-0003c6-1D for emacs-orgmode@gnu.org; Sat, 18 Dec 2021 16:40:51 -0500 Received: from mail.hostpark.net ([212.243.197.30]:58136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myhRc-0004My-LH for emacs-orgmode@gnu.org; Sat, 18 Dec 2021 16:40:47 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id B41ED164A6; Sat, 18 Dec 2021 22:40:40 +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=1639863638; bh=tw4DMORkZeaagWc GGwgVmcXzD+7pNYcaK0q6Jb62ByM=; b=lURl5+rl9Doz9u42m+6AvdxPbGB7MCr 70/Qfez0F8LyGQ3BMOlOtiX9UyKGImhVfCjhIBWoDqakOS4pN3xXMGt91hJjbhCL uSxSsWPToQ9nK+vVQEqOsSdju5rGZjyBr2F/z3OTsRf/4TAoN1Hp50zUEdtxxJDq zUoEP9WUOQ2I= 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 Vbteo_8jG4Dk; Sat, 18 Dec 2021 22:40:38 +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 73FBD164A8; Sat, 18 Dec 2021 22:40:38 +0100 (CET) From: Jonas Bernoulli To: emacs-orgmode@gnu.org Subject: [PATCH 1/2] ox-texinfo: Turn a description list item with "+" bullet into @itemx Date: Sat, 18 Dec 2021 22:40:37 +0100 Message-Id: <20211218214038.9459-2-jonas@bernoul.li> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211218214038.9459-1-jonas@bernoul.li> References: <87pmqhmvg1.fsf@bernoul.li> <20211218214038.9459-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 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: , Cc: kyle@kyleam.com, mail@nicolasgoaziou.fr 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=1639863833; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=1p2Ihf1En1AtcPIqDHpdNMc7yCIXpw217pb4zFt308s=; b=THKrk7Co/cKJSQvC+YqYDy5RpBWhQ2ydYMyWUosUKrZN73HSUfSMHzSMGVxSI88+TBlxT8 /WQKJOsmB+7zIWFUazAMgraGSCqPqcxmsxhBpKjRocooZiW5wE41d0Q3+XYTrX30FfsIuH vE+gyyOs5GBAOPPwI1lRtVZ0YTsV33Ugn5JXzuN66wTH61UkKbWFt1MQT+EuowSs0F9Ugw 9bbme51gnmASyVoDtq9eNbJt5eSb1bo+EsPdNuxW4h2fynbkEOJsmGX5L8iFSd0RnEHtjt b6FN4xquak0xLpb8kqj9RdFB3U/j7nNkq7WtBnpmmlF30WwIXsy00mbXO3sESQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639863833; a=rsa-sha256; cv=none; b=jVeLDc6XTq8KGYUq4YyfmCUL2rlUk832Qh8Mx0oRUKZQW0J6Bj8+9a4ryxpoRX8twLqwPi ujAKETvR6iQ99i+I/ZVy8htXscy2t9nKtG+YdYsfr9lixJfXBf2lYrEhHM97R/sAjj3B3G 9La+1WPBQufOnOYCUD37GY8ZEyR6RytZtNVFC/SCOM+tdPn72VRumfAhDEgUESZwSHP5VR YhLCKCjTWXrWGEz67t2/5CcRH3rJwg7XIKjJJLreXMtMWDHuhh50pxizPgAtwaYmXJhYDL 84cdIyiHPpeS+pAfjcB0xbAnjM/iGPWKm3rA/GgefQ5LMx5rmbascC3jCNSZHw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=bernoul.li header.s=sel2011a header.b=lURl5+rl; 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: -7.21 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=bernoul.li header.s=sel2011a header.b=lURl5+rl; 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: DDE87E2A0 X-Spam-Score: -7.21 X-Migadu-Scanner: scn0.migadu.com X-TUID: EzlIxwqZ1TmZ * doc/org-manual.org (Plain lists in Texinfo export): Reorder and document new functionality. * lisp/ox-texinfo.el (org-texinfo--filter-parse-tree) (org-texinfo--normalize-items): New functions. * lisp/ox-texinfo.el (org-texinfo-item): Use @itemx or @item depending on the used bullet. --- doc/org-manual.org | 37 ++++++++++++++++++++++++++----------- lisp/ox-texinfo.el | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 61 insertions(+), 15 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index b65e2f173..b8bb391c2 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 @@ -15262,7 +15279,7 @@ entry in the first column of the table. The following example illustrates all the attributes above: #+begin_example -,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis +,#+attr_texinfo: :table-type vtable :sep , :indic asis - foo, bar :: This is the common text for variables foo and bar. #+end_example @@ -15277,18 +15294,16 @@ 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 +In description lists the used bullet is significant when exporting to +Texinfo; when in doubt, then use =-=. An item that uses =+= instead +becomes a new entry in the first column of the table. The above +output can also be produced with: #+begin_example -#+ATTR_TEXINFO: :enum A -1. Alpha -2. Bravo -3. Charlie +,#+attr_texinfo: :table-type vtable :indic asis +- foo :: ++ bar :: + This is the common text for foo and bar. #+end_example *** Tables in Texinfo export diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index b0125894a..35862357d 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -418,6 +418,11 @@ (defun org-texinfo--filter-section-blank-lines (headline _backend _info) "Filter controlling number of blank lines after a section." (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" "\n\n" headline)) +(defun org-texinfo--filter-parse-tree (tree backend info) + "Normalize headlines and items." + (org-texinfo--normalize-headlines tree backend info) + (org-texinfo--normalize-items tree info)) + (defun org-texinfo--normalize-headlines (tree _backend info) "Normalize headlines in TREE. @@ -443,6 +448,29 @@ (defun org-texinfo--normalize-headlines (tree _backend info) info) tree) +(defun org-texinfo--normalize-items (tree info) + "Normalize items in TREE. + +INFO is a plist used as a communication channel. + +Items in description lists that use the \"+\" bullet are +converted to `@itemx'. If another item is followed by such an +item, then the first item should not be followed by a space, +which this function takes care of. + +Return new tree." + (org-element-map tree 'plain-list + (lambda (plain-list) + (when (eq (org-element-property :type plain-list) 'descriptive) + (let ((contents (org-element-contents plain-list))) + (while (setq item (pop contents)) + (let ((next-item (car contents))) + (when (and next-item + (equal (org-element-property :bullet next-item) "+ ")) + (org-element-put-property item :post-blank 0))))))) + info) + tree) + (defun org-texinfo--find-verb-separator (s) "Return a character not used in string S. This is used to choose a separator for constructs like \\verb." @@ -998,13 +1026,16 @@ (defun org-texinfo-item (item contents info) (let ((tag (org-export-data tag info))) (if split (split-string tag (regexp-quote split) t "[ \t\n]+") - (list tag)))))) + (list tag))))) + (command (if (equal (org-element-property :bullet item) "+ ") + "@itemx" + "@item"))) (format "%s\n%s" (pcase items - (`nil "@item") - (`(,item) (concat "@item " item)) + (`nil command) + (`(,item) (concat command " " item)) (`(,item . ,items) - (concat "@item " item "\n" + (concat command " " item "\n" (mapconcat (lambda (i) (concat "@itemx " i)) items "\n")))) -- 2.34.1