From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GPgiHXVsUWNTiAAAbAwnHQ (envelope-from ) for ; Thu, 20 Oct 2022 17:42:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id uCsdHXVsUWMN3AAA9RJhRA (envelope-from ) for ; Thu, 20 Oct 2022 17:42:45 +0200 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 0DE7B2B15F for ; Thu, 20 Oct 2022 17:42:45 +0200 (CEST) Received: from localhost ([::1]:54812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olXgx-0005cp-RF for larch@yhetil.org; Thu, 20 Oct 2022 11:42:43 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olXes-0000KP-Fk for larch@yhetil.org; Thu, 20 Oct 2022 11:40:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olWKj-0002dv-M2 for emacs-orgmode@gnu.org; Thu, 20 Oct 2022 10:15:44 -0400 Received: from mail.choca.pics ([2001:910:1410:500::1]:37054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olWKg-0000F4-0r for emacs-orgmode@gnu.org; Thu, 20 Oct 2022 10:15:41 -0400 Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 370AB181942B3; Thu, 20 Oct 2022 16:15:33 +0200 (CEST) Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id xypi1jl0Ot7Q; Thu, 20 Oct 2022 16:15:32 +0200 (CEST) Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 8E7F9181942B4; Thu, 20 Oct 2022 16:15:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at choca.pics Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id 8zYArO5CMNIq; Thu, 20 Oct 2022 16:15:32 +0200 (CEST) Received: from localhost (153.226.95.79.rev.sfr.net [79.95.226.153]) by mail.choca.pics (Postfix) with ESMTPSA id 3BC63181942B3; Thu, 20 Oct 2022 16:15:32 +0200 (CEST) From: Damien Cassou To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: Weird behavior of org-element-object-lex In-Reply-To: <877d0ud338.fsf@cassou.me> References: <87fsfjd3ds.fsf@cassou.me> <87v8of83oy.fsf@localhost> <87czanc9vl.fsf@cassou.me> <87r0z27r8c.fsf@localhost> <877d0ud338.fsf@cassou.me> Date: Thu, 20 Oct 2022 16:15:23 +0200 Message-ID: <874jvyd1j8.fsf@cassou.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2001:910:1410:500::1; envelope-from=damien@cassou.me; helo=mail.choca.pics X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-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=1666280565; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=YTEGW2pIG0J6t3I5MLE5tzJaWq97t9VEuGib1NTxa9Q=; b=GOjTdoac+vms0S2lNNPbhmEg/omKoZJ0AC+8Xnx5vyW3d/RfByCqvMYWv8NBUCJlcKjb7D K/gen/ntDUU2jr2Dsvvx6OtLVGTj4THwUCaCmvYKLghLSaHRbvP/uxXBdxUlcyTLBwzVgW zk30E64pjNPKri6KzGiEbpEKEjMOg1jXyuXIwEYfJQX1jLS4dT+hej+f7UJKlSaaDCqa4f SQ6EpUcPRmi+I+sxzxEuVid1/0KRSXsRAHO/9MvsW2YHirscfXxZ9S+UnXVkv0j/oJwkap UGCKe8KmwRfeqP6Q4IZYkkt8Vd2UanEEOPXlcFMA3VqOg48LaKNw8CAIdUlPXw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666280565; a=rsa-sha256; cv=none; b=KLZbmDiB1tNYa5RfRfoL/Fw3U6mss9oRDdtlbHpWktBJdL5qrBztF7Zvg0OpRcX/0Cb1LD VFGfmKFMdhJ9Zn5UAouZuKEtWKZdyMqnDnHp3IOjrX59y+b9GqJBMCnKVCmLOFcn2TvOV2 +JXWA4tD9lyrB2yz+ekUeZms70ZfWI1txdgttQwVtjCBPj7FH+rTTlzQS1y8UWC2cxUq1f 5SY6w/6DV/l2vrpj3KR/lrdsQ75YCx6xunofN6CUdBJG0UpaC80pid3MsTBTRVOlziFvyP r8Z6c+DBfwrB6zuvM7EbCmTPC/xqFdpO3Ads1d5IHqWuXbCXwoDsQMqI+Ij/JA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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: -3.03 Authentication-Results: aspmx1.migadu.com; dkim=none; 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: 0DE7B2B15F X-Spam-Score: -3.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: JZotU7Rh25hH Damien Cassou writes: > Ihor Radchenko writes: >> Damien Cassou writes: >>> (defun ox-linuxmag--item (item contents info) >>> ... >>> The reason `ox-linuxmag--item` has to parse ITEM again is because >>> CONTENTS contains "item 1=C2=A0;" >>> which misses the initial dash "-" character: i.e., I would like "- item >>> 1=C2=A0;" in the paragraph instead. After a quick chat with yantar92 on IRC, I understood that the easiest solution is to fix the paragraph transcoder to inject the "- " when its parent is an item. The item transcoder can just return CONTENTS. Here is the corresponding code: (defun ox-linuxmag--paragraph (paragraph contents info) "Transcode a PARAGRAPH element from Org to ODT. CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." (let* ((parent (org-export-get-parent paragraph)) (parent-type (org-element-type parent)) (prefix (when (eq parent-type 'item) "- "))) (org-odt--format-paragraph paragraph (concat prefix contents) info (or (org-element-property :style paragraph) "Normal") "" ""))))) Thank you so much for your help. --=20 Damien Cassou "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill