Note: I have started this project primarily to validate the html generated by asciidoctor
, but noticed that asciidoctor
v1.5.6 and later implements the -v
switch to provide build-time validation. See official documentation
This simple script provides function to validate internal link in html.
-
Download this script
-
Import
-
Just use.
Here's a example usage.$ git clone https://github.com/kkimurak/vasil-sh.git $ cd vasil-sh $ tree . ├── README.md ├── test | └── sample.html └── vasil.sh 1 directory, 3 files $ vasil.sh test/sample.html $ echo $? 5
Note that offset is added to returning value if at least one invalid link found, to avoid conflict with other error message (e.g. 2 means "no such file").
Please refer variablevasil_return_offset
.You can set VASIL_DEBUG=true to see debug message
$ VASIL_DEBUG=true sh vasil.sh test/sample.html link "invalid_link" is invalid link "link containing white space" is invalid 2 invalid link found
If you want to import function using
source
, setVASIL_USE_AS_FUNCTION
totrue
and then do that.
source
is not specified in POSIX, so I'm not sure if it works for you.
It works on my Fedora, but not works on Travis.$ VASIL_USE_AS_FUNCTION=true $ source vasil.sh && vasil_main test/sample.html $ echo $? 5
k.kimura (@kkimurak)