Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > HTML formated Ruby code

Reply
Thread Tools

HTML formated Ruby code

 
 
Felipe Contreras
Guest
Posts: n/a
 
      05-07-2007
Hi,

Does anyone knows how all that beautiful HTML formated Ruby code on
ruby-lang.org is generated?

Like this:

<div id="code">

<div class="comment"># Output "I love Ruby"</div>
<div>say <span class="op">=</span> <span class="string">"I love
Ruby"</span></div>
<div>puts say</div>
<div class="blank-line">&nbsp;</div>
<div class="comment"># Output "I *LOVE* RUBY"</div>

<div>say<span class="op">[</span><span
class="string">'love'</span><span class="op">]</span> = <span
class="string">"*love*"</span></div>
<div>puts say<span class="op">.</span>upcase</div>
<div class="blank-line">&nbsp;</div>
<div class="comment"># Output "I *love* Ruby"</div>

<div class="comment"># five times</div>
<div><span class="numeric">5</span><span class="op">.</span>times
<span class="op">{</span> puts say <span class="op">}</span></div>

</div>

--
Felipe Contreras

 
Reply With Quote
 
 
 
 
akbarhome
Guest
Posts: n/a
 
      05-07-2007
On May 7, 3:58 pm, "Felipe Contreras" <felipe.contre...@gmail.com>
wrote:
> Hi,
>
> Does anyone knows how all that beautiful HTML formated Ruby code on
> ruby-lang.org is generated?
>
> Like this:
>
> <div id="code">
>
> <div class="comment"># Output "I love Ruby"</div>
> <div>say <span class="op">=</span> <span class="string">"I love
> Ruby"</span></div>
> <div>puts say</div>
> <div class="blank-line">&nbsp;</div>
> <div class="comment"># Output "I *LOVE* RUBY"</div>
>
> <div>say<span class="op">[</span><span
> class="string">'love'</span><span class="op">]</span> = <span
> class="string">"*love*"</span></div>
> <div>puts say<span class="op">.</span>upcase</div>
> <div class="blank-line">&nbsp;</div>
> <div class="comment"># Output "I *love* Ruby"</div>
>
> <div class="comment"># five times</div>
> <div><span class="numeric">5</span><span class="op">.</span>times
> <span class="op">{</span> puts say <span class="op">}</span></div>
>
> </div>
>
> --
> Felipe Contreras


My guess is they make it manually. If not, it is a part of RadiantCMS
project that they use it.

 
Reply With Quote
 
 
 
 
James Edward Gray II
Guest
Posts: n/a
 
      05-07-2007
On May 7, 2007, at 3:58 AM, Felipe Contreras wrote:

> Does anyone knows how all that beautiful HTML formated Ruby code on
> ruby-lang.org is generated?


I've hand edited most of the code on that site for various reasons,
but TextMate can be used to generate HTML pretty close to it. The
site's syntax coloring has been made into a TextMate theme called
Ruby Blue:

http://wiseheartdesign.com/2006/03/1...textmate-theme

When you have code open with that theme on, you can use commands in
the TextMate bundle to convert it to HTML.

James Edward Gray II

 
Reply With Quote
 
Gregory Seidman
Guest
Posts: n/a
 
      05-07-2007
On Mon, May 07, 2007 at 05:58:05PM +0900, Felipe Contreras wrote:
> Hi,
>
> Does anyone knows how all that beautiful HTML formated Ruby code on
> ruby-lang.org is generated?

[...]

I don't know exactly how they do it, but I wrote up how I do it here:

http://redcorundum.blogspot.com/2006...-coloring.html

> Felipe Contreras

--Greg


 
Reply With Quote
 
Daniel Leidisch
Guest
Posts: n/a
 
      05-07-2007
Felipe Contreras <> wrote on Mon, May 07, 2007 at 05:58:05PM +0900:
> Hi,
>
> Does anyone knows how all that beautiful HTML formated Ruby code on
> ruby-lang.org is generated?


I don't know how they did it, but you can run

:so $VIMRUNTIME/syntax/2html.vim

from inside vim and have all the available color themes output as
HTML. In Emacs I use htmlize.el. Another option would be highlight,
which is run from the command line.



 
Reply With Quote
 
Jeremy Hinegardner
Guest
Posts: n/a
 
      05-07-2007
On Mon, May 07, 2007 at 05:58:05PM +0900, Felipe Contreras wrote:
> Hi,
>
> Does anyone knows how all that beautiful HTML formated Ruby code on
> ruby-lang.org is generated?


You could also try CodeRay http://coderay.rubychan.de/

enjoy,

-jeremy

--
================================================== ======================
Jeremy Hinegardner


 
Reply With Quote
 
Felipe Contreras
Guest
Posts: n/a
 
      05-08-2007
On 5/7/07, James Edward Gray II <> wrote:
> On May 7, 2007, at 3:58 AM, Felipe Contreras wrote:
>
> > Does anyone knows how all that beautiful HTML formated Ruby code on
> > ruby-lang.org is generated?

>
> I've hand edited most of the code on that site for various reasons,
> but TextMate can be used to generate HTML pretty close to it. The
> site's syntax coloring has been made into a TextMate theme called
> Ruby Blue:
>
> http://wiseheartdesign.com/2006/03/1...textmate-theme
>
> When you have code open with that theme on, you can use commands in
> the TextMate bundle to convert it to HTML.


Thanks!

Unfortunately I don't have TextMate since I'm on Linux.

I really really like VIM, but I'm starting to feel it has a lot of shortcomings.

Hmm, maybe some Ruby extensions inside VIM is just what I need...

/me drools

--
Felipe Contreras

 
Reply With Quote
 
come
Guest
Posts: n/a
 
      05-09-2007
Hi,

For my HTML output, I use the ScreenShot plugin with vim. It comes
with the "TOhtml" command which produce an HTML output on my windows
computer. It should works on Linux, too.

The output looks like this :
<pre>
search_engines =
<font color="#6a5acd">%w[</font><font color="#ff00ff">Google Yahoo
MSN</font><font color="#6a5acd">]</font>.map <font
color="#804040"><b>do</b></font> |<font color="#008080">engine</font>|
<font color="#6a5acd">&quot;</font><font color="#ff00ff"><a
href="http://www.">http://www.</a></font><font color="#6a5acd">&quot;</
font> + engine.downcase + <font color="#6a5acd">&quot;</font><font
color="#ff00ff">.com</font><font color="#6a5acd">&quot;</font>
<font color="#804040"><b>end</b></font>
</pre>

For my output on doc Word, It is possible to insert HTML output, but
SciTE has a "Copy to RTF" command which is a litte faster.

Come

On 7 mai, 10:58, "Felipe Contreras" <felipe.contre...@gmail.com>
wrote:
> Hi,
>
> Does anyone knows how all that beautiful HTML formated Ruby code on
> ruby-lang.org is generated?
>


 
Reply With Quote
 
Phrogz
Guest
Posts: n/a
 
      05-09-2007
On May 7, 3:34 pm, Jeremy Hinegardner <jer...@hinegardner.org> wrote:
> You could also try CodeRayhttp://coderay.rubychan.de/


I've been wanting to write a Lua scanner for CodeRay, but haven't been
able (in mere minutes of exploration) to figure out where to begin.
Has anyone worked with CodeRay as a language author, and could provide
some tips/webpages/articles/documentation on how to write a plugin for
a new language for it?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert UNIX formated text files to DOS formated? walterbyrd Python 13 05-13-2009 02:32 PM
javascript and poorly formated html hswerdfe Javascript 1 10-28-2005 10:24 PM
Component to display formated source code Mike Allen ASP .Net 3 10-24-2005 05:02 AM
string to formated datetime Alejandro Penate-Diaz ASP .Net 2 03-11-2005 03:04 PM
Display Data in a "Formated Excel Form" ? Ben ASP .Net 0 06-27-2003 04:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57