emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: mail@nicolasgoaziou.fr, emacs-orgmode@gnu.org
Cc: alantyree@gmail.com, tsd@tsdye.com
Subject: Re: [patch, ox] Unnumbered headlines
Date: Sun, 21 Sep 2014 16:37:50 +0200	[thread overview]
Message-ID: <87k34xghtt.fsf@gmx.us> (raw)
In-Reply-To: <87fvfl86ct.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Sun, 21 Sep 2014 15:12:50 +0200")

Hi,

Thanks for the comments.  Let's give it another try, shand't we.

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> I introduce a new function `org-export-get-headline-id` which returns
>> the first non-nil from the following list.  There's a caveat:
>> CUSTOM_ID is ensured to be unique!  Did I open the famous can of worm?
>>
>> 1. The CUSTOM_ID property.
>> 2. A relative level number if the headline is numbered.
>> 3. The ID property
>> 4. A new generated unique ID.
>
> I think we should keep separated CUSTOM_ID and ID on the one hand, and
> internal reference on the other hand.
>
> There's no guarantee that CUSTOM_ID will be unique, and, even if you
> check it out, there's no guarantee either that its value can be used
> as-is in the generated docstring (think about ":CUSTOM_ID: 100%" in
> LaTeX export).
>
> CUSTOM_ID is a human readable reference to an Org headline. This
> headline should be referred to internally with a more specific id. To
> a lesser extent, I think this also applied to org-id.
>
> Also `org-export-headline-internal-id' (or some such, to avoid confusion
> with other IDs) may return a value simpler than what `org-id-new'
> returns (e.g. a dumb counter). If it is possible, the output will be
> easier to read.

Okay, I returned to my first hack (which never made it to this list).
Basically, I ID everything.  Unnumbered sections get the id
"unnumbered-sec-COUNTER" and numbered sections get the id
"sec-COUNTER".

Perhaps you will find it too much of a hack.

The other easy alternative, which I find less pleasing, would have on
incremental counter, but it makes it harder to read.

A third alternative is give the numbers like in this patch, but store
the numbers for unnumbered section somewhere else
than :headline-numbering.

>> Anyhow, `org-export-get-headline-id' ensures that we can refer to
>> unnumbered headlines, which was not possible before.
>
> This is untrue.
>
>> Of course, in LaTeX such ref to a \section* will be nonsense, so we
>> could introduce a \pageref here.
>
> At the moment, referring to an unnumbered section displays its name.

In some modes, yes.  In LaTeX it produces a \ref{·} that LaTeX will
laugh at.

If you have a better idea than using the title I'm all ears!

>> +		(when (equal 'headline (org-element-type destination))
>
> Comparing symbols with `equal' is a sin beyond redemption. Use `eq'.

Shiiit. . .

Why, out of curiosity?  I though equal was like the meaner, tougher
eq, that gets shit right, but is a bit more expensive.

>> + (format "[%s]" (org-export-data (org-export-get-alt-title
>> destination info) info)))))))))
>
> alt title is for table of contents only.

Yeah, but I though, conditional on using title for ref when nothing
better exists, it would be nicer to have something shorter.  Anyway, I
changed it to plain title now.

> Nitpick: I suggest `and' instead of `when' since there's no side-effect.

OK, I think I got 'em all. 

>> +  (unless (org-export-get-node-property :UNNUMBERED headline t)
>
> Actually, this test is fragile. In the following example
>
>   * H1
>     :PROPERTIES:
>     :UNNUMBERED: t
>     :END:
>   ** H2
>      :PROPERTIES:
>      :UNNUMBERED: nil
>      :END:
>   *** H3

Fixed.

Thanks,
Rasmus

-- 
Don't panic!!!

  reply	other threads:[~2014-09-21 14:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 13:39 [patch, ox] Unnumbered headlines Rasmus
2014-08-08 22:35 ` Alan L Tyree
2014-08-09  1:04 ` [patch, ox] Unnumbered headlines - early test Alan L Tyree
2014-08-09  7:47 ` [patch, ox] Unnumbered headlines Detlef Steuer
2014-08-11 14:18 ` Nicolas Goaziou
2014-08-11 15:37   ` Rasmus
2014-08-12  8:58     ` Nicolas Goaziou
2014-09-20 16:02       ` Rasmus
2014-09-20 20:34         ` Alan L Tyree
2014-09-21 13:12         ` Nicolas Goaziou
2014-09-21 14:37           ` Rasmus [this message]
2014-09-21 19:40             ` Nicolas Goaziou
2014-09-21 20:13               ` Rasmus
2014-09-22 15:53                 ` Nicolas Goaziou
2014-09-23  0:35                   ` Rasmus
2014-09-23  1:10                     ` Thomas S. Dye
2014-09-26  7:51                     ` Nicolas Goaziou
2014-09-26 13:48                       ` Rasmus
2014-09-27  8:19                         ` Nicolas Goaziou
2014-09-30 22:54                       ` Rasmus
2014-10-02  0:35                         ` Rasmus
2014-10-03  7:56                         ` Nicolas Goaziou
2014-10-03  8:49                           ` Sebastien Vauban
2014-10-03 10:26                           ` Rasmus
2014-10-03 20:14                             ` Nicolas Goaziou
2014-10-03 20:31                               ` Rasmus
2014-10-05  8:06                                 ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k34xghtt.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=alantyree@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=tsd@tsdye.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).