From 333f2d02058a8c6412087371195ca0de9a8377cb Mon Sep 17 00:00:00 2001 From: Matt Price Date: Thu, 15 Dec 2016 09:24:27 -0500 Subject: [PATCH] Conform to Org coding standards, and add backwards compatibility Use new defcustoms appropriately, add package-version information, and permit users to prefer old
 syntax instead of new
. --- lisp/ox-html.el | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index a9c8b5d..5d2e4c3 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -170,6 +170,11 @@ (:html-table-row-open-tag nil nil org-html-table-row-open-tag) (:html-table-row-close-tag nil nil org-html-table-row-close-tag) (:html-xml-declaration nil nil org-html-xml-declaration) + (:html-klipsify-src nil nil org-html-klipsify-src) + (:html-klipse-css nil nil org-html-klipse-css) + (:html-klipse-js nil nil org-html-klipse-js) + (:html-klipse-keep-old-src nil nil org-html-keep-old-src) + (:html-klipse-selection-script nil nil org-html-klipse-selection-script) (:infojs-opt "INFOJS_OPT" nil nil) ;; Redefine regular options. (:creator "CREATOR" nil org-html-creator-string) @@ -1549,18 +1554,21 @@ CSS classes, then this prefix can be very useful." :type 'string) (defcustom org-html-klipsify-src nil - "Set to non-nil if you would like to make source code blocks editable in exported presentation." + "When non-nil, source code blocks are editable in exported presentation." :group 'org-export-html + :package-version '(Org . "9.1") :type 'boolean) (defcustom org-html-klipse-css "https://storage.googleapis.com/app.klipse.tech/css/codemirror.css" - "Location of the codemirror css file for use with klipse." + "Location of the codemirror CSS file for use with klipse." :group 'org-export-html + :package-version '(Org . "9.1") :type 'string) (defcustom org-html-klipse-js "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js" - "location of the klipse js source code." + "Location of the klipse js source code." :group 'org-export-html + :package-version '(Org . "9.1") :type 'string) (defcustom org-html-klipse-selection-script @@ -1570,10 +1578,17 @@ CSS classes, then this prefix can be very useful." selector_eval_scheme: '.src-scheme', selector: '.src-clojure', selector_eval_ruby: '.src-ruby'};" - "javascript snippet to activate klipse" + "JAvascript snippet to activate klipse" :group 'org-export-html + :package-version '(Org . "9.1") :type 'string) +(defcustom org-html-keep-old-src nil + "When non-nil, preserve old
"org-html-klipse-selection-script "
+   (if (plist-get info :html-klipsify-src)
+       (concat "
 
 "))
    ;; Closing document.
@@ -3350,7 +3365,7 @@ contextual information."
 	  (label (let ((lbl (and (org-element-property :name src-block)
 				 (org-export-get-reference src-block info))))
 		   (if lbl (format " id=\"%s\"" lbl) "")))
-	  (klipsify  (and  org-reveal-klipsify-src
+	  (klipsify  (and  (plist-get info :html-klipsify-src)
                            (member lang '("javascript" "js" "ruby" "scheme" "clojure" "php" "html")))))
       (if (not lang) (format "
\n%s
" label code) (format "
\n%s%s\n
" @@ -3368,8 +3383,10 @@ contextual information." listing-number (org-trim (org-export-data caption info)))))) ;; Contents. - (format "
%s
" - lang label (if (and klipsify (string= lang "html"))" data-editor-type=\"html\"" "") code)))))) + (let ((open (if org-html-keep-old-src "" "
"))) + (format "%s class=\"src src-%s\"%s%s>%s%s" + open lang label (if (and klipsify (string= lang "html"))" data-editor-type=\"html\"" "") code close))))))) ;;;; Statistics Cookie -- 2.10.2