Browse Source

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.)
Rick Frankel 12 years ago
parent
commit
2e04ffe413
2 changed files with 28 additions and 30 deletions
  1. 10 10
      contrib/lisp/ox-deck.el
  2. 18 20
      contrib/lisp/ox-s5.el

+ 10 - 10
contrib/lisp/ox-deck.el

@@ -40,7 +40,7 @@
 
 
 (org-export-define-derived-backend deck html
 (org-export-define-derived-backend deck html
   :menu-entry
   :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 temporary buffer" org-deck-export-as-html)
        (?h "To file" org-deck-export-to-html)
        (?h "To file" org-deck-export-to-html)
        (?o "To file and open"
        (?o "To file and open"
@@ -253,7 +253,7 @@ Note that the wrapper div must include the class \"slide\"."
     (org-html-toc-text
     (org-html-toc-text
      (mapcar
      (mapcar
       (lambda (headline)
       (lambda (headline)
-	(let* ((class (org-element-property :html-container-class headline))
+	(let* ((class (org-element-property :HTML_CONTAINER_CLASS headline))
 	       (section-number
 	       (section-number
 		(when
 		(when
 		    (and (not (org-export-low-level-p headline info))
 		    (and (not (org-export-low-level-p headline info))
@@ -332,12 +332,12 @@ holding export options."
    "\n"))
    "\n"))
 
 
 (defun org-deck-headline (headline contents info)
 (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 "\\<slide\\>" 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)
 (defun org-deck-item (item contents info)
   "Transcode an ITEM element from Org to HTML.
   "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,
 the \"slide\" class will be added to the to the list element,
  which will make the list into a \"build\"."
  which will make the list into a \"build\"."
   (let ((text (org-html-item item contents info)))
   (let ((text (org-html-item item contents info)))
-    (if (org-export-get-node-property :step item t)
-	(replace-regexp-in-string "^<li>" "<li class='slide'>" text)
+    (if (org-export-get-node-property :STEP item t)
+        (replace-regexp-in-string "^<li>" "<li class='slide'>" text)
       text)))
       text)))
 
 
 (defun org-deck-template-alist (info)
 (defun org-deck-template-alist (info)

+ 18 - 20
contrib/lisp/ox-s5.el

@@ -37,7 +37,7 @@
 ;; Follow the general instructions at the above website. To generate
 ;; Follow the general instructions at the above website. To generate
 ;; incremental builds, you can set the HTML_CONTAINER_CLASS on an
 ;; incremental builds, you can set the HTML_CONTAINER_CLASS on an
 ;; object to "incremental" to make it build. If you want an outline to
 ;; 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:
 ;; To test it, run:
 ;;
 ;;
@@ -68,7 +68,9 @@
    (:html-style-include-scripts "HTML_INCLUDE_SCRIPTS" nil nil)
    (:html-style-include-scripts "HTML_INCLUDE_SCRIPTS" nil nil)
    (:s5-version "S5_VERSION" nil org-s5-version)
    (:s5-version "S5_VERSION" nil org-s5-version)
    (:s5-theme-file "S5_THEME_FILE" nil org-s5-theme-file)
    (: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
   :translate-alist
   ((headline . org-s5-headline)
   ((headline . org-s5-headline)
    (plain-list . org-s5-plain-list)
    (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)
 (defun org-s5--build-meta-info (info)
   (concat
   (concat
    (org-html--build-meta-info info)
    (org-html--build-meta-info info)
-   (format "<meta name=\"version\" content=\"S5 %s\" />"
+   (format "<meta name=\"version\" content=\"S5 %s\" />\n"
 	   (plist-get info :s5-version))
 	   (plist-get info :s5-version))
-   "<meta name='defaultView' content='slideshow' />\n"
-   "<meta name='controlVis' content='hidden' />"))
+   (format "<meta name='defaultView' content='%s' />\n"
+           (plist-get info :s5-default-view))
+   (format "<meta name='controlVis' content='%s' />"
+           (plist-get info :s5-control-visibility))))
 
 
 (defun org-s5-headline (headline contents info)
 (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 "\\<slide\\>" 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)
 (defun org-s5-plain-list (plain-list contents info)
   "Transcode a PLAIN-LIST element from Org to HTML.
   "Transcode a PLAIN-LIST element from Org to HTML.
 CONTENTS is the contents of the list.  INFO is a plist holding
 CONTENTS is the contents of the list.  INFO is a plist holding
 contextual information.
 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,
 then the \"incremental\" class will be added to the to the list,
 which will make the list into a \"build\"."
 which will make the list into a \"build\"."
   (let* ((type (org-element-property :type plain-list))
   (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\n%s%s"
 	    (format
 	    (format
 	     "<%s class='org-%s%s'>" tag tag
 	     "<%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" ""))
 		 " incremental" ""))
 	    contents (org-html-end-plain-list type))))
 	    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)))
    ("title"  . ,(car (plist-get info :title)))
    ("author" . ,(car (plist-get info :author)))
    ("author" . ,(car (plist-get info :author)))
    ("email"  . ,(plist-get info :email))
    ("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))))
    ("file"   . ,(plist-get info :input-file))))
 
 
 (defun org-s5-template (contents info)
 (defun org-s5-template (contents info)