From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oH1BAGOfV2POrAAAbAwnHQ (envelope-from ) for ; Tue, 25 Oct 2022 10:33:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2BP3OmKfV2NgNQAAG6o9tA (envelope-from ) for ; Tue, 25 Oct 2022 10:33:38 +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 B4BE01FE84 for ; Tue, 25 Oct 2022 10:33:38 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onFLE-0003JI-CQ; Tue, 25 Oct 2022 04:31:27 -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 1onEBw-0000PV-Uw for emacs-orgmode@gnu.org; Tue, 25 Oct 2022 03:17:41 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onEBu-0000Wo-J8 for emacs-orgmode@gnu.org; Tue, 25 Oct 2022 03:17:40 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4833524002B for ; Tue, 25 Oct 2022 09:17:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1666682256; bh=RNVd2tuAIpMWDm97Ir7s8oEV3Huoxgpr84RcTktRSsI=; h=From:To:Cc:Subject:Date:From; b=K6RFil5C+qqAxShE9jFpkhxqIITDIgXVv+04TawgcSNDgWdHCjvY/iJWnBbATKQ2k r6zIfHGi0cIVg36ukzZlwcCW9kOuCT4N4cuOtd+xmCKbvgCMPKl15DIlY0T0wPGZB3 N/5gev6JcttuX5JeP7WRn7Zkt2d5iK+RdulQ584fa5xqC9YwZlFDow/N0Jb0+xU6Jl HnL/BtEJQtTaY1ROpigsigUPqwQJlf/nY2mpybsxq46SExa+eqq7NIGEfDEq1Zc1sr ng6RiOKuJoo93EgaLWmxuYPTGDLhHWHWnqXXJlT0ytjIPsP85ik8WfBoZSqXQ+6lmf +pQ0UUST4tuXQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MxNYp5xDYz6tmY; Tue, 25 Oct 2022 09:17:34 +0200 (CEST) From: Ihor Radchenko To: Feraidoon Mehri , Bastien Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] ox.el: Refactor variable org-html--id-attr-prefix, ox-html.el: Add support for the ID property to org-html--reference In-Reply-To: References: Date: Tue, 25 Oct 2022 07:18:18 +0000 Message-ID: <87ilk8tlqd.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org 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=1666686818; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=4ztdMiB2GZzOQ1dFAE6Tvw58T6MweJGEAoj0Sr3mrlo=; b=VIojREvJnGo9d7t7oqQsyYo4loHhZIOSy5squHtmLjzNX2BMwQi/vGgzAOdz4VfHtFTPRL 6m4V62Nom1KC6rbxYEcShrWJ0oHtJdL5tDIWgkIItD2AdsiEiEkiLZmgznAKs/XGVAs18j ESd1GVA0h8xI1DwrjBxBYVT6zFuoy+D/KiDg2qgYmHozWspRy7HoJINDVhewbIRJKBIw3G Xu3tCDsWynxqbK9iwutaKbOUtHu0NEMdTqd62vMWwb5hj72vYWCXQ47709pBkz5Hre474n 9YQKMgVXi/WcRAirR5k3AhIKBcx2SSwCfOdeO7WJEaHLFY1a3eRMF2UyuNEY0g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666686818; a=rsa-sha256; cv=none; b=SwumDHbgT8DnomYG5e9QW7bWRIxSd8mwI+PFSFXPAcPj6SYDeHN8bjebuad6DSR7nfuw+s 5r33P/Kkr6brgxlBPHy90rWwkEkfxyd4Nvpox3qVVf+Equ94+5BP8+S3/1pA9GuvJTIYBC BnCmGROyJQ6LPoExMBe2Vgj5IqjzcGu/RD4qtEWY4hqYF6+N+YSmDMnSzQwi8916mfzNvx zte5TFHIaqtPjs1gbAGBydwkpDO80YpdST5CD4rmYxBd1xu2zJXFslo1O17Z1h4CzHWL2G 8DQJ6NCGJqPruD0ZyTg7ryMIoFxVNd6XGl5TFi4AFH4doJy2oUil2xbFi1sycg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=K6RFil5C; dmarc=pass (policy=none) header.from=posteo.net; 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: -4.91 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=K6RFil5C; dmarc=pass (policy=none) header.from=posteo.net; 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: B4BE01FE84 X-Spam-Score: -4.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: I8Ud0jDQcR2F Feraidoon Mehri writes: > I have already signed the copyright assignment. (Though I used my > other email rudiwillalwaysloveyou@gmail.com when signing it.) Bastien, could you kindly check the FSF records? > I have manually tested the changes with a custom value for > `org-html--id-attr-prefix', and everything works. > > I did not change the behavior of `org-html-prefer-user-labels'; the ID > property will not be used if `org-html-prefer-user-labels' is nil. IMO > this behavior should be changed, and it should be always used, just > like CUSTOM_ID. Thanks for the patch! See my comments below. > * org/ox.el (org-html--id-attr-prefix): Refactor hardcoded "ID-" as a > new private variable. org-html-* variable do not belong to the general ox.el library. It should only be added to ox-html.el. > - (user-label > - (org-element-property > - (pcase type > - ((or `headline `inlinetask) :CUSTOM_ID) > - ((or `radio-target `target) :value) > - (_ :name)) > - datum))) > + (custom-id-p nil) > + (user-label > + (or > + (org-element-property > + (pcase type > + ((or `headline `inlinetask) > + (progn > + (setq custom-id-p t) > + :CUSTOM_ID)) > + ((or `radio-target `target) :value) > + (_ :name)) > + datum) > + (if-let > + ((id-property (org-element-property > + :ID > + datum))) > + (progn > + (setq custom-id-p nil) > + (concat org-html--id-attr-prefix id-property)))))) This is a bit awkward to read. Can you instead let-bind custom-id as a separate variable and leave :ID to user-label? Then, you will not need to juggle setq custom-id-p and the code will become more readable. > diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el > index 7f2e8ba47f..d2c14237ac 100644 > --- a/lisp/org/ox-odt.el > +++ b/lisp/org/ox-odt.el > @@ -1802,7 +1802,7 @@ holding contextual information." > ;; Extra targets. > (extra-targets > (let ((id (org-element-property :ID headline))) > - (if id (org-odt--target "" (concat "ID-" id)) ""))) > + (if id (org-odt--target "" (concat org-html--id-attr-prefix id)) ""))) It is surprising that org-html-* variable has anything to do with ODT export. Please define a separate constant in ox-odt. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at