Skip to content
Snippets Groups Projects

Fix pattern matching for not linking to nightly classes

5 files
+ 33
17
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 20
11
@@ -447,18 +447,27 @@ def add_vtk_nightly_doc_link(s, stats):
:param stats: Statistics
:return:
"""
reg1 = re.compile(r'[^\.\/\[s\-?](vtk[^ &:\.][0-9a-zA-Z]+)')
# ? has been used to indicate that no link is to be built.
reg2 = re.compile(r'\?(vtk[0-9a-zA-Z\-]+)\?')
# This is the name of the repository.
repo_name = r'(vtk-examples)'
# ?...? has been used to indicate that no link is to be built.
no_link = r'[\?{1}](vtk[0-9a-zA-Z\-]+)[\?{1}]'
link = r'(vtk[^ &:\.\-][0-9a-zA-Z]+)'
reg1 = re.compile(repo_name)
reg2 = re.compile(no_link)
reg3 = re.compile(link)
if reg1.findall(s):
stats['doxy_count'] += 1
s1 = re.sub(r'[^\.\/\[s\-?](vtk[^ &:\.-][0-9a-zA-Z]+)',
r' [\1](' + r'https://www.vtk.org/doc/nightly/html/class' + r'\1.html#details)', s)
if reg2.findall(s1):
s2 = re.sub(r'\?(vtk[0-9a-zA-Z\-]+)\?', r'\1', s1)
return s2
else:
return s1
s = re.sub(repo_name, '_ktv' + r'\1', s)
if reg2.findall(s):
s = re.sub(no_link, '_ktv' + r'\1', s)
s = s.replace('_ktvvtk', '_ktv_')
n = len(reg3.findall(s))
if n > 0:
stats['doxy_count'] += n
s = re.sub(link,
r'[\1](' + r'https://www.vtk.org/doc/nightly/html/class' + r'\1.html#details)', s)
s = s.replace('_ktv_', 'vtk')
return s
Loading