From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] New exporter exports TOC twice Date: Thu, 02 May 2013 00:08:31 +0200 Message-ID: <87r4hqic9s.fsf@gmail.com> References: <87k3ns89lk.fsf@gmail.com> <87bo949mgg.fsf@gmail.com> <717E4F0F-A573-4529-8BAD-0911E7BDDAC9@gmail.com> <86mwskxsmk.fsf@somewhere.org> <871u9vktbf.fsf@gmail.com> <5CD564EE-729C-4C08-A1AC-572025EEFC7A@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXfCX-00084g-A6 for emacs-orgmode@gnu.org; Wed, 01 May 2013 18:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXfCW-0003Aj-EQ for emacs-orgmode@gnu.org; Wed, 01 May 2013 18:08:37 -0400 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:64233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXfCW-0003AT-7W for emacs-orgmode@gnu.org; Wed, 01 May 2013 18:08:36 -0400 Received: by mail-wg0-f41.google.com with SMTP id b12so20044wgh.0 for ; Wed, 01 May 2013 15:08:35 -0700 (PDT) In-Reply-To: <5CD564EE-729C-4C08-A1AC-572025EEFC7A@gmail.com> (Carsten Dominik's message of "Wed, 1 May 2013 22:45:43 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: Sebastien Vauban , emacs-orgmode@gnu.org Hello, Carsten Dominik writes: >> The problem is that #+TOC cannot be a strict equivalent to >> `org-export-with-toc', since the former cannot be introduced in the >> document template. > > I am not sure I understand. What do you mean? A TOC keyword belongs to the contents of the document. On the other hand, :with-toc is handled in a "template" function, which has access to both the contents and the meta-data around it. Therefore, :with-toc can insert a table of contents in more places than TOC. For example, in latex back-end, TOC cannot insert a \tableofcontents before \begin{document}, but toc:t can. Of course, this example doesn't make sense as per LaTeX syntax, but it is possible that some other back-end wants to allow this. >> Also, this change would require each user back-end developer to check >> for the presence of a TOC keyword with "headlines" value in the parse >> tree when handling :with-toc property. This is not complicated, but >> there are already many uncomplicated issues to think about when writing >> a back-end. > > An alternative would be that the parser already makes this change. Upon > finding #+TOC, it would change the OPTION value in the parse tree. The parser doesn't handle the OPTION keyword (it's just another keyword), and neither should it (export options mustn't influence how the parsing is done). It belongs to the export framework to read export options and handle them. Upon reading the with-toc value, it is indeed possible to check for the presence of a TOC keyword in the parse tree. However, in this case, I don't see the need to go out of our way just to interpret differently what the user specified. Getting two tables of contents is not surprising when you understand that "toc:t" and "#+TOC: headlines" are independent ways of requesting a table of contents. Regards, -- Nicolas Goaziou