From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: [PATCH] Update to slideshows for changed ox-html functions Date: Tue, 26 Feb 2013 17:56:45 -0500 Message-ID: <20130226225644.GA60979@BigDog.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:36520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UATS6-0005vU-Rl for emacs-orgmode@gnu.org; Tue, 26 Feb 2013 17:56:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UATS3-0008Jr-Rq for emacs-orgmode@gnu.org; Tue, 26 Feb 2013 17:56:50 -0500 Received: from [204.62.15.78] (port=37514 helo=mail.rickster.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UATS3-0008JR-OP for emacs-orgmode@gnu.org; Tue, 26 Feb 2013 17:56:47 -0500 Received: from BigDog.local (pool-72-89-40-63.nycmny.fios.verizon.net [72.89.40.63]) by mail.rickster.com (Postfix) with ESMTPS id E14E0212F0 for ; Tue, 26 Feb 2013 17:56:47 -0500 (EST) Content-Disposition: inline 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: emacs-orgmode@gnu.org --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Attached is a patch to fix a couple of bugs which slipped by during the re-integration. Also, a fix for the renamed functions in ox-html. rick --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Slideshow-bugfixes-and-sync-with-ox-html-function-na.patch" >From daf83f8743cf512185e8ba2168571759bf51eac4 Mon Sep 17 00:00:00 2001 From: Rick Frankel Date: Tue, 26 Feb 2013 14:26:27 -0500 Subject: [PATCH] Slideshow bugfixes and sync with ox-html function name changes. * contrib/lisp/ox-deck.el: Default org-deck-directories to "./deck.js". (org-deck-toc): Sync w/ ox-html name change (org-html--toc-text.) (org-deck-inner-template): Remove duplicate toc generation code. * contrib/lisp/ox-s5.el: Add inner template to fix duplicate content div error. (org-s5-toc): Sync w/ ox-html name change (org-html--toc-text) and make toc entries static since s5 doesn't support deep linking. --- contrib/lisp/ox-deck.el | 21 +++++++-------------- contrib/lisp/ox-s5.el | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el index a5327e9..5d25369 100644 --- a/contrib/lisp/ox-deck.el +++ b/contrib/lisp/ox-deck.el @@ -37,6 +37,7 @@ ;; works (it is derived from ox-html.) (require 'ox-html) +(eval-when-compile (require 'cl)) (org-export-define-derived-backend deck html :menu-entry @@ -62,9 +63,7 @@ (:deck-include-extensions "DECK_INCLUDE_EXTENSIONS" nil org-deck-include-extensions split) (:deck-exclude-extensions "DECK_EXCLUDE_EXTENSIONS" nil - org-deck-exclude-extensions split) - (:deck-directories "DECK_DIRECTORIES" nil - org-deck-directories split)) + org-deck-exclude-extensions split)) :translate-alist ((headline . org-deck-headline) (inner-template . org-deck-inner-template) @@ -76,7 +75,7 @@ :tag "Org Export DECK" :group 'org-export-html) -(defcustom org-deck-directories nil +(defcustom org-deck-directories '("./deck.js") "Directories to search for deck.js components (jquery, modernizr; core, extensions and themes directories.)" :group 'org-export-deck @@ -250,7 +249,7 @@ Note that the wrapper div must include the class \"slide\"." "
\n" (format "

%s

\n" (org-html--translate "Table of Contents" info)) - (org-html-toc-text + (org-html--toc-text (mapcar (lambda (headline) (let* ((class (org-element-property :HTML_CONTAINER_CLASS headline)) @@ -269,7 +268,7 @@ Note that the wrapper div must include the class \"slide\"." "]*>" "" (org-export-data (org-element-property :title headline) info))))) - (list + (cons (if (and class (string-match-p "\\" class)) (format "%s" @@ -319,17 +318,11 @@ Note that the wrapper div must include the class \"slide\"." (list :scripts (nreverse scripts) :sheets (nreverse sheets) :snippets snippets))) -(defun org-html-inner-template (contents info) +(defun org-deck-inner-template (contents info) "Return body of document string after HTML conversion. CONTENTS is the transcoded contents string. INFO is a plist holding export options." - (concat - ;; Table of contents. - (let ((depth (plist-get info :with-toc))) - (when depth (org-deck-toc depth info))) - ;; Document contents. - contents - "\n")) + (concat contents "\n")) (defun org-deck-headline (headline contents info) (let ((org-html-toplevel-hlevel 2) diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el index 9b140c5..1e76324 100644 --- a/contrib/lisp/ox-s5.el +++ b/contrib/lisp/ox-s5.el @@ -74,6 +74,7 @@ :translate-alist ((headline . org-s5-headline) (plain-list . org-s5-plain-list) + (inner-template . org-s5-inner-template) (template . org-s5-template))) (defgroup org-export-s5 nil @@ -150,20 +151,37 @@ Note that the wrapper div must include the class \"slide\"." :type 'string) +(defun org-s5--format-toc-headline (headline info) + "Return an appropriate table of contents entry for HEADLINE. +Note that (currently) the S5 exporter does not support deep links, +so the table of contents is not \"active\". +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 ".") ". "))) + (tags (and (eq (plist-get info :with-tags) t) + (org-export-get-tags headline info)))) + (concat section-number + (org-export-data + (org-export-get-optional-title headline info) info) + (and tags "   ") (org-html--tags tags)))) + (defun org-s5-toc (depth info) (let* ((headlines (org-export-collect-headlines info depth)) (toc-entries - (loop for headline in headlines collect - (list (org-html-format-headline--wrap - headline info 'org-html-format-toc-headline) - (org-export-get-relative-level headline info))))) + (mapcar (lambda (headline) + (cons (org-s5--format-toc-headline headline info) + (org-export-get-relative-level headline info))) + (org-export-collect-headlines info depth)))) (when toc-entries (concat "
\n" (format "

%s

\n" (org-html--translate "Table of Contents" info)) "
" - (org-html-toc-text toc-entries) + (org-html--toc-text toc-entries) "
\n" "
\n")))) @@ -240,6 +258,12 @@ which will make the list into a \"build\"." ("date" . ,(nth 0 (plist-get info :date))) ("file" . ,(plist-get info :input-file)))) +(defun org-s5-inner-template (contents info) + "Return body of document string after HTML conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (concat contents "\n")) + (defun org-s5-template (contents info) "Return complete document string after HTML conversion. CONTENTS is the transcoded contents string. INFO is a plist @@ -270,6 +294,7 @@ holding export options." ;; title page (org-fill-template org-s5-title-page-template (org-s5-template-alist info)) + ;; table of contents. (let ((depth (plist-get info :with-toc))) (when depth (org-s5-toc depth info))) contents -- 1.8.0 --oyUTqETQ0mS9luUI--