Last active
December 18, 2015 23:49
-
-
Save marucc/5864647 to your computer and use it in GitHub Desktop.
html5のチェック
html5libを入れている環境でworkonしておくこと。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
import os | |
import sys | |
from html5lib import HTMLParser | |
argvs = sys.argv | |
argc = len(argvs) | |
if (argc != 2): | |
print 'Usage: # python %s filename' % argvs[0] | |
quit() | |
print 'html validate check %s ...' % argvs[1] | |
f = open(argvs[1]) | |
html = f.read() | |
f.close | |
parser = HTMLParser() | |
doc = parser.parse(html) | |
errors = parser.errors | |
if len(errors): | |
print 'ERROR' | |
print errors | |
sys.exit(1) | |
else: | |
print 'OK' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ls *.html | xargs -n 1 ./html5_validator.py
とかで実行