Re: [idea] cssdiff

Hi Karl, all

I still like the idea of a css diff tool. Spending a bit of time now  
and then researching solutions.

On 23-Jan-09, at 3:24 PM, olivier Thereaux wrote:
> What you need is:
>
> 1) a CSS parser. Ideally somewhat fault tolerant, at least tolerant  
> to a good number of typos

python: http://code.google.com/p/cssutils/
perl: http://search.cpan.org/~bjoern/CSS-SAC-0.06/SAC.pm
java: http://dev.w3.org/cvsweb/2002/css-validator/org/w3c/css/parser/

I looked at javascript parsers too, since there is also an ongoing  
discussion about that idea.
So far I found a couple of tentative projects:
http://youngisrael-stl.org/wordpress/2007/10/19/css-parser-in-javascript/
http://www.senocular.com/index.php?id=1.289
... worth testing. I think I'll play with both this week.

> 2) your parser should be able to serialize what it parsed in a  
> normalized way. (whatever the normalization)
>
> 3) diff on the above. Voila!


Note that python has a fairly advanced diff lib.
http://docs.python.org/library/difflib.html
… and in an effort to not reinvent the wheel, note that open source  
project viewvc has both some source diff and syntax highlighting  
capabilities. The highlighting is done with http://pygments.org/ lib.

-- 
olivier

Received on Monday, 9 February 2009 16:16:32 UTC