Org-mode mailing list
 help / color / mirror / Atom feed
* [PATCH] lisp/ox-html.el: Move the space after exported section number
@ 2021-05-03 15:07 Mingkai Dong
  2021-05-03 15:31 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Mingkai Dong @ 2021-05-03 15:07 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Mingkai Dong

* 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.

The requirement is well described in the reddit post
https://www.reddit.com/r/emacs/comments/bv8rli/org_mode_export_section_numbering/
which can be solved by setting the org-html-format-headline-function
variable to a custom function that adds the "." before the section title.
However, this results in something like "1 . Fist-Section-Title", rather
than "1. First-Section-Title", because of the extra space after the <span>
format. Moving the space to org-html-format-headline-default-function preserves
existing export behavior while allowing the users to better control the format.
---
 lisp/ox-html.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 89da823e8..f2ce71f68 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2676,7 +2676,7 @@ holding contextual information."
                           (concat
                            (and numberedp
                                 (format
-                                 "<span class=\"section-number-%d\">%s</span> "
+                                 "<span class=\"section-number-%d\">%s</span>"
                                  level
                                  (mapconcat #'number-to-string numbers ".")))
                            formatted-text)
@@ -2696,7 +2696,8 @@ 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 todo (and todo " ")
+    (concat " "
+	    todo (and todo " ")
 	    priority (and priority " ")
 	    text
 	    (and tags "&#xa0;&#xa0;&#xa0;") tags)))
-- 
2.31.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-03 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 15:07 [PATCH] lisp/ox-html.el: Move the space after exported section number Mingkai Dong
2021-05-03 15:31 ` Bastien
2021-05-03 16:35   ` Mingkai Dong
2021-05-03 17:19     ` Bastien

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git