diff --git a/README.md b/README.md index be15774..92d2e30 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # W3C validator for Holberton School -For HTML, CSS and SVG files +A script that checks the conformance of HTML, CSS, and SVG files against W3C standards. + +This fork enhances the original W3C-Validator by adding wildcard support, allowing you to validate multiple files at once. Based on 1 API: - [Markup Validator Web Service API](https://validator.w3.org/docs/api.html) @@ -11,7 +13,7 @@ Based on 1 API: ## Quickstart 1. Clone this repo ```sh -git clone https://github.com/holbertonschool/W3C-Validator.git +git clone https://github.com/uosyph/W3C-Validator.git ``` 2. Run the validator command from within @@ -32,6 +34,10 @@ Multiple files: ./w3c_validator.py index.html article.html css/styles.css ``` +```sh +./w3c_validator.py *.html css/*.css +``` + All errors are printed in `STDERR`; Exit status = # of errors (0 on success) ## Troubleshooting diff --git a/w3c_validator.py b/w3c_validator.py index ec7ec71..a7b2643 100755 --- a/w3c_validator.py +++ b/w3c_validator.py @@ -21,6 +21,10 @@ ./w3c_validator.py index.html header.html styles/common.css ``` +``` +./w3c_validator.py *.html styles/*.css +``` + All errors are printed in `STDERR` Return: @@ -29,6 +33,7 @@ import sys import requests import os +import glob def __print_stdout(msg): @@ -113,8 +118,10 @@ def __files_loop(): """Loop that analyses for each file from input arguments """ nb_errors = 0 - for file_path in sys.argv[1:]: - nb_errors += __analyse(file_path) + for pattern in sys.argv[1:]: + files = glob.glob(pattern) + for file_path in files: + nb_errors += __analyse(file_path) return nb_errors