8000 Split the CLDR dependency into a quotes/ directory · Ritsyy/html-build@d1ae80a · GitHub
[go: up one dir, main page]

Skip to content

Commit d1ae80a

Browse files
committed
Split the CLDR dependency into a quotes/ directory
This fixes part of whatwg#62 by moving the generation of the quotes stylesheet, which is very slow, outside of the main build script. This also removes the dependency on svn and XML::Parser for the main build script. Fixes whatwg#24
1 parent fd13d3c commit d1ae80a

File tree

6 files changed

+258
-20
lines changed

6 files changed

+258
-20
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ This repository contains the tools and instructions necessary for building the [
66

77
Before building, make sure you have the following commands installed on your system.
88

9-
- `curl`, `egrep`, `git`, `grep`, `perl`, `svn`, `unzip`
10-
11-
You'll also need to have the Perl XML::Parser module installed on your system. It's not a "core" Perl module, so you may have to install it by doing one of the following to either get it using the perl `cpan install` command, or by getting the version packaged for your OS; for example;
12-
13-
- `cpan install XML::Parser`
14-
- `apt-get install libxml-parser-perl` (Ubuntu)
9+
- `curl`, `egrep`, `git`, `grep`, `perl`, `unzip`
1510

1611
## Build
1712

build.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,6 @@ else
198198
mkdir -p $HTML_CACHE
199199
fi
200200

201-
if [ ! -d $HTML_CACHE/cldr-data ]; then
202-
$QUIET || echo "Checking out CLDR (79 MB)..."
203-
svn $($VERBOSE && echo "-v") $($QUIET && echo "-q") \
204-
checkout http://www.unicode.org/repos/cldr/trunk/common/main/ $HTML_CACHE/cldr-data
205-
fi
206-
207-
$QUIET || echo "Examining CLDR (this takes a moment)...";
208-
if [ "$DO_UPDATE" == true ] && [ "`svn info -r HEAD $HTML_CACHE/cldr-data | grep -i "Last Changed Rev"`" != "`svn info $HTML_CACHE/cldr-data | grep -i "Last Changed Rev"`" -o ! -s $HTML_CACHE/cldr.inc ]; then
209-
$QUIET || echo "Updating CLDR..."
210-
svn $($QUIET && echo "-q") up $HTML_CACHE/cldr-data;
211-
perl -T .cldr-processor.pl $($QUIET && echo "--quiet") > $HTML_CACHE/cldr.inc;
212-
fi
213-
214201
if [ "$DO_UPDATE" == true ] || [ ! -f $HTML_CACHE/caniuse.json ]; then
215202
rm -f $HTML_CACHE/caniuse.json
216203
$QUIET || echo "Downloading caniuse data..."
@@ -232,6 +219,7 @@ $QUIET || echo "Generating spec..."
232219
$QUIET || echo
233220
cp -p entities/out/entities.inc $HTML_CACHE
234221
cp -p entities/out/entities-dtd.url $HTML_CACHE
222+
cp -p quotes/out/cldr.inc $HTML_CACHE
235223
perl .pre-process-main.pl $($QUIET && echo "--quiet") < $HTML_SOURCE/source > $HTML_TEMP/source-expanded-1
236224
perl .pre-process-annotate-attributes.pl < $HTML_TEMP/source-expanded-1 > $HTML_TEMP/source-expanded-2 # this one could be merged
237225
perl .pre-process-tag-omission.pl < $HTML_TEMP/source-expanded-2 | perl .pre-process-index-generator.pl > $HTML_TEMP/source-whatwg-complete # this one could be merged

quotes/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# HTML Quotes Generator
2+
3+
This directory contains the tools for generating HTML's [quotes stylesheet](https://html.spec.whatwg.org/#quotes).
4+
5+
## Prerequisites
6+
7+
Before building, make sure you have the following commands installed on your system.
8+
9+
- `perl`, `svn`
10+
11+
You'll also need to have the Perl XML::Parser module installed on your system. It's not a "core" Perl module, so you may have to install it by doing one of the following to either get it using the perl `cpan install` command, or by getting the version packaged for your OS; for example;
12+
13+
- `cpan install XML::Parser`
14+
- `apt-get install libxml-parser-perl` (Ubuntu)
15+
16+
## Build
17+
18+
Run the `build.sh` script, like this:
19+
```
20+
./build.sh
21+
```
22+
23+
## Input
24+
25+
- [CLDR data](http://www.unicode.org/repos/cldr/trunk/common/main/) (downloaded by `build.sh`)
26+
27+
## Output
28+
29+
- `cldr.inc`
30+
31+
Because the output is expected to change rarely, it is checked in. The top-level `build.sh` script uses this file directly.

quotes/build.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# cd to the directory containing this script
5+
cd "$( dirname "${BASH_SOURCE[0]}" )"
6+
7+
VERBOSE=false
8+
QUIET=false
9+
QUOTES_TEMP=${QUOTES_TEMP:-.temp}
10+
QUOTES_OUTPUT=${QUOTES_OUTPUT:-out}
11+
12+
for arg in "$@"
13+
do
14+
case $arg in
15+
-h|--help)
16+
echo "Usage: $0 [-h|--help]"
17+
echo "Usage: $0 [-q|--quiet] [-v|--verbose]"
18+
echo
19+
echo " -h|--help Show this usage statement."
20+
echo " -q|--quiet Don't emit any messages except errors/warnings."
21+
echo " -v|--verbose Show verbose output from every build step."
22+
exit 0
23+
;;
24+
-q|--quiet)
25+
QUIET=true
26+
VERBOSE=false
27+
;;
28+
-v|--verbose)
29+
VERBOSE=true
30+
QUIET=false
31+
set -vx
32+
;;
33+
*)
34+
;;
35+
esac
36+
done
37+
38+
rm -rf $QUOTES_TEMP && mkdir -p $QUOTES_TEMP
39+
rm -rf $QUOTES_OUTPUT && mkdir -p $QUOTES_OUTPUT
40+
41+
$QUIET || echo "Checking out CLDR (79 MB)..."
42+
svn $($VERBOSE && echo "-v") $($QUIET && echo "-q") \
43+
checkout http://www.unicode.org/repos/cldr/trunk/common/main/ $QUOTES_TEMP/cldr-data
44+
45+
$QUIET || echo "Generating quotes stylesheet..."
46+
perl -T cldr-processor.pl $($QUIET && echo "--quiet") \
47+
$QUOTES_TEMP/cldr-data/*.xml > $QUOTES_OUTPUT/cldr.inc;
48+
49+
rm -rf $QUOTES_TEMP

.cldr-processor.pl renamed to quotes/cldr-processor.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
use XML::Parser;
44

55
my $quiet = $ARGV[0] && '--quiet' eq "$ARGV[0]" ? 'true' : 'false';
6+
shift if $quiet eq 'true';
67

78
my $parser = XML::Parser->new(Style => 'Tree');
89

910
my $delimiters = {};
1011

11-
my @filenames = <$ENV{'HTML_CACHE'}/cldr-data/*.xml>;
12+
my @filenames = @ARGV;
1213
my $count = 0;
1314
for my $filename (@filenames) {
1415
$count += 1;

0 commit comments

Comments
 (0)
0