22# Extract entries from the CSS properties database
33# The database has the following format:
44# name;; values;; initial-value;; applies-to;;
5- # inherited;; percentages;; media;; CSS-level
5+ # inherited;; percentages;; media;; computed value
66# Special characters:
77# 1) Translate "*" into the words "all elements"
88# 1.a) Translate "XX" into "not defined for shorthand properties"
1313# <span class="propinst-name"><'name'></span>
1414#
1515# Ian Jacobs - ij@w3.org (Based on work by Arnaud Le Hors)
16- # $Id: pextr,v 1.22 2002-08-21 12:45:29 bbos Exp $
16+ # $Id: pextr,v 1.23 2002-11-18 20:36:16 bbos Exp $
1717#
1818
1919$PROGNAME = substr ($0 , rindex ($0 , " /" ) + 1);
2020
2121if (!$ARGV [0]) {
22- print " Usage: $PROGNAME [-l level] file [tgt_dir]\n " ;
22+ print " Usage: $PROGNAME file [tgt_dir]\n " ;
2323 exit 1;
2424}
2525
26- $level = " 2" ;
27-
28- while ($ARGV [0] =~ / ^-/ ) {
29- if ($ARGV [0] eq " -l" && $ARGV [1]) {
30- shift ;
31- $level = shift ;
32- } else {
33- print " Usage: $PROGNAME [-l level] file tgt_dir]\n " ;
34- }
35- }
36-
3726# copy file in memory
3827if (!open (input, $ARGV [0])) {
3928 print " $PROGNAME Error: Cannot open file: $ARGV [0]\n " ;
@@ -64,6 +53,7 @@ my $applies = $_[3];
6453my $inherited = $_ [4];
6554my $percentages = $_ [5];
6655my $media = $_ [6];
56+ my $compval = $_ [7];
6757# Do next three lines in src files to get headings right.
6858print output " <div class=\" propdef\" >\n " ;
6959print output " <dl><dt>\n " ;
@@ -84,6 +74,7 @@ print output "<table class=\"propinfo\" cellspacing=0 cellpadding=0>\n";
8474&format_inherited($inherited );
8575&format_percentages($percentages );
8676&format_media($media );
77+ &format_compval($compval );
8778print output " </table>\n " ;
8879print output " </dl>\n " ;
8980print output " </div>\n\n " ;
@@ -155,29 +146,38 @@ sub format_media {
155146 print output " <td>$fmedia \n " ;
156147}
157148
149+ sub format_compval {
150+ print output " <tr valign=baseline>" ;
151+ print output " <td><em>Computed value:</em> " ;
152+ print output " <td>$_ [0]\n " ;
153+ }
154+
158155
159156# extract every possible block
160157$_ = $buf ;
161- while (/ $blockst$patt ;;$patt ;;$patt ;;$patt ;;$patt ;;$patt ;;$patt ;;$patt$blocket /s ) {
158+ while (/ $blockst (?:.*?)$blocket /s ) {
159+ $placeholder = $' ;
160+ my $h = $& ;
161+ if ($h =~ / $blockst$patt ;;$patt ;;$patt ;;$patt ;;$patt ;;$patt ;;$patt ;;$patt$blocket /s ) {
162162 # Set parameters first (before any modifications)
163- $placeholder = $' ;
164163 my $props = $1 ;
165164 my $values = $2 ;
166165 my $init = $3 ;
167166 my $applies = $4 ;
168167 my $inherited = $5 ;
169168 my $percentage = $6 ;
170169 my $media = $7 ;
171- my $lvl = $8 ;
170+ my $compval = $8 ;
172171 my @names = split (/ [, \t\n ]+/ , $props );
173172 my $name = $names [0];
174- if ($lvl =~ / \b $level \b / ) {
175- $output = " $path$name .srb" ;
176- print " \t extracting $output \n " ;
177- open (output, " > $output " );
178- &format_property($props , $values , $init , $applies , $inherited ,
179- $percentage , $media );
180- close (output);
181- }
182- $_ = $placeholder ;
173+ $output = " $path$name .srb" ;
174+ print " \t extracting $output \n " ;
175+ open (output, " > $output " );
176+ &format_property($props , $values , $init , $applies , $inherited ,
177+ $percentage , $media , $compval );
178+ close (output);
179+ } else {
180+ warn " Incorrect syntax for property definition: $h \n " ;
181+ }
182+ $_ = $placeholder ;
183183}
0 commit comments