Skip to content

Instantly share code, notes, and snippets.

@marucc
Last active December 18, 2015 23:49
Show Gist options
  • Save marucc/5864647 to your computer and use it in GitHub Desktop.
Save marucc/5864647 to your computer and use it in GitHub Desktop.
html5のチェック html5libを入れている環境でworkonしておくこと。
#!/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'
@marucc
Copy link
Author

marucc commented Jun 26, 2013

ls *.html | xargs -n 1 ./html5_validator.py
とかで実行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment