disabled many plugins
This commit is contained in:
parent
0ba2001b62
commit
7cce9bf27e
119 changed files with 0 additions and 20 deletions
26
disabled_stuff/validate.py
Normal file
26
disabled_stuff/validate.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
"""
|
||||
Runs a given url through the w3c validator
|
||||
|
||||
by Vladi
|
||||
"""
|
||||
|
||||
from util import hook, http
|
||||
|
||||
|
||||
@hook.command('w3c')
|
||||
@hook.command
|
||||
def validate(inp):
|
||||
"""validate <url> -- Runs url through the w3c markup validator."""
|
||||
|
||||
if not inp.startswith('http://'):
|
||||
inp = 'http://' + inp
|
||||
|
||||
url = 'http://validator.w3.org/check?uri=' + http.quote_plus(inp)
|
||||
info = dict(http.open(url).info())
|
||||
|
||||
status = info['x-w3c-validator-status'].lower()
|
||||
if status in ("valid", "invalid"):
|
||||
error_count = info['x-w3c-validator-errors']
|
||||
warning_count = info['x-w3c-validator-warnings']
|
||||
return "{} was found to be {} with {} errors and {} warnings." \
|
||||
" see: {}".format(inp, status, error_count, warning_count, url)
|
Reference in a new issue