From: Matt Price <moptop99@gmail.com>
To: Matt Price <moptop99@gmail.com>, Rasmus <rasmus@gmx.us>,
Bastien Guerry <bzg@bzg.fr>,
Yehonathan Sharvit <viebel@gmail.com>,
Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] allow klipse export in html
Date: Thu, 15 Dec 2016 09:56:18 -0500 [thread overview]
Message-ID: <CAN_Dec9UcCRB+EiuiS70o5ziN91xSUOXWmEb8UYXNMY=VG=t+A@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec9spcGrxfoscPemSf-RLpt+8H3mvdbEFWz5qzzPpLf6dg@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3164 bytes --]
(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 <moptop99@gmail.com> wrote:
>
>
> On Thu, Dec 15, 2016 at 8:39 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>> Hello,
>>
>> Matt Price <moptop99@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
>>
>
>
[-- Attachment #1.2: Type: text/html, Size: 5112 bytes --]
[-- Attachment #2: 0001-Conform-to-Org-coding-standards-and-add-backwards-co.patch --]
[-- Type: text/x-patch, Size: 4759 bytes --]
From 333f2d02058a8c6412087371195ca0de9a8377cb Mon Sep 17 00:00:00 2001
From: Matt Price <matt.price@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
next prev parent reply other threads:[~2016-12-15 14:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN_Dec9UcCRB+EiuiS70o5ziN91xSUOXWmEb8UYXNMY=VG=t+A@mail.gmail.com' \
--to=moptop99@gmail.com \
--cc=bzg@bzg.fr \
--cc=emacs-orgmode@gnu.org \
--cc=rasmus@gmx.us \
--cc=viebel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).