From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iD4SIiMnkGAUXgAAgWs5BA (envelope-from ) for ; Mon, 03 May 2021 18:38:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id OOCwHSMnkGClFwAAB5/wlQ (envelope-from ) for ; Mon, 03 May 2021 16:38:59 +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 0D9581EDD7 for ; Mon, 3 May 2021 18:38:59 +0200 (CEST) Received: from localhost ([::1]:33728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldbb0-0004kc-45 for larch@yhetil.org; Mon, 03 May 2021 12:38:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldbXi-0002mV-09 for emacs-orgmode@gnu.org; Mon, 03 May 2021 12:35:34 -0400 Received: from mail.postale.io ([5.135.179.34]:41832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldbXf-0003Kq-Mf; Mon, 03 May 2021 12:35:33 -0400 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: [PATCH] lisp/ox-html.el: Move the space after exported section number From: Mingkai Dong In-Reply-To: <87v97zn8az.fsf@gnu.org> Date: Tue, 4 May 2021 00:35:21 +0800 Content-Transfer-Encoding: quoted-printable Message-Id: <2F46C11A-B2CD-445C-A811-CB05A043FE46@dong.mk> References: <20210503150745.72871-1-mk@dong.mk> <87v97zn8az.fsf@gnu.org> To: Bastien Received: from localhost (Unknown [127.0.0.1]) by mail.postale.io (Haraka/2.8.27) with ESMTPSA id 6FE31982-AAA3-4A73-98C9-1EF03D66EB7F.1 envelope-from (authenticated bits=0) (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256); Mon, 03 May 2021 16:35:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; bh=/Cb0+DlE39gdvbTVWsY88ns/F5QWEslXjLNfzsjcvck=; c=relaxed/simple; d=dong.mk; h=from:subject:date:message-id:to:cc:mime-version; s=s20200610414; b=W7n8iCBocjcP3voDp1P80Y9TURwqmcjyhRSVoJpGSmn84pDTO8SOs7dZrHIgecXNs7L8TEJ/9CssIjZukX7zX/973hqc1f5gj+z7EdfPnt4DPG9FI45L42k+hu9FHyAh0uyB48wP2/wEu5hGiRZIhhh4PFGEH0VKMkuJEREHDr8= Received-SPF: pass client-ip=5.135.179.34; envelope-from=mk@dong.mk; helo=mail.postale.io X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620059939; 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:dkim-signature; bh=BB7stGl7rBDpHHiOFrjher6xRkLTUtOS4u9du32SNCc=; b=etn53sSk+Epw1unRDnJ9jNn24VFiKNxsNsFADQzsB8LAAbB3xTmQGFMkmNDQQozYcmMowx PLAxWQqyBmZDpt3WYa8iJ10Z2/d3f0VFy5awL9Q69RR/kZQMzsnqv3G83YOWcGmJuNKCPf 29pxXC/E5dlCOqxSQCQRDqp728uwD+DCdCaCld9TGFn9c8y8l3kGh1KoAP3kkuYl1OatIV 4UOajbLaa/NJrxBDrwlWIF0zDR1qnoz2D19beQQcE1ftIIMwR83v3wHJnygobE4sAg7oJ9 E/VEKmlkdGYJ5B/U7DBlbY5EErkpZq9cuI7o1NfdTychtK/8PLUvWZpkdh+b2g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620059939; a=rsa-sha256; cv=none; b=JMd/VqjiG1M10CilCfPDfqDSp0p/oKUpDZmDxzZbRs7+AxVN1WcwcMwvsR/B4a02DdPaOi rKQUMGEw6GteJvlhnp3rozhWBDqS2vJdINWD297k2yzfBoouC0kRBVKdRkKKhvc3YO69Xr M8T3Y25fbZ2AsA5aD8IhIqtvwl7tEDVF5su1rAhPGgqPChPnahM3hz+41TRK2VgIgGjTOL pmLfoansjAxnG9FU5U8OyQ4kOlQB40XFoeDkSQvLmqkUhYkngeNN1r1dgKI9y70y7RYBCm rg39Fz3hZ0Q2BvTzJYUjSm48FrU+/l3o93fuvxsJwaTVBYJq7PtrkgMVn+AcCg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=dong.mk header.s=s20200610414 header.b=W7n8iCBo; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -0.56 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=dong.mk header.s=s20200610414 header.b=W7n8iCBo; dmarc=fail reason="SPF not aligned (relaxed)" header.from=dong.mk (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 0D9581EDD7 X-Spam-Score: -0.56 X-Migadu-Scanner: scn0.migadu.com X-TUID: MkJNa38Z30Gp Hi Bastien, At the end of the mail is the output of `diff old.html new.html`, most differences are caused by time and randomly generated ids. The only exception is the Table-of-Content entries, which now has two spaces before each section title. I find that the = org-html--format-toc-headline function first appends =E2=80=9C. =E2=80=9C after each section number, = and then appends the output of html-format-headline-default-function. Thus, after moving the space to the head of html-format-headline-default-function, there = are two spaces. Then the problem becomes more complicated, and it might be difficult to = solve it without changing the original behavior. I can come up with three options: 1. Stay with the two spaces in ToC, since extra spaces seldom change the appearance of rendered html. But it would cause problems when users = use custom org-html-format-headline-function. 2. Further modify the org-html--format-toc-headline function to remove the logic of appending =E2=80=9C. =E2=80=9C as below. Then the = section heading in both the text and the ToC will have the format of =E2=80=9C1 = Section-Text=E2=80=9D, without =E2=80=9C.=E2=80=9D. However, this changes the original appearance of = ToC. diff --git a/lisp/ox-html.el b/lisp/ox-html.el index f2ce71f68..a17445ca5 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2396,8 +2396,7 @@ INFO is a plist used as a communication channel." (concat (and (not (org-export-low-level-p headline info)) (org-export-numbered-headline-p headline info) - (concat (mapconcat #'number-to-string headline-number = ".") - ". ")) + (mapconcat #'number-to-string headline-number ".")) (apply (plist-get info :html-format-headline-function) todo todo-type priority text tags :section-number = nil))))) 3. Based on the second solution, further update the = org-html-format-headline-default-function to append =E2=80=9C. =E2=80=9C by default (rather than =E2=80=9C =E2=80= =9C) like below. This keeps the original ToC content unchanged, but changes the default in-text = section heading format by appending one more =E2=80=9C.=E2=80=9D after the = section number. diff --git a/lisp/ox-html.el b/lisp/ox-html.el index f2ce71f68..84da95ddb 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2396,8 +2396,7 @@ INFO is a plist used as a communication channel." (concat (and (not (org-export-low-level-p headline info)) (org-export-numbered-headline-p headline info) - (concat (mapconcat #'number-to-string headline-number = ".") - ". ")) + (mapconcat #'number-to-string headline-number ".")) (apply (plist-get info :html-format-headline-function) todo todo-type priority text tags :section-number = nil))))) @@ -2696,7 +2695,7 @@ See `org-html-format-headline-function' for = details." (let ((todo (org-html--todo todo info)) (priority (org-html--priority priority info)) (tags (org-html--tags tags info))) - (concat " " + (concat ". " todo (and todo " ") priority (and priority " ") text Both option 2 and 3 give users better control over of the section = heading format, but will alter the current behavior of html export. What do you think? - - - - Below is the diff of generated HTML - - - - 4c4 < --- > 228,231c228,231 <
  • 1. Terms
  • <
  • 2. TME
  • <
  • 3. MKTME
  • <
  • 4. Configuration --- >
  • 1. Terms
  • >
  • 2. TME
  • >
  • 3. MKTME
  • >
  • 4. Configuration 233c233 <
  • 4.1. Exclusion Range MSRs
  • --- >
  • 4.1. Exclusion Range MSRs
  • 236,237c236,237 <
  • 5. Runtime Behavior
  • <
  • 6. =E7=AE=A1=E7=90=86 KeyID --- >
  • 5. Runtime Behavior
  • >
  • 6. =E7=AE=A1=E7=90=86 KeyID 239c239 <
  • 6.1. Guidance
  • --- >
  • 6.1. Guidance
  • 254,255c254,255 <
    <

    1 = Terms

    --- >
    >

    1 = Terms

    264,265c264,265 <
    <

    2 = TME

    --- >
    >

    2 = TME

    276c276 <
    --- >
    289,290c289,290 <
    <

    3 = MKTME

    --- >
    >

    3 = MKTME

    308c308 <
    --- >
    326,327c326,327 <
    <

    4 = Configuration

    --- >
    >

    4 = Configuration

    334,335c334,335 <
    <

    4.1 = Exclusion Range MSRs

    --- >
    >

    4.1 = Exclusion Range MSRs

    356,357c356,357 <
    <

    5 = Runtime Behavior

    --- >
    >

    5 = Runtime Behavior

    364c364 <
    --- >
    390,391c390,391 <
    <

    6 =E7=AE=A1= =E7=90=86 KeyID

    --- >
    >

    6 =E7=AE=A1= =E7=90=86 KeyID

    400,401c400,401 <
    <

    6.1 = Guidance

    --- >
    >

    6.1 = Guidance

    418c418 <

    Created: 2021-05-03 Mon 23:53

    --- >

    Created: 2021-05-03 Mon 23:56

    Best, Mingkai > On May 3, 2021, at 23:31, Bastien wrote: >=20 > Hi Mingkai, >=20 > Mingkai Dong writes: >=20 >> * ox-html.el (org-html-headline, = org-html-format-headline-default-function): >> delete the space after the section number span format and add it back = in >> org-html-format-headline-default-function. >=20 > It looks good, thanks. >=20 > Can you show the exact difference by comparing the relevant HTML > portion before and after this change? >=20 > --=20 > Bastien