close files before writing

This commit is contained in:
Sébastien Loriot 2022-11-30 13:28:48 +01:00
parent 02306fdc4c
commit 12bca1c4f6
1 changed files with 9 additions and 0 deletions

View File

@ -236,6 +236,7 @@ def automagically_number_figures():
d = pq(file_content.read(), parser="html")
d('a.el').each( lambda i: update_figure_ref(i,global_anchor_map) )
d('a.elRef').each( lambda i: update_figure_ref(i,global_anchor_map) )
file_content.close()
write_out_html(d, fname)
###############################################################################
@ -278,6 +279,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
tr_tags.each(lambda i: rearrange_img(i, dir_name))
span_tags = d('table.directory tr span')
span_tags.each(lambda i: rearrange_icon(i, dir_name))
file_content.close()
write_out_html(d,fn)
class_files=list(package_glob('./*/class*.html'))
class_files.extend(package_glob('./*/struct*.html'))
@ -293,6 +295,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
ident = d('#nav-path .navelem').eq(0).children().eq(0)
if ident and ident.attr('href') == 'namespaceCGAL.html':
ident.attr('href', '../Manual/namespaceCGAL.html')
file_content.close()
write_out_html(d, fn)
namespace_files=package_glob('./*/namespace*.html')
@ -303,6 +306,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
if ident.size() == 1:
conceptify_ns(d);
d.remove("#CGALConceptNS")
file_content.close()
write_out_html(d, fn)
# in a group we only need to change the nested-classes
@ -311,6 +315,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
file_content = codecs.open(fn, 'r', encoding='utf-8')
d = pq(file_content.read(), parser="html")
conceptify_nested_classes(d)
file_content.close()
write_out_html(d, fn)
# fix up Files
@ -323,6 +328,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
if row_id != None:
# figure out the rowid and then drop everything from the table that matches
table("tr").filter(lambda i: re.match(row_id + '*', pq(this).attr('id'))).remove()
file_content.close()
write_out_html(d, fn)
#Rewrite the code for index trees images
@ -355,6 +361,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
# in hasModels.html, generalizes.html and refines.html, it is always Class. If this changes in
# future versions of doxygen, the regular expression will be ready
dts.each(lambda i: pq(this).html(re.sub("((Class )|(Struct ))", "Concept ", pq(this).html())))
file_content.close()
write_out_html(d, fn)
# throw out nav-sync
@ -364,6 +371,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
d = pq(file_content.read(), parser="html")
d('#nav-sync').hide()
# TODO count figures
file_content.close()
write_out_html(d, fn)
# remove %CGAL in navtree: this should be a fix in doxygen but for now it does not worth it
@ -390,6 +398,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
text = pq(el).text()
if text[0:9]=="template<" and text.find('=')==-1:
pq(el).remove()
file_content.close()
write_out_html(d, fn)
#add a canonical link to all pages