Closed Lucas-C closed 8 years ago
Nope.
Adding a os.chdir(os.path.dirname(self.vnu_jar_location))
before line 83 did not change a thing:
https://github.com/svenkreiss/html5validator/blob/master/html5validator/validator.py#L83
Some more findings:
vnu.jar
passed to java -jar
is an absolute oneIn Cygwin, converting the absolute Unix paths to Windows ones fixes the problem:
$ java -jar "$(cygpath -w /home/lucas_cimon/.pre-commit/repor9ky908h/py_env-default/lib/python3.4/site-packages/vnujar/vnu.jar)" "$(cygpath -w /home/lucas_cimon/vignette.hbs)"
I submitted a PR with a suggestion for fix. I tested it, it fixes my initial issue.
@Lucas-C can you tell me how did you fix
"file:/G:/.../vignette.hbs":1.1-2.72: error: Bad value “{{offer.url}}” for attribute “href” on element “a”: Illegal character in path segment: “{” is not allowed.
i use template engines so it is throwing same error to me aswell.
I implemented various strategies to remove mustaches in my git pre-commit
hook:
https://github.com/Lucas-C/pre-commit-hooks-java/blob/master/pre_commit_hooks/validate_html.py#L33
ok.... I use laravel with blade syntax, so finally i had to use it like this
- html5validator --root resources/views/ --match "*.blade.php" --blacklist node_modules vendors src --ignore-re 'Bad value "{{\s?asset|route|url(.*?)\s?}}" for attribute "href|src" on element "link|script|img|a"' 'Bad value "{{\s?asset|route|url(.*?)\s?}}" for attribute "action" on element "form"' 'Bad value "{{\s?URL::to(.*?)\s?}}" for attribute "action" on element "form"' 'Non-space characters found without seeing a doctype first. Expected "<!DOCTYPE html>"' 'Element "head" is missing a required instance of child element "title"'
Hello,
I'm trying to write a pre-commit hook to do some HTML validation using your lib: https://github.com/Lucas-C/pre-commit-hooks/commit/2916a991f2d2d838dc4931a442d68af58ac73d68
However I'm facing this error when using
html5validator.validator.Validator
:I replicated this issue by invoking the command directly:
Note that I'm working under Windows with Cygwin. A StackOverflow answer to this issue suggested to move the jar in my current directory, and it does work when I invoke it manually:
Would you have any explanation for this strange problem ? I'm going to try to modify
html5validator/validator.py
locally to change the current directory before the.jar
invocation.