File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -32,16 +32,17 @@ def clean_header(text):
32
32
if point .name == 'h1' :
33
33
level1_directory = os .path .join ('pdfs' , clean_header (point .text ))
34
34
os .makedirs (level1_directory )
35
- print ('\n ' .join ((point .text , "+" * len (point .text ), "" )))
35
+ print ('\n ' .join (("" , point .text , "+" * len (point .text ))))
36
36
37
37
elif point .name == 'h2' :
38
38
current_directory = os .path .join (level1_directory , clean_header (point .text ))
39
39
os .mkdir (current_directory )
40
- print ('\n ' .join ((point .text , "+ " * len (point .text ), "" )))
40
+ print ('\n ' .join (("" , point .text , "- " * len (point .text ))))
41
41
42
42
elif point .name == 'p' :
43
43
link = clean_pdf_link (point .find ('a' ).attrs ['href' ])
44
44
extension = os .path .splitext (link )[1 ][1 :]
45
+ extension = 'pdf' if extension not in ['pdf' , 'html' ] else extension
45
46
name = point .text .split ('[' + extension + ']' )[0 ].replace ('.' , '' ).replace ('/' , '_' )
46
47
if link is not None :
47
48
print (name + ' (' + link + ')' )
You can’t perform that action at this time.
0 commit comments