fixed cleanup script

This commit is contained in:
N_T 2024-10-09 10:36:24 +08:00
parent 2db1f59d24
commit 1548db1731
3 changed files with 1202 additions and 1267 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,7 @@ fileList = [
] ]
#fileList = [ "physgrad-code.ipynb"] # debug, only 1 file #fileList = [ "physgrad-code.ipynb"] # debug, only 1 file
#fileList = [ "t1.ipynb" ] # debug #fileList = [ "diffphys-code-sol.ipynb" ] # debug
# main # main
@ -116,7 +116,7 @@ for fnOut in fileList:
dell = [] # collect lines to delete dell = [] # collect lines to delete
for k in range( len( d[t][i]["outputs"][j]["text"] ) ): for k in range( len( d[t][i]["outputs"][j]["text"] ) ):
#print(" tout "+ d[t][i]["outputs"][j]["text"][k] ) # debug , print all lines #print(" tout "+ d[t][i]["outputs"][j]["text"][k] ) # debug , print all lines - ACTIVATE to LOCATE errors
nums = []; all_good = True nums = []; all_good = True
for rr in range(len(res)): for rr in range(len(res)):
nums.append( res[rr].search( d[t][i]["outputs"][j]["text"][k] ) ) nums.append( res[rr].search( d[t][i]["outputs"][j]["text"][k] ) )
@ -135,8 +135,10 @@ for fnOut in fileList:
#print("len after "+format( len( d[t][i]["outputs"][j]["text"] )) + " A") # debug #print("len after "+format( len( d[t][i]["outputs"][j]["text"] )) + " A") # debug
# afterwards (potentially remove whole entries) # afterwards (potentially remove whole entries)
# if len(delE)>0: if len(delE)>0:
# print("len bef "+format( len( d[t][i]["outputs"] )) + " A " + format(delE)) # debug delE.sort(reverse=True)
#print("len bef "+format( len( d[t][i]["outputs"] )) + " A " + format(delE)) # debug
for de in delE: for de in delE:
#print(type(d[t][i]["outputs"])); print(de) #print(type(d[t][i]["outputs"])); print(de)
d[t][i]["outputs"].pop(de) # remove array element d[t][i]["outputs"].pop(de) # remove array element

View File

@ -10,7 +10,6 @@ echo
echo WARNING - still requires one manual quit of first pdf/latex pass, use shift-x to quit echo WARNING - still requires one manual quit of first pdf/latex pass, use shift-x to quit
echo echo
PYT=python3.7
PYT=python3 PYT=python3
# warning - modifies notebooks! # warning - modifies notebooks!
@ -18,9 +17,21 @@ ${PYT} json-cleanup-for-pdf.py
# clean / remove _build dir ? # clean / remove _build dir ?
# GEN! /Users/thuerey/Library/Python/3.9/bin/jupyter-book build .
xelatex book
exit # sufficient for newer jupyter book versions
# old "pre" GEN
#/Users/thuerey/Library/Python/3.7/bin/jupyter-book build . --builder pdflatex #/Users/thuerey/Library/Python/3.7/bin/jupyter-book build . --builder pdflatex
/Users/thuerey/Library/Python/3.9/bin/jupyter-book build . --builder pdflatex #/Users/thuerey/Library/Python/3.9/bin/jupyter-book build . --builder pdflatex
# old cleanup
cd _build/latex cd _build/latex
#mv book.pdf book-xetex.pdf # not necessary, failed anyway #mv book.pdf book-xetex.pdf # not necessary, failed anyway