emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] allow klipse export in html
@ 2016-12-14 22:44 Matt Price
  2016-12-15  1:25 ` Matt Price
  2016-12-15 13:39 ` Nicolas Goaziou
  0 siblings, 2 replies; 20+ messages in thread
From: Matt Price @ 2016-12-14 22:44 UTC (permalink / raw)
  To: Rasmus; +Cc: bzg, Yehonathan Sharvit, Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 734 bytes --]

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.


On Wed, Dec 14, 2016 at 12:55 PM, Matt Price <moptop99@gmail.com> wrote:

>
>
>
> On Wed, Dec 14, 2016 at 5:06 AM, Rasmus <rasmus@gmx.us> wrote:
>
>>
>> I don’t know if much more support is needed.  We add some automatic
>> configuration scripting or add a per-block switch for enabling klipse.
>>
>> Two more little things. HTML blocks can't use the standard editor so they
> need an extra attribute `data-editor-style="html"`
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 1413 bytes --]

[-- Attachment #2: 0001-preliminary-support-for-live-preview-of-code-snippet.patch --]
[-- Type: text/x-patch, Size: 2507 bytes --]

From 05cc9948fe65201317a770c2d20cb9202b7d83ce Mon Sep 17 00:00:00 2001
From: Matt Price <matt.price@utoronto.ca>
Date: Wed, 14 Dec 2016 17:37:09 -0500
Subject: [PATCH] preliminary support for live preview of code snippets

Src blocks in supported languages are exported in a REPL which permits
live execution, courtesy of the klipse library.  Defcustom
`org-html-klipsify-src' set to nil by default, controls this
behaviour.
---
 lisp/ox-html.el | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 63a8c84..2704f84 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1548,7 +1548,33 @@ CSS classes, then this prefix can be very useful."
   :group 'org-export-html
   :type 'string)
 
-\f
+(defcustom org-html-klipsify-src nil
+  "Set to non-nil if you would like to make source code blocks editable in exported presentation."
+  :group 'org-export-html
+  :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."
+  :group 'org-export-html
+  :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."
+  :group 'org-export-html
+  :type 'string)
+
+(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"
+  :group 'org-export-html
+  :type 'string)
+
+
 ;;; Internal Functions
 
 (defun org-html-xhtml-p (info)
@@ -2041,6 +2067,11 @@ holding export options."
    (format "</%s>\n" (nth 1 (assq 'content (plist-get info :html-divs))))
    ;; 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>
+<script src=\"" org-html-klipse-js "\"></script>
+<link rel=\"stylesheet\" type=\"text/css\" href=\"" org-html-klipse-css "\"/>"))
    ;; Closing document.
    "</body>\n</html>"))
 
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-03-29 20:46 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-14 22:44 [PATCH] allow klipse export in html Matt Price
2016-12-15  1:25 ` Matt Price
2016-12-15  2:17   ` Bastien Guerry
2016-12-15 13:39 ` Nicolas Goaziou
2016-12-15 14:42   ` Matt Price
2016-12-15 14:50     ` Kaushal Modi
2016-12-15 14:57       ` Matt Price
2016-12-15 14:56     ` Matt Price
2016-12-15 15:35       ` Bastien Guerry
2016-12-16  5:34         ` Yehonathan Sharvit
2016-12-16  9:36           ` Bastien
2016-12-16 13:26           ` Matt Price
     [not found]             ` <87y3zfg6p7.fsf@bzg.fr>
     [not found]               ` <CAN_Dec9Ocfx+y1p0BqV4_ZwcLxUXb5g2XaU24RiWWGKgDVjiEA@mail.gmail.com>
     [not found]                 ` <87inqf15zz.fsf@bzg.fr>
     [not found]                   ` <CAMwuZb6LCGXsqLTVxziKRzgwrh-TVa1RqqKjqYnm6VO_pZ1yGQ@mail.gmail.com>
     [not found]                     ` <8760mf14yj.fsf@bzg.fr>
     [not found]                       ` <8737hij3an.fsf@gmx.us>
     [not found]                         ` <87pokmzm3x.fsf@bzg.fr>
     [not found]                           ` <CAN_Dec8GaKFKuyPg+s9LAxoVs4JTFJhDTk-b+s1wBghvVAOrFw@mail.gmail.com>
     [not found]                             ` <87h95yzik8.fsf@bzg.fr>
     [not found]                               ` <CAN_Dec-QZ5yHaeHY+XuPpDj6e_CbBA7qXUYmBRGddFmRK+CGMg@mail.gmail.com>
     [not found]                                 ` <87y3z9wszz.fsf@bzg.fr>
     [not found]                                   ` <877f6th05m.fsf@gmx.us>
     [not found]                                     ` <CAN_Dec9zthpWhS0z6GTgpDzQcja8A97BpDDXcqKEx3AwuXVoNg@mail.gmail.com>
     [not found]                                       ` <87zij7tgy7.fsf@bzg.fr>
     [not found]                                         ` <CAN_Dec93XtySLpYozbMMwnRB+gQtT-jDapo7CeV0k2JYfbUvdA@mail.gmail.com>
     [not found]                                           ` <CAN_Dec8Gb7N_ZpLKn+iDw6DCVgjRrWxYrOe=hRqOD_N93FMO1A@mail.gmail.com>
     [not found]                                             ` <87ziir3427.fsf@bzg.fr>
     [not found]                                               ` <CAN_Dec_SMD4mmwhE2FomC0_=w8JMvctjUGL2Z56xLdt2r8M_kQ@mail.gmail.com>
2017-03-09 15:18                                                 ` Matt Price
2017-03-21 23:33                                                   ` Matt Price
2017-03-22  6:13                                                     ` Bastien Guerry
2017-03-23 22:25                                                   ` Bastien Guerry
2017-03-24 11:15                                                     ` Matt Price
2017-03-24 11:19                                                       ` Yehonathan Sharvit
2017-03-24 13:00                                                         ` Bastien Guerry
2017-03-29 20:46                                                         ` Kaushal Modi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).