add validation to build process (better late than never)

This commit is contained in:
Mark Pilgrim
2009-10-07 11:10:32 -04:00
parent b02b14a3ab
commit 40d917c9b3
3 changed files with 22 additions and 1 deletions
+5
View File
@@ -25,6 +25,11 @@ rm -f examples/*.pyc
cp -R examples build/
cp .htaccess build/
echo "validating HTML"
for f in *.html; do
python3 util/validate.py "$f" > /dev/null || die "Failed to validate $f"
done
echo "building HTML distribution"
htmlbasedir=diveintopython3-r"$revision"-"$today"
htmldir=build/"$htmlbasedir"
-1
View File
@@ -84,7 +84,6 @@ body{counter-reset:h1 5}
</ul>
<p>The following are some general rules for constructing Roman numerals:
<ul>
<ol>
<li>Sometimes characters are additive. <code>I</code> is <code>1</code>, <code>II</code> is <code>2</code>, and <code>III</code> is <code>3</code>. <code>VI</code> is <code>6</code> (literally, &#8220;<code>5</code> and <code>1</code>&#8221;), <code>VII</code> is <code>7</code>, and <code>VIII</code> is <code>8</code>.
<li>The tens characters (<code>I</code>, <code>X</code>, <code>C</code>, and <code>M</code>) can be repeated up to three times. At <code>4</code>, you need to subtract from the next highest fives character. You can't represent <code>4</code> as <code>IIII</code>; instead, it is represented as <code>IV</code> (&#8220;<code>1</code> less than <code>5</code>&#8221;). <code>40</code> is written as <code>XL</code> (&#8220;<code>10</code> less than <code>50</code>&#8221;), <code>41</code> as <code>XLI</code>, <code>42</code> as <code>XLII</code>, <code>43</code> as <code>XLIII</code>, and then <code>44</code> as <code>XLIV</code> (&#8220;<code>10</code> less than <code>50</code>, then <code>1</code> less than <code>5</code>&#8221;).
<li>Sometimes characters are&hellip; the opposite of additive. By putting certain characters before others, you subtract from the final value. For example, at <code>9</code>, you need to subtract from the next highest tens character: <code>8</code> is <code>VIII</code>, but <code>9</code> is <code>IX</code> (&#8220;<code>1</code> less than <code>10</code>&#8221;), not <code>VIIII</code> (since the <code>I</code> character can not be repeated four times). <code>90</code> is <code>XC</code>, <code>900</code> is <code>CM</code>.
+17
View File
@@ -0,0 +1,17 @@
import sys
try:
import html5lib
except ImportError:
sys.path.insert(0, '/Users/pilgrim/code/html5lib/python3/src/')
import html5lib
input_filename = sys.argv[1]
parser = html5lib.HTMLParser()
with open(input_filename, encoding='utf-8') as stream:
data = stream.read()
html5doc = parser.parse(data, encoding='utf-8')
if parser.errors:
for ((line, column), errtype, params) in parser.errors:
print("Error: {} {} on line {} of {}".format(errtype, repr(params), line, input_filename), file=sys.stderr)
sys.exit(1)