From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [BUG] New exporter exports TOC twice Date: Thu, 2 May 2013 05:22:17 +0200 Message-ID: <6A0787CB-28B9-4B2C-BFDB-183DEA34D28B@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> <87r4hqic9s.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXk5r-0003ZQ-KI for emacs-orgmode@gnu.org; Wed, 01 May 2013 23:22:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXk5q-0001uV-JD for emacs-orgmode@gnu.org; Wed, 01 May 2013 23:22:03 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:36648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXk5q-0001uQ-C9 for emacs-orgmode@gnu.org; Wed, 01 May 2013 23:22:02 -0400 Received: by mail-wi0-f170.google.com with SMTP id hq12so134947wib.5 for ; Wed, 01 May 2013 20:22:01 -0700 (PDT) In-Reply-To: <87r4hqic9s.fsf@gmail.com> 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: Nicolas Goaziou Cc: Sebastien Vauban , emacs-orgmode@gnu.org Hi Nicolas, On 2.5.2013, at 00:08, Nicolas Goaziou wrote: > 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. OK. > >>> 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. This is clear enough. I have pushed a fix to the manual which should make this clearer. Regards - Carsten