emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: bzg@bzg.fr, Yehonathan Sharvit <viebel@gmail.com>,
	Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] allow klipse export in html
Date: Wed, 14 Dec 2016 20:25:19 -0500	[thread overview]
Message-ID: <CAN_Dec8+pjPy9=B=QW_4qDp0kqA-0T8J3L78avDuRye=kFn+1Q@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec9BsUJ8yHBL9vBuFp8twH29QQRNkx16O13pvVce+HpD4w@mail.gmail.com>


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

And this second patch adds support for html rendering with klipse.  The
default CSS leaves a little to be desired!


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

>
> 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: 1927 bytes --]

[-- Attachment #2: 0002-Add-basic-support-for-html-rendering.patch --]
[-- Type: text/x-patch, Size: 1835 bytes --]

From 14433dc75b859de880f2cc135415ef6de54efe74 Mon Sep 17 00:00:00 2001
From: Matt Price <matt.price@utoronto.ca>
Date: Wed, 14 Dec 2016 20:15:04 -0500
Subject: [PATCH 2/2] Add basic support for html rendering

Insert 'data-editor-type="html"' into <pre> tag when exporting
klipsified html blocks.
---
 lisp/ox-html.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 2704f84..a9c8b5d 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3345,11 +3345,13 @@ CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
   (if (org-export-read-attribute :attr_html src-block :textarea)
       (org-html--textarea-block src-block)
-    (let ((lang (org-element-property :language src-block))
+    (let* ((lang (org-element-property :language src-block))
 	  (code (org-html-format-code src-block info))
 	  (label (let ((lbl (and (org-element-property :name src-block)
 				 (org-export-get-reference src-block info))))
-		   (if lbl (format " id=\"%s\"" lbl) ""))))
+		   (if lbl (format " id=\"%s\"" lbl) "")))
+	  (klipsify  (and  org-reveal-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>"
 		;; Build caption.
@@ -3366,8 +3368,8 @@ contextual information."
 			      listing-number
 			      (org-trim (org-export-data caption info))))))
 		;; Contents.
-		(format "<pre class=\"src src-%s\"%s>%s</pre>"
-			lang label code))))))
+		(format "<pre class=\"src src-%s\"%s%s>%s</pre>"
+			lang label (if (and klipsify (string= lang "html"))" data-editor-type=\"html\"" "") code))))))
 
 ;;;; Statistics Cookie
 
-- 
2.10.2


  reply	other threads:[~2016-12-15  1:26 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 [this message]
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

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_Dec8+pjPy9=B=QW_4qDp0kqA-0T8J3L78avDuRye=kFn+1Q@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).