Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 43b248a28e
Fetching contributors…

Cannot retrieve contributors at this time

executable file 17 lines (12 sloc) 0.549 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/env python

#
# Extract completions from CSS 2 plain text spec
#
# http://www.w3.org/TR/2011/REC-CSS2-20110607/css2.txt
#

import re, sys

css2 = sys.stdin.read()

reject_re = re.compile("[<>\\[\\]]")

for match in re.finditer("'(?P<property>[a-zA-Z-]+)'\\s+Value:\\s+(?P<values>.*?)Initial", css2, re.MULTILINE|re.DOTALL):
    if match.group(1) != 'property-name':
        print "(%s . [%s])" % (match.group(1), " ".join([ option.strip() for option in match.group(2).split("|") if not reject_re.search(option) and len(option) > 0 ]))
Something went wrong with that request. Please try again.