John J Lee | 4 Aug 2006 00:05
Picon
Favicon

ReST syntax for colourizing source?

What's the best reST syntax to use when you want colourized (Python) 
source code in your HTML output?

I have two cases:

1. Inline source.  Would it be normal to use a directive here, or to just
    use a normal indented block after a "::" (reimplementing or extending
    rst2html as necessary)?

2. Source from an external file.

I notice rest2web has a colorize "macro" to handle case 2., but not sure 
if that's part of reST proper.

Any examples of code to implement "similar" things would be appreciated 
too.

TIA

John

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
John J Lee | 4 Aug 2006 00:13
Picon
Favicon

Re: ReST syntax for colourizing source?

On Thu, 3 Aug 2006, John J Lee wrote:
[...]
> Any examples of code to implement "similar" things would be appreciated
> too.

Hmm, that's not clear.  I'm talking there about extending / reimplementing 
(parts of) rst2html so that it will do colorized output.  I've already got 
code to render Python source code colorized to HTML, so I don't need help 
with that.

The main question remains about the syntax to use, not the implementation.

John

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Michael Foord | 4 Aug 2006 00:19
Picon
Favicon
Gravatar

Re: ReST syntax for colourizing source?

John J Lee wrote:
> What's the best reST syntax to use when you want colourized (Python) 
> source code in your HTML output?
>
> I have two cases:
>
> 1. Inline source.  Would it be normal to use a directive here, or to just
>     use a normal indented block after a "::" (reimplementing or extending
>     rst2html as necessary)?
>
> 2. Source from an external file.
>
>
> I notice rest2web has a colorize "macro" to handle case 2., but not sure 
> if that's part of reST proper.
>
>   
rest2web can also colorize Python code included in a source file, and 
with the use of the raw role could probably be used for inline source :

.. raw:: html

    {+coloring}
    print 'something'
    # etc...
    {-coloring}

or :raw:`{+coloring}print 'something'{-coloring}` (or whatever the 
correct syntax is for roles).

(Continue reading)

Michael Foord | 6 Aug 2006 23:31
Picon
Favicon
Gravatar

Rest2web - 0.5.0 Beta 1

Hello all,

After five months there is finally a new release of `rest2web 
<http://www.voidspace.org.uk/python/rest2web/>`_. This is **0.5.0 Beta 1**.

There are an awful lot of changes and improvements, but there shouldn't 
be any backward compatibility issues with previous versions.

* `rest2web 0.5.0Beta1 zip 
<http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?file=rest2web-0.5.0beta1.zip>`_
* `rest2web 0.5.0Beta1 tar.gz 
<http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?file=rest2web-0.5.0beta1.tar.gz>`_

One of the best changes, is the addition of a new `Quickstart Guide 
<http://www.voidspace.org.uk/python/rest2web/quickstart.html>`_ by 
*Andrew Ittner*.

What is rest2web ?
=============

**rest2web** is a tool that generates html files for websites, parts of 
websites, or project documentation. It allows you to keep your page 
content in `ReST <http://docutils.sourceforge.net>`_ format, and has a 
simple but flexible templating system.

It can automatically build index pages, 'breadcrumbs' and sidebars for 
your site. By providing access to a data-structures that represents your 
site (for example `indextree and thispage 
<http://www.voidspace.org.uk/python/rest2web/reference/indextree.html>`_), 
you can easily build in extra functionality.
(Continue reading)

Martin Blais | 8 Aug 2006 05:08
Picon
Gravatar

Re: generating websites from RST content

On 7/26/06, martin f krafft <madduck <at> madduck.net> wrote:
> I am through with CMS systems and hacking Makefiles to turn RST
> stuff into plain websites! From now on I'd like to maintain RST
> files and templates in version control and delegate the tool of
> generating integrated websites to some smart tool.

Here is a related idea that has been on my backburner for quite a
while and that has a high number in the bang-for-the-buck category
(little effort, very useful):  implement a little buddy script to
buildhtml.py that recursively processes HTML files in a filesystem
hierarchy, and that inserts a breadcrumbs DIV right after the body
tag.  This should work with the output of buildhtml.py, but also with
any valid HTML file (i.e. it does not have to be a docutils tool as
such).  The  breadcrumbs should use the <title> tags from the html
files, and directories should have simple indexes automatically
created for them, using those titles.

It may not look so great, but oh so how many times I needed to roll
out a large set of HTML files to be viewed by friends or a client, and
I did not need anything fancy, but I needed to be able to click around
the set of files (breadcrumbs would have been good enough).  I want no
templates, no dependencies (just HTML should work) and to be able to
somehow navigate to all files by just clicking.  I'n not sure but I
think you want a templates.

(I wish I could hack this now, where has all my time gone?)
cheers,

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
(Continue reading)

Martin Blais | 8 Aug 2006 05:10
Picon
Gravatar

Re: generating websites from RST content

On 8/7/06, Martin Blais <blais <at> furius.ca> wrote:
> On 7/26/06, martin f krafft <madduck <at> madduck.net> wrote:
> > I am through with CMS systems and hacking Makefiles to turn RST
> > stuff into plain websites! From now on I'd like to maintain RST
> > files and templates in version control and delegate the tool of
> > generating integrated websites to some smart tool.
>
> Here is a related idea that has been on my backburner for quite a

Oh and it should **just work**.  Like, no options, e.g.

  buildhtml.py
  crumbit

voila.  To avoid the problem of selecting alternate filenames for the
generated files, perhaps writing a little better version of
buildhtml.py would be more reasonable.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
martin f krafft | 8 Aug 2006 11:35

Re: generating websites from RST content

also sprach Martin Blais <blais <at> furius.ca> [2006.08.08.0408 +0100]:
> hierarchy, and that inserts a breadcrumbs DIV right after the body
> tag.

Why after the body tag?

> It may not look so great, but oh so how many times I needed to roll
> out a large set of HTML files to be viewed by friends or a client, and
> I did not need anything fancy, but I needed to be able to click around
> the set of files (breadcrumbs would have been good enough).  I want no
> templates, no dependencies (just HTML should work) and to be able to
> somehow navigate to all files by just clicking.  I'n not sure but I
> think you want a templates.

Check out rest2web. It's dead simple.

--

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net <at> madduck

spamtraps: madduck.bogus <at> madduck.net

"courage is not the absence of fear, but the decision
 that something else is more important than fear."
                                                  -- ambrose redmoon
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
(Continue reading)

Fuzzyman | 8 Aug 2006 11:39
Picon
Favicon
Gravatar

Re: generating websites from RST content

Martin Blais wrote:

>On 7/26/06, martin f krafft <madduck <at> madduck.net> wrote:
>  
>
>>I am through with CMS systems and hacking Makefiles to turn RST
>>stuff into plain websites! From now on I'd like to maintain RST
>>files and templates in version control and delegate the tool of
>>generating integrated websites to some smart tool.
>>    
>>
>
>Here is a related idea that has been on my backburner for quite a
>while and that has a high number in the bang-for-the-buck category
>(little effort, very useful):  implement a little buddy script to
>buildhtml.py that recursively processes HTML files in a filesystem
>hierarchy, and that inserts a breadcrumbs DIV right after the body
>tag.  This should work with the output of buildhtml.py, but also with
>any valid HTML file (i.e. it does not have to be a docutils tool as
>such).  The  breadcrumbs should use the <title> tags from the html
>files, and directories should have simple indexes automatically
>created for them, using those titles.
>
>It may not look so great, but oh so how many times I needed to roll
>out a large set of HTML files to be viewed by friends or a client, and
>I did not need anything fancy, but I needed to be able to click around
>the set of files (breadcrumbs would have been good enough).  I want no
>templates, no dependencies (just HTML should work) and to be able to
>somehow navigate to all files by just clicking.  I'n not sure but I
>think you want a templates.
(Continue reading)

Martin Blais | 11 Aug 2006 02:40
Picon
Gravatar

Re: generating websites from RST content

On 8/8/06, martin f krafft <madduck <at> madduck.net> wrote:
> also sprach Martin Blais <blais <at> furius.ca> [2006.08.08.0408 +0100]:
> > hierarchy, and that inserts a breadcrumbs DIV right after the body
> > tag.
>
> Why after the body tag?

Because it's simple.
Simple is good.
I love simple.
No templates, no b.s.

Often, simple is not pretty, but it works, and that has a lot more
value than eye candy IMO.  So a simple insertion of text right after
the body tag in a div should do a mighty fine job.  That's just a
suggestion though, you could do something more complicated, but IMO it
won't help much.

> > It may not look so great, but oh so how many times I needed to roll
> > out a large set of HTML files to be viewed by friends or a client, and
> > I did not need anything fancy, but I needed to be able to click around
> > the set of files (breadcrumbs would have been good enough).  I want no
> > templates, no dependencies (just HTML should work) and to be able to
> > somehow navigate to all files by just clicking.  I'n not sure but I
> > think you want a templates.
>
> Check out rest2web. It's dead simple.

I want to do this:

(Continue reading)

Michael Foord | 11 Aug 2006 15:41
Picon
Favicon
Gravatar

Re: generating websites from RST content

Martin Blais wrote:
> On 8/8/06, martin f krafft <madduck <at> madduck.net> wrote:
>   
>> also sprach Martin Blais <blais <at> furius.ca> [2006.08.08.0408 +0100]:
>>     
>>> hierarchy, and that inserts a breadcrumbs DIV right after the body
>>> tag.
>>>       
>> Why after the body tag?
>>     
>
> Because it's simple.
> Simple is good.
> I love simple.
> No templates, no b.s.
>
> Often, simple is not pretty, but it works, and that has a lot more
> value than eye candy IMO.  So a simple insertion of text right after
> the body tag in a div should do a mighty fine job.  That's just a
> suggestion though, you could do something more complicated, but IMO it
> won't help much.
>
>
>
>   
>>> It may not look so great, but oh so how many times I needed to roll
>>> out a large set of HTML files to be viewed by friends or a client, and
>>> I did not need anything fancy, but I needed to be able to click around
>>> the set of files (breadcrumbs would have been good enough).  I want no
>>> templates, no dependencies (just HTML should work) and to be able to
(Continue reading)


Gmane