From mboxrd@z Thu Jan 1 00:00:00 1970 From: "N. Raghavendra" Subject: Re: [PATCH] ox-html.el: Fix display of language indicators for source blocks Date: Tue, 19 Sep 2017 06:24:37 +0530 Message-ID: <87tvzzecdu.fsf@gmail.com> References: <8760g9ywga.fsf@hri.res.in> <87a85iparx.fsf@gmail.com> <87h8zq2sgg.fsf@nicolasgoaziou.fr> <8737bap8px.fsf@gmail.com> <87k24exyoz.fsf@gmail.com> Reply-To: "N. Raghavendra" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1du6oO-0004tK-Ta for emacs-orgmode@gnu.org; Mon, 18 Sep 2017 20:54:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1du6oL-0008OH-QQ for emacs-orgmode@gnu.org; Mon, 18 Sep 2017 20:54:52 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:35288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1du6oL-0008Mw-HO for emacs-orgmode@gnu.org; Mon, 18 Sep 2017 20:54:49 -0400 Received: by mail-pf0-x242.google.com with SMTP id i23so836684pfi.2 for ; Mon, 18 Sep 2017 17:54:48 -0700 (PDT) In-Reply-To: <87k24exyoz.fsf@gmail.com> (N. Raghavendra's message of "Wed, 14 Jun 2017 23:02:12 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Cc: Matt Price --=-=-= Content-Type: text/plain At 2017-06-14T23:02:12+05:30, N. Raghavendra wrote: > At 2017-06-12T12:45:13-04:00, Matt Price wrote: > >> As it stands right now, both changes (addition of `data-editor-type` >> attribute and moving the language name class from `pre` to `code`) >> are necessary to make klipse work > > I tried with some examples, and the editing facility of klipse seems > to work even if you put the class attributes in the pre element > instead of in its code child. Let me check it again and provide an > MWE, but it'll take a few days, because I am busy at work this week. > If what I said is indeed correct, I have some suggestions on how to > deal with the problem. I am sorry for the inexcusable delay. 1. After rereading your message, I felt that one way out is restore the treatment of source code blocks, when klipse is not used, to what it was before you made commit d5bbf36553. This means that the blocks are exported as content of pre elements, when klipse is not used. 2. When klipse is used, your code kicks in, and puts the source code blocks of the klipse languages in code children, with appropriate attributes, of pre elements. Blocks of non-klipse languages are still put directly into pre elements as before, with the appropriate class attribute. 3. It remains to decide when klipse is being used. It is used when `org-html-klipsify-src' has a non-nil value. 4. Lastly, we are not changing the export of code blocks when klipse is not being used. Therefore, `org-html-keep-old-src' is not needed. Attached is a patch that implements these changes. I have also put a test file, and two exported HTML files, with and without klipse, at http://www.retrotexts.net/tmp/ox-html-patch/ The Makefile there should be self-explanatory. Please see if klipse.html agrees with what you want, modulo syntax colouring (it was produced in batch mode). The file noklipse.html validates (it can be checked at the W3C validator), and has language indicators. I hope this takes care of our different requirements. Cheers, Raghu. -- N. Raghavendra , http://www.retrotexts.net/ Harish-Chandra Research Institute, http://www.hri.res.in/ --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-html.el-Partially-revert-d5bbf36553.patch >From 7f352785b7ac5d9858a57da83778d4cfa572d7a5 Mon Sep 17 00:00:00 2001 From: "N. Raghavendra" Date: Tue, 19 Sep 2017 05:00:50 +0530 Subject: [PATCH] ox-html.el: Partially revert d5bbf36553 * lisp/ox-html.el (org-html-src-block): Unless klipse is used, export source code blocks as content of `pre' elements, and not as content of `code' children of `pre' elements. Restores the previous way of exporting source code blocks, and fixes the display of language indicators while hovering over the blocks in the exported HTML file, when klipse is not used. (org-html-keep-old-src): Remove it. Not needed because it is now the default, unless klipse is used. --- lisp/ox-html.el | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index ebb233b..be36d66 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -174,7 +174,6 @@ (: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. @@ -1572,12 +1571,6 @@ https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag" :package-version '(Org . "9.1") :type 'string) -(defcustom org-html-keep-old-src nil - "When non-nil, use
 instead of 
."
-  :group 'org-export-html
-  :package-version '(Org . "9.1")
-  :type 'boolean)
-
 
 ;;;; Todos
 
@@ -3384,12 +3377,16 @@ contextual information."
 			      listing-number
 			      (org-trim (org-export-data caption info))))))
 		;; Contents.
-		(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))))))) + (if klipsify + (format "
%s
" + lang + label + (if (and klipsify (string= lang "html")) + " data-editor-type=\"html\"" + "") + code) + (format "
%s
" + lang label code))))))) ;;;; Statistics Cookie -- 2.7.4 --=-=-=--