Uniform CSS Validator

Author: Dan Connolly, W3C

CSS syntax evolves in a backward- and forward-compatible way; the CSS 2.1 specification includes a uniform grammar, applicable to all CSS versions. The original (2002) W3C CSS Validator predates this uniform grammar and maintenance is becoming an undue burden as a result. This is an attempt to build a validator using the uniform syntax.

This is also something of an exercise in learning Scala development. Provided you have some popular tools installed (see Scala development below for details), you should be able to confirm that all tests pass:

cssval$ sbt test
...
[info] Run: 6, Passed: 6, Errors: 0, Failed: 0
...

Contents

Scala development

Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way.

Introducing Scala

The compiler and such are open source and easy to find from the Scala Programming Language site.

For audit trail purposes, the md5 checksum of the package I downloaded is:

82934acf64d0c026de78b84e984f6743  scala-2.7.6.final.tgz

Once you download and unpack that, you should be able to see that interpreter and compiler work as per Getting Started with Scala.

Simple Build Tool (sbt)

The Scala tribe seems to use sbt in place of make or ant.

Audit trail:

MD5 (sbt-launcher-0.5.5.jar) = e3593448b3be17ce1666c6241b8d2f90

The directory layout of this project follows sbt/maven conventions:

src/
  main/
    resources/
       <files to include in main jar here>
    scala/
       <main Scala sources>
    java/
       <main Java sources>
  test/
    resources
       <files to include in test jar here>
    scala/
       <test Scala sources>
    java/
       <test Java sources>

I haven't mastered library management; I just copied .jar files into some lib directories until things started working.

ScalaTest

ScalaTest is a leading test framework for Scala.

Audit trail:

68ab03f9109ef18c9dcce048da3d8dab  scalatest-0.9.5.zip

I unpacked it and put scala-test-1.0.jar in lib... or was it project/boot/scala-2.7.6/lib.

There seem to be some version skew issues between sbt and ScalaTest. For a work-around (that I have not yet tried), see: ScalaTest 1.0.

Emacs and Scala

With scala-mode, emacs helps with indentation and syntax coloring. With sbt.el, emacs can navigate compiler errors (with some glitches). My set-up is pretty rough; some notes:

;;;
; http://www.scala-lang.org/downloads
(add-to-list 'load-path "/home/connolly/src/scala-2.7.6.final/misc/scala-tool-support/emacs")
(add-to-list 'exec-path "/home/connolly/src/scala-2.7.6.final/bin")
(add-to-list 'exec-path "/home/connolly/bin")
(require 'scala-mode-auto)

http://code.google.com/p/simple-build-tool/wiki/IntegrationSupport
scallap / tools / emacs / sbt.el
commit  000e748597d9b73e2da026029afc4ca9248aa936

Version Control

Project history is available on bitbucket in a cssval mercurial/hg repository, whose original revision is 0:4ac7bd6d32f2.

hmm... only a handful of commits in the bitbucket world in the last week. Looked at moving to google code hosting... found some interesting CSS parsing projects there.

Open Source Software License

Copyright (c) 2009 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. This work is distributed under the W3C Software License in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Share and enjoy.

This license has an Open Source Initiative certification and is a GPL-Compatible Free Software License.

Colophon

This document is written using reStructuredText conventions.