return
+# have more than one header with the same name in a tutorial?
+def check_multiple_defined_headers(lines):
+ headers = []
+ for l in lines:
+ # this may break if a header splits across a line
+ if "<h" in l:
+ # convert thisheader to the doxygen header name equivalent
+ thisheader = l # take this line
+ thisheader = thisheader.replace(' ', '') # remove all whitespace
+ thisheader = thisheader.split('<h')[1] # remove header tag '<h'
+ if thisheader[0] in ['1', '2', '3', '4', '5']: # make sure the next character is 1-5
+ thisheader = thisheader[2:] # remove '*>'
+ if len(thisheader.split('</h'))==2: # check for close header on the same line
+ thisheader = thisheader.split('</h')[0] # remove close header tag
+ thisheader = ''.join(ch for ch in thisheader if ch.isalnum()) # remove nonalphanumeric
+ if thisheader in headers:
+ sys.exit("Error: repeated header title '%s' in file group '%s'"%(thisheader,args[0]))
+ else:
+ headers.append(thisheader)
+ else:
+ sys.exit("Error: mismatched html header flags in file group '%s'"%(args[0]))
+ # do not check else here because it may match with template arguments like '<hsize_t>'
+
+ # detect @sect[1-5]{ ... }
+ if "@sect" in l:
+ thisheader = l # take this line
+ thisheader = thisheader.replace(' ', '') # remove all whitespace
+ thisheader = thisheader.split('@sect')[1] # remove '@sect'
+ if thisheader[0] in ['1', '2', '3', '4', '5']: # make sure the next character is 1-5
+ thisheader = thisheader[2:] # remove the number
+ thisheader = ''.join(ch for ch in thisheader if ch.isalnum()) # remove nonalphanumeric
+
+ if thisheader in headers:
+ sys.exit("Error: repeated header title '%s' in file group '%s'"%(thisheader,args[0]))
+ else:
+ headers.append(thisheader)
+
+ return
+
args = sys.argv
args.pop(0)
check_doxygen_groups(lines)
check_empty_lines_in_tables(lines)
+# if it's intro.dox, combine it with step-**.cc and results.dox and check headers
+if 'intro.dox' in args[0]:
+ # get stepname.cc
+ stepname = args[0].split('/doc',1)[0]
+ stepname = stepname + '/' + stepname.split('/',1)[1] + '.cc'
+
+ # get results.dox
+ resultsname = args[0].split('intro.dox',1)[0] + 'results.dox'
+
+ # try to open the '.cc' file, otherwise try to open a '.cu' file
+ try:
+ fstep = open(stepname)
+ except IOError:
+ stepname = stepname[:-2] + 'cu'
+ fstep = open(stepname)
+
+ lines += fstep.readlines()
+ fstep.close()
+
+ fres = open(resultsname)
+ lines.append(fres.readlines())
+ fres.close()
+
+ # check the file group
+ check_multiple_defined_headers(lines)