From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Show TODO item in table of contents Date: Wed, 06 Nov 2013 15:29:28 +0100 Message-ID: <87ppqdbo3b.fsf@gmail.com> References: <871u2v6do5.fsf@bzg.ath.cx> <5278A717.3000805@online.de> <87eh6uu7un.fsf@bzg.ath.cx> <527A013D.8000105@online.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve46g-0007Fd-82 for emacs-orgmode@gnu.org; Wed, 06 Nov 2013 09:29:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve46Z-0005du-77 for emacs-orgmode@gnu.org; Wed, 06 Nov 2013 09:29:18 -0500 In-Reply-To: <527A013D.8000105@online.de> (Rainer Stengele's message of "Wed, 06 Nov 2013 09:43:41 +0100") 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: Rainer Stengele Cc: Bastien , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello, Rainer Stengele writes: > In html export include todo state words in table of contents. Would the following patch do the job? Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ox-html-Add-TODO-keyword-to-TOC-entries.patch >From 7b85dbbc22e73766ac92295d2b37ae692b20d289 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 6 Nov 2013 15:26:53 +0100 Subject: [PATCH] ox-html: Add TODO keyword to TOC entries * lisp/ox-html.el (org-html--format-toc-headline): TOC entries are closer to regular headline formatting. --- lisp/ox-html.el | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index afc2437..84a3f45 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1969,34 +1969,42 @@ and value is its relative level, as an integer." (defun org-html--format-toc-headline (headline info) "Return an appropriate table of contents entry for HEADLINE. INFO is a plist used as a communication channel." - (let* ((headline-number (org-export-get-headline-number headline info)) - (section-number - (and (not (org-export-low-level-p headline info)) - (org-export-numbered-headline-p headline info) - (concat (mapconcat 'number-to-string headline-number ".") ". "))) + (let* ((level (+ (org-export-get-relative-level headline info) + (1- org-html-toplevel-hlevel))) + (todo (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property :todo-keyword headline))) + (and todo (org-export-data todo info))))) + (todo-type (and todo (org-element-property :todo-type headline))) + (priority (and (plist-get info :with-priority) + (org-element-property :priority headline))) + (text (org-export-data-with-backend + (org-export-get-alt-title headline info) + ;; Create an anonymous back-end that will ignore any + ;; footnote-reference, link, radio-target and target + ;; in table of contents. + (org-export-create-backend + :parent 'html + :transcoders '((footnote-reference . ignore) + (link . (lambda (object c i) c)) + (radio-target . (lambda (object c i) c)) + (target . ignore))) + info)) (tags (and (eq (plist-get info :with-tags) t) (org-export-get-tags headline info)))) (format "%s" - ;; Label. (org-export-solidify-link-text (or (org-element-property :CUSTOM_ID headline) - (concat "sec-" (mapconcat 'number-to-string - headline-number "-")))) - ;; Body. - (concat section-number - (org-export-data-with-backend - (org-export-get-alt-title headline info) - ;; Create an anonymous back-end that will ignore - ;; any footnote-reference, link, radio-target and - ;; target in table of contents. - (org-export-create-backend - :parent 'html - :transcoders '((footnote-reference . ignore) - (link . (lambda (object c i) c)) - (radio-target . (lambda (object c i) c)) - (target . ignore))) - info) - (and tags "   ") (org-html--tags tags))))) + (concat "sec-" + (mapconcat + #'number-to-string + (org-export-get-headline-number headline info) + "-")))) + (apply (if (functionp org-html-format-headline-function) + (lambda (todo todo-type priority text tags &rest ignore) + (funcall org-html-format-headline-function + todo todo-type priority text tags)) + #'org-html-format-headline) + todo todo-type priority text tags :section-number nil)))) (defun org-html-list-of-listings (info) "Build a list of listings. -- 1.8.4.2 --=-=-=--