From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giovanni Moretti Subject: How to activate pre.src in org-babel html output? Can only get class=example Date: Mon, 13 Feb 2012 17:04:48 +1300 Message-ID: <4F388BE0.3040306@massey.ac.nz> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------020709030905070603050608" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwn9q-0003qK-Jl for emacs-orgmode@gnu.org; Sun, 12 Feb 2012 23:04:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rwn9o-0007RQ-PQ for emacs-orgmode@gnu.org; Sun, 12 Feb 2012 23:04:54 -0500 Received: from mu-mail2.massey.ac.nz ([130.123.129.7]:44848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwn9o-0007RF-8R for emacs-orgmode@gnu.org; Sun, 12 Feb 2012 23:04:52 -0500 Received: from tur-mm5.massey.ac.nz (tur-mm5.massey.ac.nz [130.123.96.133]) by mu-mail2.massey.ac.nz (Postfix) with ESMTP id 3A39A86918 for ; Mon, 13 Feb 2012 17:04:48 +1300 (NZDT) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------020709030905070603050608 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Using org-babel, I'm wanting to output Python fragments along with the resultant output to HTML. That bit's easy, and the following works as expected: #+options: toc:nil num:nil * Using Python interactively Any commands typed into the console executed immediately. #+begin_src python :results output :exports both print 355/113 print 17/2 print 17/2.0 #+end_src python However, although I find references to various styling mechanisms (e.g *pre.src*) in the orgmode documentation, I can't find any way to get any more CSS selectors on both the src and output blocks. The only one that ever appears is "example" as shown here:
print 355/113
    print 17/2
    print 17/2.0
    
       3
       8
       8.5
    
If I can find out how to make "pre.src" appear (hopefully only on the source block) , then I can change the background colours or fonts to make the output visibly distinct from the source code. The full HTML output I get is at http://dl.dropbox.com/u/2671560/org-py-babel.html contains lots of CSS selectors, and I can easily include my my own using #+STYLE lines, but I need some way to differentiate the two blocks. I'm using Emacs 23.1.50.1 and the lastest orgmode commit b5082974c83a3a4838db86025edce857b11e5847 (Fri Feb 3 15:18:05 2012 +0100) Any tips? Thanks Giovanni -- ====================================================================== Dr Giovanni Moretti | School of Engineering and Advanced Technology Senior Lecturer | Massey University, Palmerston North, New Zealand Computer Science | Ph +64-6-3505799x2474 Fax +64-6-3502259 - ZL2GX ====================================================================== http://seat.massey.ac.nz/moretti G.Moretti@massey.ac.nz --------------020709030905070603050608 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Using org-babel, I'm wanting to output Python fragments along with the resultant output to HTML.

That bit's easy, and the following works as expected:
#+options: toc:nil num:nil
* Using Python interactively
Any commands typed into the console executed immediately.

#+begin_src python :results output :exports both
print 355/113

print 17/2
print 17/2.0
#+end_src python

However, although I find references to various styling mechanisms (e.g pre.src) in the orgmode documentation, I can't find any way to get any more CSS selectors on both the src and output blocks. The only one that ever appears is "example" as shown here:
<pre class="example">print 355/113
print 17/2
print 17/2.0
</pre>
<pre class="example">
  3
  8
  8.5
</pre>
</div>
If I can find out how to make "pre.src" appear (hopefully only on the source block) , then I can change the background colours or fonts to make the output visibly distinct from the source code.

The full HTML output I get is at http://dl.dropbox.com/u/2671560/org-py-babel.html contains lots of CSS selectors, and I can easily include my my own using #+STYLE lines, but I need some way to differentiate the two blocks.

I'm using Emacs 23.1.50.1 and the lastest orgmode  commit b5082974c83a3a4838db86025edce857b11e5847 (Fri Feb 3 15:18:05 2012 +0100)

Any tips?

Thanks
Giovanni
-- 
======================================================================
Dr Giovanni Moretti | School of Engineering and Advanced Technology
Senior Lecturer     | Massey University, Palmerston North, New Zealand
Computer Science    | Ph +64-6-3505799x2474  Fax +64-6-3502259 - ZL2GX 
======================================================================
http://seat.massey.ac.nz/moretti                G.Moretti@massey.ac.nz

--------------020709030905070603050608-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: How to activate pre.src in org-babel html output? Can only get class=example Date: Sat, 18 Feb 2012 08:03:08 -0700 Message-ID: <87mx8gtasa.fsf@gmx.com> References: <4F388BE0.3040306@massey.ac.nz> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:34910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RymJz-00051k-7K for emacs-orgmode@gnu.org; Sat, 18 Feb 2012 10:35:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RymJx-0002Z5-23 for emacs-orgmode@gnu.org; Sat, 18 Feb 2012 10:35:35 -0500 Received: from mailout-us.gmx.com ([74.208.5.67]:39936) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RymJw-0002Yv-N8 for emacs-orgmode@gnu.org; Sat, 18 Feb 2012 10:35:33 -0500 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Giovanni Moretti Cc: emacs-orgmode@gnu.org Hi Giovanni, When I export the following code block ,---- | #+begin_src emacs-lisp :exports both | :foo | #+end_src `---- it generates the following HTML. ,---- |
:foo
| 
| | |
| :foo
| 
`---- My guess is that during export you get a message along the lines of "htmlize is required for export". Try explicitly loading htmlize.el (in the contrib/lisp directory of org) and then re-exporting and you should get the desired output. Best, Giovanni Moretti writes: > Using org-babel, I'm wanting to output Python fragments along with the resultant > output to HTML. > > That bit's easy, and the following works as expected: > > #+options: toc:nil num:nil > * Using Python interactively > Any commands typed into the console executed immediately. > > #+begin_src python :results output :exports both > print 355/113 > > print 17/2 > print 17/2.0 > #+end_src python > > However, although I find references to various styling mechanisms (e.g > *pre.src*) in the orgmode documentation, I can't find any way to get any more > CSS selectors on both the src and output blocks. The only one that ever appears > is "example" as shown here: > >
print 355/113
>     print 17/2
>     print 17/2.0
>     
>
>        3
>        8
>        8.5
>     
> > > If I can find out how to make "pre.src" appear (hopefully only on the source > block) , then I can change the background colours or fonts to make the output > visibly distinct from the source code. > > The full HTML output I get is at > http://dl.dropbox.com/u/2671560/org-py-babel.html contains lots of CSS > selectors, and I can easily include my my own using #+STYLE lines, but I need > some way to differentiate the two blocks. > > I'm using Emacs 23.1.50.1 and the lastest orgmode commit > b5082974c83a3a4838db86025edce857b11e5847 (Fri Feb 3 15:18:05 2012 +0100) > > Any tips? > > Thanks > Giovanni -- Eric Schulte http://cs.unm.edu/~eschulte/ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giovanni Moretti Subject: Re: How to activate pre.src in org-babel html output? Can only get class=example Date: Mon, 20 Feb 2012 13:12:11 +1300 Message-ID: <4F418FDB.3030706@massey.ac.nz> References: <4F388BE0.3040306@massey.ac.nz> <87mx8gtasa.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzGra-00046T-MX for emacs-orgmode@gnu.org; Sun, 19 Feb 2012 19:12:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RzGrZ-00057R-9h for emacs-orgmode@gnu.org; Sun, 19 Feb 2012 19:12:18 -0500 Received: from mu-mail3.massey.ac.nz ([130.123.129.187]:55654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzGrY-00056x-Fx for emacs-orgmode@gnu.org; Sun, 19 Feb 2012 19:12:17 -0500 In-Reply-To: <87mx8gtasa.fsf@gmx.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org Hi Eric > My guess is that during export you get a message along the lines of > "htmlize is required for export". Try explicitly loading htmlize.el > (in the contrib/lisp directory of org) and then re-exporting ... You're spot on - importing htmlize.el did the trick. However, before importing it, there weren't any error messages about it being missing. All would work happily, but the source block didn't have the additional src and src-python tags. To me, this seems like a bug or at least not ideal, as the src tag and the src- tag are related to the HTML export of #+begin_src block, not on *how* the HTML is styled (i.e. by the user or htmlize). For those searching the mailing list later: ; For pretty-printed formatted source code on HTML export, ; load htmlize.el in init.el or the emacs config file (load-file "~/.emacs.d/orgmode/contrib/lisp/htmlize.el") I've got the orgmode source in the .emacs.d directory so I can pull updates using git, otherwise look for contrib/lisp/htmlize.el in the main Emacs directory. With htmlize.el loaded, exporting: ,============ | #+begin_src python :results output :exports both | print "Pi = ", 355/113.0 | #+end_src python `============ Results in the src block having the src and src-python CSS tags: ,============ |
|print
|"Pi =", 355/113.0
|
| | |
| Pi =  3.14159292035
|
`============ with an automatically added little "Python" flag box on the Python src block. Some custom CSS can be used to make the src and output a little more distinct. A simple way is it place these lines at the top of the file: #+style: #+style: However, you have to be consistent about using #+begin_src blocks rather than just a colon or using begin_example at the beginning of lines for src fragments that don't output anything, otherwise Python src they'll come out with the output colouring. The keyboard shortcut (< s tab) for getting a #+begin_src---#+end_src block is handy here. Although the example above relates to #+begin_src python blocks, the fix should work with other languages. Cheers and thanks Giovanni ====================================================================== Dr Giovanni Moretti | School of Engineering and Advanced Technology Senior Lecturer | Massey University, Palmerston North, New Zealand Computer Science | Ph +64-6-3505799x2474 Fax +64-6-3502259 - ZL2GX ====================================================================== http://seat.massey.ac.nz/moretti G.Moretti@massey.ac.nz