emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: TOC local for specified heading and its subheadings (in HTML export)?
Date: Sun, 29 Nov 2015 14:05:44 +0100	[thread overview]
Message-ID: <87two5lzvb.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87bnae2av0.fsf@gmx.us> (rasmus@gmx.us's message of "Sat, 28 Nov 2015 20:16:19 +0100")

Hello,

Rasmus <rasmus@gmx.us> writes:

> Further, IMO it might be better to extend the ’#+toc: headlines local’
> declaration.  Of course you could argue that ’local’ becomes a special
> case of the above "id:whatever-is-the-name-of-the-local-headline".
>
> Personally, I would like a more explicit syntax, though I recognize that
> it doesn’t necessarily make a difference if it’s an extension, in the
> sense of suffixing.  E.g.:
>
>         #+toc: headlines local 1 :headline "* my headline"
>         #+toc: headlines local 1 :headline "#headline"
>
> Or closer to your suggestion,
>
>        #+toc: headlines 1 :headline "#headline"
>        #+toc: headlines 1 :headline local
>
> Which as a special case can be written as,
>
>       #+toc: headlines 1 local

I agree. However, I suggest to ignore quotes:

  #+toc: headlines 1 :headline #headline

or 

  #+toc: headlines 1 :target #headline

since TOC keywords always refer to headlines.

Using quotes may also be supported for destinations containing spaces.

>> +	    (org-html-toc depth info
>> +			  (or
>> +			   (and local-id
>> +				(car (org-element-map (plist-get info :parse-tree)
>> +					 'headline
>> +				       (lambda (element)
>> +					 (and (string= (org-element-property :CUSTOM_ID element) local-id)
>> +					      element)))))
>
> Wouldn’t it better to use org-link-search and get the element at
> point?

Or even work at the parse tree level and use
`org-export-resolve-id-link' and `org-export-resolve-fuzzy-link'.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2015-11-29 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 12:02 TOC local for specified heading and its subheadings (in HTML export)? D. C. Toedt
2015-11-28  4:58 ` Sacha Chua
2015-11-28 17:37   ` Sacha Chua
2015-11-28 19:16   ` Rasmus
2015-11-29 13:05     ` Nicolas Goaziou [this message]
2015-11-30  0:46     ` Sacha Chua

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=87two5lzvb.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /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).