diff --git a/.CI/checkHTMLDoc/checkLinks.py b/.CI/checkHTMLDoc/checkLinks.py index a5757bf..7e222db 100644 --- a/.CI/checkHTMLDoc/checkLinks.py +++ b/.CI/checkHTMLDoc/checkLinks.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- ''' -Copyright (C) 2020-2022, Modelica Association and contributors +Copyright (C) 2020-2026, Modelica Association and contributors All rights reserved. Check Modelica HTML documentation for link validity @@ -19,8 +19,11 @@ from concurrent.futures import ProcessPoolExecutor as PoolExecutor # See https://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx/ -PATTERN = re.compile(r'\s]+))?)+\s*|\s*)/?>', +PATTERN = re.compile( + r'\s]+))?)+\s*|\s*)/?>', re.IGNORECASE) +# DOI-Regex: http(s)://doi.org/... (incl. possible suffixes such as #, ?, etc.) +DOI_PATTERN = re.compile(r'^https?:[a-z.-]*//doi\.org/', re.IGNORECASE) def _getFileURLs(file_name): urls = [] @@ -56,7 +59,9 @@ def _checkURL(url): rc = urllib2.urlopen(url).getcode() return (url, rc) except: - pass + if DOI_PATTERN.match(url): + print("WARNING: Skip DOI-Link (per design, because of persistency): {url}") + return (url, 200) try: headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'} rc = urllib2.urlopen(urllib2.Request(url, None, headers), context=ssl._create_unverified_context()).getcode()