emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to capture export prepended header numbering
@ 2019-12-30 16:34 Lawrence Bottorff
  2019-12-31  0:31 ` Adam Porter
  0 siblings, 1 reply; 5+ messages in thread
From: Lawrence Bottorff @ 2019-12-30 16:34 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

Basically, I'd like to know what level each heading of an org file is and
in what order they appear. So if my org file looks like this

* heading a
** sub-heading a.1
** sub-heading a.2
*** sub-sub-heading a.2.1
* heading b
** sub-heading b.1
*** sub-sub-heading b.1.1
* heading c

And an HTML export creates this

1 heading a
1.1 sub-heading a.1
1.2 sub-heading a.2
1.2.1 sub-sub-heading a.2.1
2 heading b
2.1 sub-heading b.1
2.1.1 sub-sub-heading b.1.1
3 heading c

is there a way to capture that prepended export numbering? Actually, I'd
like to capture every heading's rank and order and keep it in a PROPERTIES
drawer. There's obviously some baked in mechanism doing this for exporting.
Is it possible for a mere mortal to know, have?

LB

[-- Attachment #2: Type: text/html, Size: 1016 bytes --]

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

* Re: How to capture export prepended header numbering
  2019-12-30 16:34 How to capture export prepended header numbering Lawrence Bottorff
@ 2019-12-31  0:31 ` Adam Porter
  2019-12-31  0:43   ` Adam Porter
  2019-12-31  4:21   ` Adam Porter
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Porter @ 2019-12-31  0:31 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is no built-in way to do that, and no way independent of
org-export to get the numbers, AFAIK.

Here's some ugly old code that shows outline numbering as overlays in an
Org buffer.  It doesn't update automatically, so you have to run it
again when the outline changes.  But it seems to work well.  It uses
dash.el and let-alist, in case you don't have them loaded.

[-- Attachment #2: ap/org-outline-numbers --]
[-- Type: application/emacs-lisp, Size: 3956 bytes --]

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

* Re: How to capture export prepended header numbering
  2019-12-31  0:31 ` Adam Porter
@ 2019-12-31  0:43   ` Adam Porter
  2019-12-31  4:21   ` Adam Porter
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Porter @ 2019-12-31  0:43 UTC (permalink / raw)
  To: emacs-orgmode

FYI, I tidied the code a tiny bit and posted it here:

https://github.com/alphapapa/unpackaged.el#outline-number-overlays

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

* Re: How to capture export prepended header numbering
  2019-12-31  0:31 ` Adam Porter
  2019-12-31  0:43   ` Adam Porter
@ 2019-12-31  4:21   ` Adam Porter
  2019-12-31  4:45     ` Adam Porter
  1 sibling, 1 reply; 5+ messages in thread
From: Adam Porter @ 2019-12-31  4:21 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

Adam Porter <adam@alphapapa.net> writes:

> There is no built-in way to do that, and no way independent of
> org-export to get the numbers, AFAIK.
>
> Here's some ugly old code that shows outline numbering as overlays in an
> Org buffer.  It doesn't update automatically, so you have to run it
> again when the outline changes.  But it seems to work well.  It uses
> dash.el and let-alist, in case you don't have them loaded.

Please do disregard that monstrosity.  I rewrote it in a much simpler
way.  It seems fast on a reasonably large Org buffer.  It doesn't
account for org-indent-mode or org-bullets, but that wouldn't be too
hard to fix, I think.

No third-party packages are required.  See attached file, or
<https://github.com/alphapapa/unpackaged.el#outline-number-overlays>.


[-- Attachment #2: org-outline-numbers rewritten --]
[-- Type: application/emacs-lisp, Size: 1562 bytes --]

[-- Attachment #3: screenshot --]
[-- Type: image/png, Size: 25031 bytes --]

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

* Re: How to capture export prepended header numbering
  2019-12-31  4:21   ` Adam Porter
@ 2019-12-31  4:45     ` Adam Porter
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Porter @ 2019-12-31  4:45 UTC (permalink / raw)
  To: emacs-orgmode

Someone reminded me that Org has org-num-mode now, so please disregard
all of that.  At least it was good exercise.

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

end of thread, other threads:[~2019-12-31  4:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 16:34 How to capture export prepended header numbering Lawrence Bottorff
2019-12-31  0:31 ` Adam Porter
2019-12-31  0:43   ` Adam Porter
2019-12-31  4:21   ` Adam Porter
2019-12-31  4:45     ` Adam Porter

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).