On Sun, Apr 26, 2009 at 7:03 PM, Aaron Watters <[email protected]> wrote:
>
> Hi Drew,
>
> Thanks for taking the time to read some of
> the WHIFF docs and for commenting.  You
> bring up a lot of points many of which indicate
> that the documentation is confusing and unclear
> in many places and I will try to address that
> in the documentation and by renaming some
> components.
>
> You are also correct that I'm not entirely sure
> that other solutions wouldn't work just as
> well or better.  This may be because of my
> ignorance or because I found *their* docs
> confusing and unclear.

This might be a fair statement with regard to some templating
libraries.  Since this is the pocoo-libs list, please take a look at
documentation for jinja where I don't think that would be a fair
statement:

http://jinja.pocoo.org/2/documentation/

Jinja templates are also extensible so you could achieve some of the
things you're trying to do just through lightweight extensions (or
custom filters, tests, etc.):

http://jinja.pocoo.org/2/documentation/extensions#module-jinja2.ext


>
> Let's take one example you mention:
>
> On Apr 23, 8:21 pm, Drew Smathers <[email protected]> wrote:
>> There's nothing special about being able to use pygments.  I can use
>> pygments easily in any python web framework.  You haven't convinced me
>> that WHIFF makes this easier somehow.
>
> Please consider the following whiff test page (simplified)
> which formats python code using pygments inside
> an html document:
>
> 1 {{env whiff.content_type: "text/html",
> 2     whiff.filter: false
> 3 /}}
> 4
> 5 <html>
> 6 <head>
> 7 <title>pygments test</title>
> 8 <style>
> 9 {{use-url "whiff_middleware/pygmentsCss"/}}
> 10 </style>
> 11 </head>
> 12 <body>
> 13
> 14 <h1>Some colorized python code</h1>
> 15
> 16 {{use-url "whiff_middleware/pygmentsColorize" pygmentsCss.lexer:
> "python"}}
> 17 # python code
> 18
> 19 def test():
> 20  app = pygmentsCss("className")
> 21  print "test output", app({}, misc.ignore)
> 22
> 23 if __name__=="__main__":
> 24   test()
> 25 {{/use-url}}
> 26
> 27 </body>
> 28 </html>
>
> The key action is lines 9-25 which delegate the
> colorization formatting to the pygments middleware.
>
> [unsimplified source at:
> http://aaron.oirt.rutgers.edu/myapp/root/showText?path=./misc/pygmentsTest
> formatted output at:
> http://aaron.oirt.rutgers.edu/myapp/root/misc/pygmentsTest ]
>
> To add a page to colorize code in any
> way supported by Pygments using WHIFF
> drop a file like this
> changing python to java or whatever
> into a WHIFF directory (after installing
> Pygments).
>
> How do you do it in other approaches?
>

I'm not going to go digging through past code (1-2 years ago) to show
you how I've done it, but I remember if taking about 10 minutes of my
time to get pygments integration in a pylons/genshi application - it
certainly didn't necessitate a separate framework.  Here's one example
(after some brief googling) of how it's done with MoinMoin:

http://pygments.org/docs/moinmoin/

Also, your approach seems cumbersome, because you're inlining the CSS
- why not take advantage of browser caching by putting this in
external stylesheets?

-Drew

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to