Re: [O] PATCH: programming language indicators in HTML export

2016-05-10 Thread Nicolas Goaziou
Hello,

Robert Klein  writes:

> Please find the patch attached.

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou



Re: [O] PATCH: programming language indicators in HTML export

2016-05-10 Thread Robert Klein
Hi,

Rasmus  wrote:

> Robert Klein  writes:
> 
> > Hi,
> >
> > Nicolas Goaziou  wrote:
> >
> >> Hello,
> >> 
> >> Robert Klein  writes:
> >> 
> >> > anyone willing to commit this patch I sent back in march?
> >> 
> >> This patch actually felt through the cracks. Sorry about that.
> >> Would you mind sending it again, using git format-patch so I can
> >> apply it?
> >> 
> >
> > Please find the patch attached.
> 
> I wonder if it would be possible (or even desirable) to build this
> part of the css header automatically?  It may be too prone to
> unexpected bugs.
> 

basically same answer I gave last time;  when you want JS to create the
CSS you still have to map the source block identifier to ``readable''
text elsewhere.  You'd just move the static from org-modes basic CSS
into org-mode.

I think the patch is a bonus for those, that don't roll their own CSS
(e.g. Tianxian Xiong, who first gave me the idea).

Any automated solution would be error-prone, too, and depend on:
- what's the Emacs mode for editing (or is there one at all)?
- is there an ob- module for running the code?
- for LaTeX export: is the language supported by
  - the LaTeX listings package (and what is its name there?)?
  - or the pygments library (for those using the LaTeX minted package)?

One example I use for documentation is `conf' source blocks for
`generic' configuration files.  For LaTeX export I have to add 
   (add-to-list 'org-latex-listings-langs '(conf " "))
to my .emacs, as the listings package doesn't support a `configuration'
language.

It's a hack, but it works.  I don't see a general solution (even if
restricted to the CSS header).

I see my patch as a `best effort' for getting things working out of the
box.  Anyone rolling his own CSS will probably pick his 2 to 5
languages and be happy with them.


Best regards
Robert




Re: [O] PATCH: programming language indicators in HTML export

2016-05-10 Thread Rasmus
Robert Klein  writes:

> Hi,
>
> Nicolas Goaziou  wrote:
>
>> Hello,
>> 
>> Robert Klein  writes:
>> 
>> > anyone willing to commit this patch I sent back in march?
>> 
>> This patch actually felt through the cracks. Sorry about that. Would
>> you mind sending it again, using git format-patch so I can apply it?
>> 
>
> Please find the patch attached.

I wonder if it would be possible (or even desirable) to build this part of
the css header automatically?  It may be too prone to unexpected bugs.

Rasmus

-- 
The Kids call him Billy the Saint




Re: [O] PATCH: programming language indicators in HTML export

2016-05-09 Thread Robert Klein
Hi,

Nicolas Goaziou  wrote:

> Hello,
> 
> Robert Klein  writes:
> 
> > anyone willing to commit this patch I sent back in march?
> 
> This patch actually felt through the cracks. Sorry about that. Would
> you mind sending it again, using git format-patch so I can apply it?
> 

Please find the patch attached.

Thank you very much.

Best regards
Robert


>From ccedae3c29077c56b9c7325a3911a841c11add2d Mon Sep 17 00:00:00 2001
From: Robert Klein 
Date: Mon, 14 Mar 2016 14:43:46 +0100
Subject: [PATCH] support more programming languages in CSS

The standard CSS for HTML export only supported a couple of
programming languages to have a language name "hover" on src
blocks.  This patch adds all languages supported per Org
manual, those from org.el's org-babel-load-languages-alist,
additional language identifiers in ob-*.el and languages
which have a) an emacs mode and b) are supported by the LaTeX
listings package.  Additional a language "conf" is supported
for generic configuraiton files; an emacs mode exists for
this, but for LaTeX listings a language " " has to be faked.
As this patch is for HTML, this is no impediment.

Thanks for reporting the missing support to Tianxian XIONG.
---
 lisp/ox-html.el | 95 +
 1 file changed, 89 insertions(+), 6 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index a05fa2d..7653c43 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -314,13 +314,96 @@ for the JavaScript code in this tag.
 border: 1px solid black;
   }
   pre.src:hover:before { display: inline;}
-  pre.src-sh:before{ content: 'sh'; }
-  pre.src-bash:before  { content: 'sh'; }
+  /* Languages per Org manual */
+  pre.src-asymptote:before { content: 'Asymptote'; }
+  pre.src-awk:before { content: 'Awk'; }
+  pre.src-C:before { content: 'C'; }
+  /* pre.src-C++ doesn't work in CSS */
+  pre.src-clojure:before { content: 'Clojure'; }
+  pre.src-css:before { content: 'CSS'; }
+  pre.src-D:before { content: 'D'; }
+  pre.src-ditaa:before { content: 'ditaa'; }
+  pre.src-dot:before { content: 'Graphviz'; }
+  pre.src-calc:before { content: 'Emacs Calc'; }
   pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
-  pre.src-R:before { content: 'R'; }
-  pre.src-perl:before  { content: 'Perl'; }
-  pre.src-java:before  { content: 'Java'; }
-  pre.src-sql:before   { content: 'SQL'; }
+  pre.src-fortran:before { content: 'Fortran'; }
+  pre.src-gnuplot:before { content: 'gnuplot'; }
+  pre.src-haskell:before { content: 'Haskell'; }
+  pre.src-java:before { content: 'Java'; }
+  pre.src-js:before { content: 'Javascript'; }
+  pre.src-latex:before { content: 'LaTeX'; }
+  pre.src-ledger:before { content: 'Ledger'; }
+  pre.src-lisp:before { content: 'Lisp'; }
+  pre.src-lilypond:before { content: 'Lilypond'; }
+  pre.src-matlab:before { content: 'MATLAB'; }
+  pre.src-mscgen:before { content: 'Mscgen'; }
+  pre.src-ocaml:before { content: 'Objective Caml'; }
+  pre.src-octave:before { content: 'Octave'; }
+  pre.src-org:before { content: 'Org mode'; }
+  pre.src-oz:before { content: 'OZ'; }
+  pre.src-plantuml:before { content: 'Plantuml'; }
+  pre.src-processing:before { content: 'Processing.js'; }
+  pre.src-python:before { content: 'Python'; }
+  pre.src-R:before { content: 'R'; }
+  pre.src-ruby:before { content: 'Ruby'; }
+  pre.src-sass:before { content: 'Sass'; }
+  pre.src-scheme:before { content: 'Scheme'; }
+  pre.src-screen:before { content: 'Gnu Screen'; }
+  pre.src-sed:before { content: 'Sed'; }
+  pre.src-sh:before { content: 'shell'; }
+  pre.src-sql:before { content: 'SQL'; }
+  pre.src-sqlite:before { content: 'SQLite'; }
+  /* additional languages in org.el's org-babel-load-languages alist */
+  pre.src-forth:before { content: 'Forth'; }
+  pre.src-io:before { content: 'IO'; }
+  pre.src-J:before { content: 'J'; }
+  pre.src-makefile:before { content: 'Makefile'; }
+  pre.src-maxima:before { content: 'Maxima'; }
+  pre.src-perl:before { content: 'Perl'; }
+  pre.src-picolisp:before { content: 'Pico Lisp'; }
+  pre.src-scala:before { content: 'Scala'; }
+  pre.src-shell:before { content: 'Shell Script'; }
+  pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
+  /* additional language identifiers per \"defun org-babel-execute\"
+   in ob-*.el */
+  pre.src-cpp:before  { content: 'C++'; }
+  pre.src-abc:before  { content: 'ABC'; }
+  pre.src-coq:before  { content: 'Coq'; }
+  pre.src-groovy:before  { content: 'Groovy'; }
+  /* additional language identifiers from org-babel-shell-names in
+ ob-shell.el: ob-shell is the only babel language using a lambda to put
+ the execution function name together. */
+  pre.src-bash:before  { content: 'bash'; }
+  pre.src-csh:before  { content: 'csh'; }
+  pre.src-ash:before  { content: 'ash'; }
+  pre.src-dash:before  { content: 'dash'; }
+  pre.src-ksh:before  { content: 'ksh'; }
+  pre.src-mksh:before  { content: 'mksh'; 

Re: [O] PATCH: programming language indicators in HTML export

2016-05-09 Thread Nicolas Goaziou
Hello,

Robert Klein  writes:

> anyone willing to commit this patch I sent back in march?

This patch actually felt through the cracks. Sorry about that. Would you
mind sending it again, using git format-patch so I can apply it?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] PATCH: programming language indicators in HTML export

2016-05-09 Thread Robert Klein
Hi,

anyone willing to commit this patch I sent back in march?

Best regards
Robert


On Mon, 14 Mar 2016 15:16:05 +0100
Robert Klein  wrote:

> 
> Author: Robert Klein   2016-03-14 14:43:46
> Committer: Robert Klein   2016-03-14 14:43:46
> Parent: dd9be3a6ea4ff561248b1f6658194fd153b5821c (Fix docstring typo)
> Branch: maint
> Follows: release_8.3.4
> Precedes:
> 
> support more programming languages in CSS
> 
> The standard CSS for HTML export only supported a couple of
> programming languages to have a language name "hover" on src
> blocks.  This patch adds all languages supported per Org
> manual, those from org.el's org-babel-load-languages-alist,
> additional language identifiers in ob-*.el and languages
> which have a) an emacs mode and b) are supported by the LaTeX
> listings package.  Additional a language "conf" is supported
> for generic configuraiton files; an emacs mode exists for
> this, but for LaTeX listings a language " " has to be faked.
> As this patch is for HTML, this is no impediment.
> 
> Thanks for reporting the missing support to Tianxian XIONG.
> 
> --- lisp/ox-html.el
> --- index de2e5d9..e4a4c38 100644
> @@ -314,13 +314,96 @@ for the JavaScript code in this tag.
>  border: 1px solid black;
>}
>pre.src:hover:before { display: inline;}
> -  pre.src-sh:before{ content: 'sh'; }
> -  pre.src-bash:before  { content: 'sh'; }
> +  /* Languages per Org manual */
> +  pre.src-asymptote:before { content: 'Asymptote'; }
> +  pre.src-awk:before { content: 'Awk'; }
> +  pre.src-C:before { content: 'C'; }
> +  /* pre.src-C++ doesn't work in CSS */
> +  pre.src-clojure:before { content: 'Clojure'; }
> +  pre.src-css:before { content: 'CSS'; }
> +  pre.src-D:before { content: 'D'; }
> +  pre.src-ditaa:before { content: 'ditaa'; }
> +  pre.src-dot:before { content: 'Graphviz'; }
> +  pre.src-calc:before { content: 'Emacs Calc'; }
>pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
> -  pre.src-R:before { content: 'R'; }
> -  pre.src-perl:before  { content: 'Perl'; }
> -  pre.src-java:before  { content: 'Java'; }
> -  pre.src-sql:before   { content: 'SQL'; }
> +  pre.src-fortran:before { content: 'Fortran'; }
> +  pre.src-gnuplot:before { content: 'gnuplot'; }
> +  pre.src-haskell:before { content: 'Haskell'; }
> +  pre.src-java:before { content: 'Java'; }
> +  pre.src-js:before { content: 'Javascript'; }
> +  pre.src-latex:before { content: 'LaTeX'; }
> +  pre.src-ledger:before { content: 'Ledger'; }
> +  pre.src-lisp:before { content: 'Lisp'; }
> +  pre.src-lilypond:before { content: 'Lilypond'; }
> +  pre.src-matlab:before { content: 'MATLAB'; }
> +  pre.src-mscgen:before { content: 'Mscgen'; }
> +  pre.src-ocaml:before { content: 'Objective Caml'; }
> +  pre.src-octave:before { content: 'Octave'; }
> +  pre.src-org:before { content: 'Org mode'; }
> +  pre.src-oz:before { content: 'OZ'; }
> +  pre.src-plantuml:before { content: 'Plantuml'; }
> +  pre.src-processing:before { content: 'Processing.js'; }
> +  pre.src-python:before { content: 'Python'; }
> +  pre.src-R:before { content: 'R'; }
> +  pre.src-ruby:before { content: 'Ruby'; }
> +  pre.src-sass:before { content: 'Sass'; }
> +  pre.src-scheme:before { content: 'Scheme'; }
> +  pre.src-screen:before { content: 'Gnu Screen'; }
> +  pre.src-sed:before { content: 'Sed'; }
> +  pre.src-sh:before { content: 'shell'; }
> +  pre.src-sql:before { content: 'SQL'; }
> +  pre.src-sqlite:before { content: 'SQLite'; }
> +  /* additional languages in org.el's org-babel-load-languages alist
> */
> +  pre.src-forth:before { content: 'Forth'; }
> +  pre.src-io:before { content: 'IO'; }
> +  pre.src-J:before { content: 'J'; }
> +  pre.src-makefile:before { content: 'Makefile'; }
> +  pre.src-maxima:before { content: 'Maxima'; }
> +  pre.src-perl:before { content: 'Perl'; }
> +  pre.src-picolisp:before { content: 'Pico Lisp'; }
> +  pre.src-scala:before { content: 'Scala'; }
> +  pre.src-shell:before { content: 'Shell Script'; }
> +  pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
> +  /* additional language identifiers per \"defun org-babel-execute\"
> +   in ob-*.el */
> +  pre.src-cpp:before  { content: 'C++'; }
> +  pre.src-abc:before  { content: 'ABC'; }
> +  pre.src-coq:before  { content: 'Coq'; }
> +  pre.src-groovy:before  { content: 'Groovy'; }
> +  /* additional language identifiers from org-babel-shell-names in
> + ob-shell.el: ob-shell is the only babel language using a lambda
> to put
> + the execution function name together. */
> +  pre.src-bash:before  { content: 'bash'; }
> +  pre.src-csh:before  { content: 'csh'; }
> +  pre.src-ash:before  { content: 'ash'; }
> +  pre.src-dash:before  { content: 'dash'; }
> +  pre.src-ksh:before  { content: 'ksh'; }
> +  pre.src-mksh:before  { content: 'mksh'; }
> +  pre.src-posh:before  { content: 'posh'; }
> 

Re: [O] PATCH: programming language indicators in HTML export

2016-03-15 Thread Robert Klein
Hi Rasmus,


On Tue, 15 Mar 2016 15:24:00 +0100
Rasmus  wrote:

[rest deleted]

> Robert, do you have a copyright assignment of changes to Emacs?  I
> think the change is too long (in line count) for a TINYCHANGE.

I signed the FSF papers in April 2015. On top of the sheet there is the
number "RT: 1006989".

Do you need a copy of the PDF?

Thanks and best regards,
Robert



Re: [O] PATCH: programming language indicators in HTML export

2016-03-15 Thread Rasmus
Hi Robert,

Robert Klein  writes:

>> The patch would make the default html header a bit longer, which may
>> or may not be an issue.  Perhaps more importantly, it also does not
>> deal with new languages.  Maybe it would be possible to add a bit of
>> JS that would look up the language based on the class of the block in
>> question?
>> 
>> E.g. the block
>> 
>>  #+BEGIN_SRC rsgrs
>> 
>>  #+END_SRC
>> 
>> would have class "src-rsgrs".
>
> This happens already, but the JS would also have to create the
> corresponding CSS code (that's what I hardcoded in the patch).
>
> However you'd still need a mapping from src block identifier to
> pleasantly readable text, e.g. js -> "Javascript", sql -> "SQL",
> emacs-lisp -> "Emacs Lisp", ps -> "PostScript" etc.  When you have all
> those it's not that much different from static CSS anymore...

Fair point.

> Anyway, my patch is basically for those who don't roll their own CSS to
> have things mostly working out of the box. 

Seems good to me.

Robert, do you have a copyright assignment of changes to Emacs?  I think
the change is too long (in line count) for a TINYCHANGE.

Thanks,
Rasmus

-- 
And I faced endless streams of vendor-approved Ikea furniture. . .




Re: [O] PATCH: programming language indicators in HTML export

2016-03-14 Thread Robert Klein
Hi Rasmus,

Rasmus  wrote:

> Hi Robert,
> 
> Thanks for the patch.
> 
> Robert Klein  writes:
> 
> > any thoughts about this?
> 
> Remind me, would this only show up when hovering above the block with
> the mouse when using this setup?

Yes.

> 
> The patch would make the default html header a bit longer, which may
> or may not be an issue.  Perhaps more importantly, it also does not
> deal with new languages.  Maybe it would be possible to add a bit of
> JS that would look up the language based on the class of the block in
> question?
> 
> E.g. the block
> 
>  #+BEGIN_SRC rsgrs
> 
>  #+END_SRC
> 
> would have class "src-rsgrs".

This happens already, but the JS would also have to create the
corresponding CSS code (that's what I hardcoded in the patch).

However you'd still need a mapping from src block identifier to
pleasantly readable text, e.g. js -> "Javascript", sql -> "SQL",
emacs-lisp -> "Emacs Lisp", ps -> "PostScript" etc.  When you have all
those it's not that much different from static CSS anymore...

There's no perfect solution, unfortunately, but src blocks have a lot
of limits for each language:
- is there an Emacs mode for editing?
- is there org-babel code for executing?
- is the language supported by the LaTeX listings package?
- or by the pygments library (for the LaTeX minted package)?


Anyway, my patch is basically for those who don't roll their own CSS to
have things mostly working out of the box. 


Best regards
Robert


> 
> Thanks,
> Rasmus
> 




Re: [O] PATCH: programming language indicators in HTML export

2016-03-14 Thread Rasmus
Hi Robert,

Thanks for the patch.

Robert Klein  writes:

> any thoughts about this?

Remind me, would this only show up when hovering above the block with the
mouse when using this setup?

The patch would make the default html header a bit longer, which may or
may not be an issue.  Perhaps more importantly, it also does not deal with
new languages.  Maybe it would be possible to add a bit of JS that would
look up the language based on the class of the block in question?

E.g. the block

 #+BEGIN_SRC rsgrs

 #+END_SRC

would have class "src-rsgrs".

Thanks,
Rasmus

-- 
Nothing's wrong with an email that ends in a minor key




[O] PATCH: programming language indicators in HTML export

2016-03-14 Thread Robert Klein
Hi,

any thoughts about this?

Best regards
Robert


Author: Robert Klein   2016-03-14 14:43:46
Committer: Robert Klein   2016-03-14 14:43:46
Parent: dd9be3a6ea4ff561248b1f6658194fd153b5821c (Fix docstring typo)
Branch: maint
Follows: release_8.3.4
Precedes:

support more programming languages in CSS

The standard CSS for HTML export only supported a couple of
programming languages to have a language name "hover" on src
blocks.  This patch adds all languages supported per Org
manual, those from org.el's org-babel-load-languages-alist,
additional language identifiers in ob-*.el and languages
which have a) an emacs mode and b) are supported by the LaTeX
listings package.  Additional a language "conf" is supported
for generic configuraiton files; an emacs mode exists for
this, but for LaTeX listings a language " " has to be faked.
As this patch is for HTML, this is no impediment.

Thanks for reporting the missing support to Tianxian XIONG.

--- lisp/ox-html.el
--- index de2e5d9..e4a4c38 100644
@@ -314,13 +314,96 @@ for the JavaScript code in this tag.
 border: 1px solid black;
   }
   pre.src:hover:before { display: inline;}
-  pre.src-sh:before{ content: 'sh'; }
-  pre.src-bash:before  { content: 'sh'; }
+  /* Languages per Org manual */
+  pre.src-asymptote:before { content: 'Asymptote'; }
+  pre.src-awk:before { content: 'Awk'; }
+  pre.src-C:before { content: 'C'; }
+  /* pre.src-C++ doesn't work in CSS */
+  pre.src-clojure:before { content: 'Clojure'; }
+  pre.src-css:before { content: 'CSS'; }
+  pre.src-D:before { content: 'D'; }
+  pre.src-ditaa:before { content: 'ditaa'; }
+  pre.src-dot:before { content: 'Graphviz'; }
+  pre.src-calc:before { content: 'Emacs Calc'; }
   pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
-  pre.src-R:before { content: 'R'; }
-  pre.src-perl:before  { content: 'Perl'; }
-  pre.src-java:before  { content: 'Java'; }
-  pre.src-sql:before   { content: 'SQL'; }
+  pre.src-fortran:before { content: 'Fortran'; }
+  pre.src-gnuplot:before { content: 'gnuplot'; }
+  pre.src-haskell:before { content: 'Haskell'; }
+  pre.src-java:before { content: 'Java'; }
+  pre.src-js:before { content: 'Javascript'; }
+  pre.src-latex:before { content: 'LaTeX'; }
+  pre.src-ledger:before { content: 'Ledger'; }
+  pre.src-lisp:before { content: 'Lisp'; }
+  pre.src-lilypond:before { content: 'Lilypond'; }
+  pre.src-matlab:before { content: 'MATLAB'; }
+  pre.src-mscgen:before { content: 'Mscgen'; }
+  pre.src-ocaml:before { content: 'Objective Caml'; }
+  pre.src-octave:before { content: 'Octave'; }
+  pre.src-org:before { content: 'Org mode'; }
+  pre.src-oz:before { content: 'OZ'; }
+  pre.src-plantuml:before { content: 'Plantuml'; }
+  pre.src-processing:before { content: 'Processing.js'; }
+  pre.src-python:before { content: 'Python'; }
+  pre.src-R:before { content: 'R'; }
+  pre.src-ruby:before { content: 'Ruby'; }
+  pre.src-sass:before { content: 'Sass'; }
+  pre.src-scheme:before { content: 'Scheme'; }
+  pre.src-screen:before { content: 'Gnu Screen'; }
+  pre.src-sed:before { content: 'Sed'; }
+  pre.src-sh:before { content: 'shell'; }
+  pre.src-sql:before { content: 'SQL'; }
+  pre.src-sqlite:before { content: 'SQLite'; }
+  /* additional languages in org.el's org-babel-load-languages alist */
+  pre.src-forth:before { content: 'Forth'; }
+  pre.src-io:before { content: 'IO'; }
+  pre.src-J:before { content: 'J'; }
+  pre.src-makefile:before { content: 'Makefile'; }
+  pre.src-maxima:before { content: 'Maxima'; }
+  pre.src-perl:before { content: 'Perl'; }
+  pre.src-picolisp:before { content: 'Pico Lisp'; }
+  pre.src-scala:before { content: 'Scala'; }
+  pre.src-shell:before { content: 'Shell Script'; }
+  pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
+  /* additional language identifiers per \"defun org-babel-execute\"
+   in ob-*.el */
+  pre.src-cpp:before  { content: 'C++'; }
+  pre.src-abc:before  { content: 'ABC'; }
+  pre.src-coq:before  { content: 'Coq'; }
+  pre.src-groovy:before  { content: 'Groovy'; }
+  /* additional language identifiers from org-babel-shell-names in
+ ob-shell.el: ob-shell is the only babel language using a lambda
to put
+ the execution function name together. */
+  pre.src-bash:before  { content: 'bash'; }
+  pre.src-csh:before  { content: 'csh'; }
+  pre.src-ash:before  { content: 'ash'; }
+  pre.src-dash:before  { content: 'dash'; }
+  pre.src-ksh:before  { content: 'ksh'; }
+  pre.src-mksh:before  { content: 'mksh'; }
+  pre.src-posh:before  { content: 'posh'; }
+  /* Additional Emacs modes also supported by the LaTeX listings
package */
+  pre.src-ada:before { content: 'Ada'; }
+  pre.src-asm:before { content: 'Assembler'; }
+  pre.src-caml:before { content: 'Caml'; }
+  pre.src-delphi:before { content: 'Delphi'; }
+  pre.src-html:before { content: 'HTML'; }
+