(actually attaching the patch)
(seemed silly to have a whole bunch of tiny patches but can resubmit as a
series if that's preferred).

On Thu, Dec 15, 2016 at 9:42 AM, Matt Price <mopto...@gmail.com> wrote:

>
>
> On Thu, Dec 15, 2016 at 8:39 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
> wrote:
>
>> Hello,
>>
>> Matt Price <mopto...@gmail.com> writes:
>>
>> > I'm such a slow coder that this is all I got to in my free moments
>> > today:patch for defcustoms that inserts the necessary code into a src
>> > block.  further refinements necessary before it works properly; severla
>> > more would be useful for hte improvements that Bastien suggests.
>>
>> Thank you. Some comments follow.
>>
>> > +(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
>> > +  :type 'boolean)
>>
>> :version :package-version keywords are missing.
>>
>> > +(defcustom org-html-klipse-css "https://storage.googleapis.co
>> m/app.klipse.tech/css/codemirror.css"
>> > +  "Location of the codemirror css file for use with klipse."
>>
>> css -> CSS
>>
>> > +  :group 'org-export-html
>> > +  :type 'string)
>>
>> See above.
>>
>> > +(defcustom org-html-klipse-js "https://storage.googleapis.co
>> m/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js"
>> > +  "location of the klipse js source code."
>>
>> Location of the klipse javascript source code.
>>
>> > +  :group 'org-export-html
>> > +  :type 'string)
>>
>> See above.
>>
>> > +(defcustom org-html-klipse-selection-script
>> > +  "window.klipse_settings = {selector_eval_html: '.src-html',
>> > +                             selector_eval_js: '.src-js',
>> > +                             selector_eval_python_client:
>> '.src-python',
>> > +                             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
>> > +  :type 'string)
>>
>> See above.
>>
>> > +   ;; klipse library for live code blocks, if requested
>> > +   (if org-html-klipsify-src
>>
>> You shouldn't use `org-html-klipsify-src' directly in the code, but
>> instead "register" it in the back-end and call
>>
>>   (plist-get info :html-klipsify-src)
>>
>> See other defcustoms.
>>
>
> The new, attached patch hopefully addresses the above concerns. S
>
>>
>> The new property also needs to be documented in "org.texi", in
>> Publishing directory.
>>
>
> I took a look at org.texi but my understanding of texi syntax is very poor
> and I don't think I have time to learn today. Bastien, would you be willing
> to take that on? Also, if you have thoughts on customizing the selection
> script I'd welcome them.
>
> Yehonathan: can klipse_settings[selector] take multiple css classes, in
> case we need to be able to accommodate customizing it?
>
>
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou
>>
>
>
From 333f2d02058a8c6412087371195ca0de9a8377cb Mon Sep 17 00:00:00 2001
From: Matt Price <matt.pr...@utoronto.ca>
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 <pre></pre> syntax instead of new
<pre><code></code></pre>.
---
 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 <pre class=\"\" syntax in favour of the new, 
+more widely used <pre><code class=\"\" synatax. "
+  :group 'org-export-html
+  :package-version '(Org . "9.1")
+  :type 'boolean)
 
 ;;; Internal Functions
 
@@ -2068,8 +2083,8 @@ holding export options."
    ;; Postamble.
    (org-html--build-pre/postamble 'postamble info)
    ;; klipse library for live code blocks, if requested
-   (if org-html-klipsify-src
-       (concat "<script>"org-html-klipse-selection-script "</script>
+   (if (plist-get info :html-klipsify-src)
+       (concat "<script>" (plist-get info :html-klipse-selection-script)  "</script>
 <script src=\"" org-html-klipse-js "\"></script>
 <link rel=\"stylesheet\" type=\"text/css\" href=\"" org-html-klipse-css "\"/>"))
    ;; 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 "<pre class=\"example\"%s>\n%s</pre>" label code)
 	(format "<div class=\"org-src-container\">\n%s%s\n</div>"
@@ -3368,8 +3383,10 @@ contextual information."
 			      listing-number
 			      (org-trim (org-export-data caption info))))))
 		;; Contents.
-		(format "<pre class=\"src src-%s\"%s%s>%s</pre>"
-			lang label (if (and klipsify (string= lang "html"))" data-editor-type=\"html\"" "") code))))))
+		(let ((open (if org-html-keep-old-src "<pre" "<pre><code"))
+		      (close (if org-html-keep-old-src "</pre>" "</code></pre>")))
+		  (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

Reply via email to