Skip to content

Commit cef1021

Browse files
committed
Code change: remove sub-bibliographies once we're done with them
This was causing failing tests and leaving dangling (empty) sections
1 parent 15146a3 commit cef1021

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

jupyter_book_to_htmlbook/file_processing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def process_chapter_soup(
232232

233233
else:
234234
chapter['xmlns'] = 'http://www.w3.org/1999/xhtml' # type: ignore
235-
del chapter['class']
235+
del chapter['class'] # type: ignore
236236

237237
# promote subheadings within "base" chapter
238238
chapter = promote_headings(chapter)
@@ -242,10 +242,12 @@ def process_chapter_soup(
242242
subsections, sub_bib = process_chapter_subparts(subfile)
243243
if subsections:
244244
for subsection in subsections:
245-
chapter.append(subsection)
245+
chapter.append(subsection) # type: ignore
246246
if bib and sub_bib:
247247
entries = sub_bib.find_all("dd") # type: ignore
248248
bib.dl.extend(entries) # type: ignore
249+
# throw away the sub-bib section
250+
_ = sub_bib.extract()
249251
elif sub_bib:
250252
bib = sub_bib
251253

@@ -328,7 +330,7 @@ def process_chapter(toc_element,
328330
chapter, ids = process_ids(chapter, book_ids)
329331

330332
# write the file, preserving any directory structure(s) from source
331-
if type(toc_element) == list:
333+
if type(toc_element) is list:
332334
dir_structure = [p for p in toc_element[0].parts
333335
if p not in source_dir.parts]
334336
else:

0 commit comments

Comments
 (0)