doc01.gms : runs linkchecker on offline documentation

Description

Run's a linkchecker on the documentation in %gams.sysdir%/docs.

Contributor: Jarungjit Parnjai, Stefan Vigerske, May 2015


Small Model of Type : GAMS


Category : GAMS Test library


Main file : doc01.gms

$title runs linkchecker on offline documentation (DOC01,SEQ=681)

$ontext
Run's a linkchecker on the documentation in %gams.sysdir%/docs.

Contributor: Jarungjit Parnjai, Stefan Vigerske, May 2015
$offtext


* run only on systems where linkchecker is available
$call sh -c "which linkchecker"
$if errorlevel 1 $abort.noerror 'no linkchecker available'

* checking links to external webpages takes times and is error prone, do this only on anton in licensed builds for now
$set checkextern 0
$if not set DEMOSIZE $if %sysenv.GHOST% == anton.gams.com $set checkextern 1

$set ignore
$if NOT %system.isAlphaBeta% == 0 $set ignore ^https://www.gams.com/%sysenv.DIST%

* 2020-06-26: skip https://www.scipopt.org because of SSL certification issues
$onecho > linkcheckerrc
[filtering]
checkextern = %checkextern%
ignore = %ignore%
  ^http://doi.org
  ^http://www.amazon.com
  ^https://www.amazon.com
  ^https://www.scipopt.org
nofollow =

[output]
status = 0
fileoutput = html
$offecho

* call linkchecker for docs and model libraries
* on Mac OS X, the docs are not in sysdir anymore, but in  ../../../Resources/docs
$if     dexist '%gams.sysdir%../../../Resources/docs' $call sh -c "linkchecker -flinkcheckerrc '%gams.sysdir%../../../Resources/docs/index.html' '%gams.sysdir%'../../../Resources/*_ml/libhtml/index.html"
$if not dexist '%gams.sysdir%../../../Resources/docs' $call sh -c "linkchecker -flinkcheckerrc '%gams.sysdir%docs/index.html' '%gams.sysdir%'/*_ml/libhtml/index.html"

$if errorlevel 1 $abort 'broken links in docu, inspect linkchecker-out.html'