>From 0c61d7d582dcec74a5fc6823ae5cffbddab8e930 Mon Sep 17 00:00:00 2001 From: Rick Frankel Date: Mon, 25 Feb 2013 12:55:32 -0500 Subject: [PATCH 1/2] Update contributed slide output to use uppercase properties. * contrib/lisp/ox-deck.el: Change menu key to ?d to avoid conflict with ox-s5. (org-deck-toc): Use HTML_CONTAINER_CLASS instead of html-container-class. (org-deck-headline): Simplify code to use HTML_CONTAINER_CLASS directly, and use org-element-get-relative-level. (org-deck-item): Use uppercase property. * contrib/lisp/ox-s5.el (s5): Add configuration variables for S5 meta data. (org-s5--build-meta-info): ditto. (org-s5-headline): Simplify code to use HTML_CONTAINER_CLASS directly, and use org-element-get-relative-level. (org-s5-plain-list): Use uppercase property. (org-s5-template-alist): Fix bug. (Don't try and substring nil.) --- contrib/lisp/ox-deck.el | 20 ++++++++++---------- contrib/lisp/ox-s5.el | 38 ++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el index 7ae6bb9..203ca8c 100644 --- a/contrib/lisp/ox-deck.el +++ b/contrib/lisp/ox-deck.el @@ -40,7 +40,7 @@ (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" @@ -253,7 +253,7 @@ Note that the wrapper div must include the class \"slide\"." (org-html-toc-text (mapcar (lambda (headline) - (let* ((class (org-element-property :html-container-class headline)) + (let* ((class (org-element-property :HTML_CONTAINER_CLASS headline)) (section-number (when (and (not (org-export-low-level-p headline info)) @@ -332,12 +332,12 @@ 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-export-get-relative-level headline info))) + (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 +347,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) diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el index 39f41ef..9b140c5 100644 --- a/contrib/lisp/ox-s5.el +++ b/contrib/lisp/ox-s5.el @@ -37,7 +37,7 @@ ;; Follow the general instructions at the above website. To generate ;; incremental builds, you can set the HTML_CONTAINER_CLASS on an ;; object to "incremental" to make it build. If you want an outline to -;; build, set the` INCREMENTAL property on the parent headline. +;; build, set the :INCREMENTAL property on the parent headline. ;; To test it, run: ;; @@ -68,7 +68,9 @@ (:html-style-include-scripts "HTML_INCLUDE_SCRIPTS" nil nil) (:s5-version "S5_VERSION" nil org-s5-version) (:s5-theme-file "S5_THEME_FILE" nil org-s5-theme-file) - (:s5-ui-url "S5_UI_URL" nil org-s5-ui-url)) + (:s5-ui-url "S5_UI_URL" nil org-s5-ui-url) + (:s5-default-view "S5_DEFAULT_VIEW" nil org-s5-default-view) + (:s5-control-visibility "S5_CONTROL_VISIBILITY" nil org-s5-control-visibility)) :translate-alist ((headline . org-s5-headline) (plain-list . org-s5-plain-list) @@ -196,30 +198,26 @@ Note that the wrapper div must include the class \"slide\"." (defun org-s5--build-meta-info (info) (concat (org-html--build-meta-info info) - (format "" + (format "\n" (plist-get info :s5-version)) - "\n" - "")) + (format "\n" + (plist-get info :s5-default-view)) + (format "" + (plist-get info :s5-control-visibility)))) (defun org-s5-headline (headline contents info) - (let ((org-html-toplevel-hlevel 1)) - (org-html-headline - (if (= 1 (+ (org-element-property :level headline) - (plist-get info :headline-offset))) - (org-element-put-property - headline :html-container-class - (mapconcat 'identity - (list - (org-element-property - :html-container-class headline) - "slide") " ")) - headline) contents info))) + (let ((org-html-toplevel-hlevel 1) + (class (or (org-element-property :HTML_CONTAINER_CLASS headline) "")) + (level (org-export-get-relative-level headline info))) + (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-s5-plain-list (plain-list contents info) "Transcode a PLAIN-LIST element from Org to HTML. CONTENTS is the contents of the list. INFO is a plist holding contextual information. -If a containing headline has the property :incremental, +If a containing headline has the property :INCREMENTAL, then the \"incremental\" class will be added to the to the list, which will make the list into a \"build\"." (let* ((type (org-element-property :type plain-list)) @@ -230,7 +228,7 @@ which will make the list into a \"build\"." (format "%s\n%s%s" (format "<%s class='org-%s%s'>" tag tag - (if (org-export-get-node-property :incremental plain-list t) + (if (org-export-get-node-property :INCREMENTAL plain-list t) " incremental" "")) contents (org-html-end-plain-list type)))) @@ -239,7 +237,7 @@ which will make the list into a \"build\"." ("title" . ,(car (plist-get info :title))) ("author" . ,(car (plist-get info :author))) ("email" . ,(plist-get info :email)) - ("date" . ,(substring (nth 0 (plist-get info :date)) 0 10)) + ("date" . ,(nth 0 (plist-get info :date))) ("file" . ,(plist-get info :input-file)))) (defun org-s5-template (contents info) -- 1.8.1.2