From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: [PATCH] Synchronize slideshow exporters to ox-html changes. Date: Sun, 24 Feb 2013 17:55:16 -0500 Message-ID: <20130224225515.GA51613@BigDog.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9kTa-0004Ti-Fz for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 17:55:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9kTV-0003XH-UZ for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 17:55:22 -0500 Received: from [204.62.15.78] (port=58547 helo=mail.rickster.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9kTV-0003X3-Pp for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 17:55:17 -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 50B5420011 for ; Sun, 24 Feb 2013 17:55:17 -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 This patch fixes a couple of bugs in the s5 exporter and brings both exporters in-sync w/ the updates to ox-html (uppercase properties, and HTML_CONTAINER_CLASS fix). Note that ox-deck has so many lines of change due to whitespace cleanup (won't happen again :). Rick ------------------------------- Synchronize slideshow exporters to ox-html changes. * ox-deck.el: change menu key to ?d to avoid conflict with ox-s5 (org-deck-headline): use HTML_CONTAINER_CLASS insead of html-container-class (org-html-inner-template): ditto * ox-s5.el (org-s5-headline): ditto --- contrib/lisp/ox-deck.el | 415 ++++++++++++++++++++++++------------------------ contrib/lisp/ox-s5.el | 39 +++-- 2 files changed, 227 insertions(+), 227 deletions(-) diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el index 7ae6bb9..db7818f 100644 --- a/contrib/lisp/ox-deck.el +++ b/contrib/lisp/ox-deck.el @@ -40,13 +40,13 @@ (org-export-define-derived-backend deck html :menu-entry - (?s "Export to deck.js HTML Presentation" + (?d "Export to deck.js HTML Presentation" ((?H "To temporary buffer" org-deck-export-as-html) (?h "To file" org-deck-export-to-html) (?o "To file and open" - (lambda (a s v b) - (if a (org-deck-export-to-html t s v b) - (org-open-file (org-deck-export-to-html nil s v b))))))) + (lambda (a s v b) + (if a (org-deck-export-to-html t s v b) + (org-open-file (org-deck-export-to-html nil s v b))))))) :options-alist ((:html-link-home "HTML_LINK_HOME" nil nil) (:html-link-up "HTML_LINK_UP" nil nil) @@ -60,11 +60,11 @@ (:deck-theme "DECK_THEME" nil org-deck-theme) (:deck-transition "DECK_TRANSITION" nil org-deck-transition) (:deck-include-extensions "DECK_INCLUDE_EXTENSIONS" nil - org-deck-include-extensions split) + org-deck-include-extensions split) (:deck-exclude-extensions "DECK_EXCLUDE_EXTENSIONS" nil - org-deck-exclude-extensions split) + org-deck-exclude-extensions split) (:deck-directories "DECK_DIRECTORIES" nil - org-deck-directories split)) + org-deck-directories split)) :translate-alist ((headline . org-deck-headline) (inner-template . org-deck-inner-template) @@ -86,19 +86,19 @@ modernizr; core, extensions and themes directories.)" (remove-duplicates (car (remove 'nil components)) :test (lambda (x y) - (string= (file-name-nondirectory x) - (file-name-nondirectory y))))) + (string= (file-name-nondirectory x) + (file-name-nondirectory y))))) (defun org-deck--find-extensions () "Returns a unique list of all extensions found in in the extensions directories under `org-deck-directories'" (org-deck--cleanup-components - (mapcar ; extensions under existing dirs - (lambda (dir) - (when (file-directory-p dir) (directory-files dir t "^[^.]"))) - (mapcar ; possible extension directories - (lambda (x) (expand-file-name "extensions" x)) - org-deck-directories)))) + (mapcar ; extensions under existing dirs + (lambda (dir) + (when (file-directory-p dir) (directory-files dir t "^[^.]"))) + (mapcar ; possible extension directories + (lambda (x) (expand-file-name "extensions" x)) + org-deck-directories)))) (defun org-deck--find-css (type) "Return a unique list of all the css stylesheets in the themes/TYPE @@ -107,10 +107,10 @@ directories under `org-deck-directories'." (mapcar (lambda (dir) (let ((css-dir (expand-file-name - (concat (file-name-as-directory "themes") type) dir))) - (when (file-directory-p css-dir) - (directory-files css-dir t "\\.css$")))) - org-deck-directories))) + (concat (file-name-as-directory "themes") type) dir))) + (when (file-directory-p css-dir) + (directory-files css-dir t "\\.css$")))) + org-deck-directories))) (defun org-deck-list-components () "List all available deck extensions, styles and @@ -168,7 +168,7 @@ Can be overriden with the DECK_BASE_URL property." :type 'string) (defcustom org-deck-footer-template -"

%author - %title

" + "

%author - %title

" "Format template to specify footer div. Completed using `org-fill-template'. Optional keys include %author, %email, %file, %title and %date. @@ -190,11 +190,11 @@ This is included in a
section." #title-slide h1 { position: static; padding: 0; margin-top: 10%; - -webkit-transform: none; - -moz-transform: none; - -ms-transform: none; - -o-transform: none; - transform: none; + -webkit-transform: none; + -moz-transform: none; + -ms-transform: none; + -o-transform: none; + transform: none; } #title-slide h2 { text-align: center; @@ -228,11 +228,11 @@ Note that the wrapper div must include the class \"slide\"." #table-of-contents h1 { position: static; padding: 0; margin-top: 10%; - -webkit-transform: none; - -moz-transform: none; - -ms-transform: none; - -o-transform: none; - Transform: none; + -webkit-transform: none; + -moz-transform: none; + -ms-transform: none; + -o-transform: none; + Transform: none; } #title-slide h2 { text-align: center; @@ -247,77 +247,77 @@ Note that the wrapper div must include the class \"slide\"." (defun org-deck-toc (depth info) (concat - "
\n" - (format "

%s

\n" - (org-html--translate "Table of Contents" info)) - (org-html-toc-text - (mapcar - (lambda (headline) - (let* ((class (org-element-property :html-container-class headline)) - (section-number - (when - (and (not (org-export-low-level-p headline info)) - (org-export-numbered-headline-p headline info)) - (concat - (mapconcat - 'number-to-string - (org-export-get-headline-number headline info) ".") ". "))) - (title - (concat - section-number - (replace-regexp-in-string ; remove any links in headline... - "]*>" "" - (org-export-data - (org-element-property :title headline) info))))) - (list - (if (and class (string-match-p "\\" class)) - (format - "%s" - (or (org-element-property :CUSTOM_ID headline) - (mapconcat - 'number-to-string - (org-export-get-headline-number headline info) "-")) - title) - title) - (org-export-get-relative-level headline info)))) - (org-export-collect-headlines info depth))) - "
\n" )) + "
\n" + (format "

%s

\n" + (org-html--translate "Table of Contents" info)) + (org-html-toc-text + (mapcar + (lambda (headline) + (let* ((class (org-element-property :HTML_CONTAINER_CLASS headline)) + (section-number + (when + (and (not (org-export-low-level-p headline info)) + (org-export-numbered-headline-p headline info)) + (concat + (mapconcat + 'number-to-string + (org-export-get-headline-number headline info) ".") ". "))) + (title + (concat + section-number + (replace-regexp-in-string ; remove any links in headline... + "]*>" "" + (org-export-data + (org-element-property :title headline) info))))) + (list + (if (and class (string-match-p "\\" class)) + (format + "%s" + (or (org-element-property :custom-id headline) + (mapconcat + 'number-to-string + (org-export-get-headline-number headline info) "-")) + title) + title) + (org-export-get-relative-level headline info)))) + (org-export-collect-headlines info depth))) + "
\n" )) (defun org-deck--get-packages (info) (let ((prefix (concat (plist-get info :deck-base-url) "/")) - (theme (plist-get info :deck-theme)) - (transition (plist-get info :deck-transition)) - (include (plist-get info :deck-include-extensions)) - (exclude (plist-get info :deck-exclude-extensions)) - (scripts '()) (sheets '()) (snippets '())) + (theme (plist-get info :deck-theme)) + (transition (plist-get info :deck-transition)) + (include (plist-get info :deck-include-extensions)) + (exclude (plist-get info :deck-exclude-extensions)) + (scripts '()) (sheets '()) (snippets '())) (add-to-list 'scripts (concat prefix "jquery-1.7.2.min.js")) (add-to-list 'scripts (concat prefix "core/deck.core.js")) (add-to-list 'scripts (concat prefix "modernizr.custom.js")) (add-to-list 'sheets (concat prefix "core/deck.core.css")) - (mapc - (lambda (extdir) - (let* ((name (file-name-nondirectory extdir)) - (dir (file-name-as-directory extdir)) - (path (concat prefix "extensions/" name "/")) - (base (format "deck.%s." name))) - (when (and (or (eq nil include) (member name include)) - (not (member name exclude))) - (when (file-exists-p (concat dir base "js")) - (add-to-list 'scripts (concat path base "js"))) - (when (file-exists-p (concat dir base "css")) - (add-to-list 'sheets (concat path base "css"))) - (when (file-exists-p (concat dir base "html")) - (add-to-list 'snippets (concat dir base "html")))))) - (org-deck--find-extensions)) - (add-to-list 'sheets - (if (file-name-directory theme) theme - (format "%sthemes/style/%s" prefix theme))) - (add-to-list - 'sheets - (if (file-name-directory transition) transition - (format "%sthemes/transition/%s" prefix transition))) - (list :scripts (nreverse scripts) :sheets (nreverse sheets) - :snippets snippets))) + (mapc + (lambda (extdir) + (let* ((name (file-name-nondirectory extdir)) + (dir (file-name-as-directory extdir)) + (path (concat prefix "extensions/" name "/")) + (base (format "deck.%s." name))) + (when (and (or (eq nil include) (member name include)) + (not (member name exclude))) + (when (file-exists-p (concat dir base "js")) + (add-to-list 'scripts (concat path base "js"))) + (when (file-exists-p (concat dir base "css")) + (add-to-list 'sheets (concat path base "css"))) + (when (file-exists-p (concat dir base "html")) + (add-to-list 'snippets (concat dir base "html")))))) + (org-deck--find-extensions)) + (add-to-list 'sheets + (if (file-name-directory theme) theme + (format "%sthemes/style/%s" prefix theme))) + (add-to-list + 'sheets + (if (file-name-directory transition) transition + (format "%sthemes/transition/%s" prefix transition))) + (list :scripts (nreverse scripts) :sheets (nreverse sheets) + :snippets snippets))) (defun org-html-inner-template (contents info) "Return body of document string after HTML conversion. @@ -332,12 +332,13 @@ holding export options." "\n")) (defun org-deck-headline (headline contents info) - (let ((org-html-toplevel-hlevel 2)) - (org-html-headline - (if (= 1 (+ (org-element-property :level headline) - (plist-get info :headline-offset))) - (org-element-put-property headline :html-container-class "slide") - headline) contents info))) + (let ((org-html-toplevel-hlevel 2) + (class (or (org-element-property :HTML_CONTAINER_CLASS headline) "")) + (level (+ (org-element-property :level headline) + (plist-get info :headline-offset)))) + (when (and (= 1 level) (not (string-match-p "\\" class))) + (org-element-put-property headline :HTML_CONTAINER_CLASS (concat class " slide"))) + (org-html-headline headline contents info))) (defun org-deck-item (item contents info) "Transcode an ITEM element from Org to HTML. @@ -347,8 +348,8 @@ If the containing headline has the property :slide, then the \"slide\" class will be added to the to the list element, which will make the list into a \"build\"." (let ((text (org-html-item item contents info))) - (if (org-export-get-node-property :step item t) - (replace-regexp-in-string "^
  • " "
  • " text) + (if (org-export-get-node-property :STEP item t) + (replace-regexp-in-string "^
  • " "
  • " text) text))) (defun org-deck-template-alist (info) @@ -364,104 +365,104 @@ the \"slide\" class will be added to the to the list element, CONTENTS is the transcoded contents string. INFO is a plist holding export options." (let ((pkg-info (org-deck--get-packages info))) - (mapconcat - 'identity - (list - "" - (let ((lang (plist-get info :language))) - (mapconcat - (lambda (x) - (apply - 'format - "" - x)) - (list `("[if lt IE 7]>" "ie6" ,lang "") - `("[if IE 7]>" "ie7" ,lang "") - `("[if IE 8]>" "ie8" ,lang "") - `("[if gt IE 8]>" "" ,lang "" + x)) + (list `("[if lt IE 7]>" "ie6" ,lang "") + `("[if IE 7]>" "ie7" ,lang "") + `("[if IE 8]>" "ie8" ,lang "") + `("[if gt IE 8]>" "" ,lang "