#!/bin/sh
#] 
#] *********************
#] $ bash "$d_bin"'webLocal/webLocal run step-by-step.sh'  - step-by-step update webLocal [URLlocal, links, etc]
#]    focus is on pHtmNlkNwpWebL: Howell's html files, p
#]    problems addressed by 
# www.BillHowell.ca  01Mar2023 initial 
# view in text editor, using constant-width font (eg courier), tabWidth = 3
#]    "$d_bin"'webSite.link.txt' - shows [how-to, results of] file-checks of past updates!!


# links for webSite up[load, grade]s: see "$d_bin"'webSite.link.txt'
# see instructions below as used to run this file
# 25Jun2025 Grossberg captioned image html files NOT listed! (>640 of them?)
#24************************24



#24************************24
# List of operators, generated with :
# $ grep  "^#] "  "$d_bin"'webLocal/webLocal run step-by-step.sh' |  sed "s|^#] |   |"  >"$d_bin"'webLocal/webLocal run step-by-step.sh'' TblOfCont.txt'
# REPL$  sudo dir_archive_dirDated  "$d_bin"'webLocal/'


# find active run functions: 
#		$ grep  "^[ 	]\+[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_bin"'webLocal/webLocal run step-by-step.sh'
# note 	use of tab key in grep search expression
# func defs come BEFORE 'titleLine capture for TableOfContents: 
#		uncomment (delete '#]') of titleLine to run choice, BUT put back later!
  
# +--+
#] [toRead, revisit]*[paper, email, vid,etc]s, use |*|  anywhere in doc - pulls out line
# $ grep  "\(|\*|\)"  "$d_bin"'webLocal/webLocal run step-by-step.sh'  |  sed 's|^#\] ||' 


#24************************24
# Setup 

#	source  "$d_bin""standard header.sh"	# not here - done by fileops.sh
source  "$d_bin"'webLocal/webLocal library.sh'

#	A variety of 'fileops run' bash scripts are in project directories, where it is perhaps easier to see the [data, intermediate results, etc] for scripts in the context of that project.
#	
#	A major reason for creating these "fileops run *.sh" files was to have a description of [manual, script] combinations of steps for a specific process.   This should be enormously helpful [say, month, year]s later when the process has to be : [repeat, modify, used elsewhere].
#	
#	Here is a listing of 'fileops run' bash scripts, built by : 
#	$ find "$d_web"  -type f  -name "fileops *run*.sh*"  |  sort  
#	"$d_web"'bin/0_test/fileops/fileops test run.sh
#	"$d_web"'bin/bin logs/fileops run Grossberg imageCaptions log.sh
#	"$d_web"'bin/webLocal run step-by-step.sh
#	"$d_web"'bin/fileops run webSite loPriority.sh
#	"$d_web"'bin/fileops run webSite template.sh
#	"$d_web"'bin/fileops run webSite update local.sh
#	"$d_web"'bin/fileops tests run.sh
#	"$d_web"'bin/z_Archive/fileops run webSite 240107 20h41m22s.sh
#	"$d_web"'Neural nets/consciousness/webWork/z_Archive/fileops run TrNN_ART.sh
#	"$d_web"'Neural nets/Grossberg/webWork/z_Archive/fileops run TrNN_ART.sh
#	"$d_web"'Neural nets/Transformer NNs/z_Archive/webWork/z_Archive/fileops run TrNN_ART.sh
#	"$d_web"'Neural nets/TrNNs_ART/webWork/z_Archive/fileops run TrNN_ART.sh


#] ToDos
#	?ddAug2023? webLocal_steps: I need to use unix make as process is semi-manual
#  30Aug2024 the "steps" aren't helping, as  checks are needed for almost alll functions!
#	15May2025 create a makefile for "$d_bin"'webLocal/webLocal run step-by-step.sh' 


#24************************24

#  08********08
#  revamp work  - major changes from earlier processes, revamped web[Page, Dir]s (no longer pertinent)
#     preps for onLine work, including [dWebHtmlOnly, lftp upload]  - not created, DON'T USE?!?!?!
#     see "$d_bin"'webLocal/z_Archive/webLocal run historic 250504 12h15m.sh'  


#] 08********08
#] +-----+
#] webLocal step-by-step procedures: with manual fixes after each step
#]    after webOnlin: find web[Local, Onlin, Diff] directories, mv webOnlin dirs, change webLocal links 
#??	# 07May2024 easy improvement, easiest to do early
#??	# "$d_bin"'webOnline/webOnline library.sh'  - funcs for [prep, upload] (webLocal -> webOnlin)
#??	#		pManClean_get_pCmt_pLftp_pHref  "$p_MnCl"  "$p_Cmnt"  "$p_LoOn"  "$p_Lftp"  "$p_Href" 
#??	# "$d_bin"'webLocal/webLocal library.sh'  - library of handy bash functions for webSite maintenance
#??	#		povrL_pStrP_replace      #(bolArXiv bolChrCd povrL pStrP) sed replace encoded (pStrP, povrL)
#??	# p_log="$pLogStrP"="$d_bin"'bin logs/pLog povrL_pStrP_replace funcFamily.txt'
#??		#povrL="$d_webWork"'pHtmAllL.txt'		# pHtmIncL.txt completely inadequate!
#??		#pStrP="$d_bin"'webOnline/clean/p_Href list for sed to fix links.txt'
#??		#povrL_pStrP_replace  1  1  "$povrL"  "$pStrP"


#] FIRST backups!!!
	#"$d_bin"'backupper/backup.sh'		# backup drives, see instructions to run near end of this file
													#(dir) archives ONLY files in dir
	#dir_archive_dirDated  "$d_bin"'webLocal/'


#] +-----+
#] step 1  - list all of my *.p[Nlk, Nwp, Web, HtmNlkNwpWeb].html files  
#		14Nov2025 missing my .html files like Grossberg captioned images

#	dWeb_get_pHtmNonNlkNwpWebL				#(no args) find non-NlkNwpWeb html files with local links 
#													# "\/home\/bill\/web\/\|http:\/\/www.BillHowell.ca\|???"
#	dWeb_get_pHtmNlkNwpWebL					#(no args) generate [pthL, diff] of my html files

#	diff  "$pHtmNonNlkNwpWebL769"  "$pHtmNlkNwpWebL769"  --suppress-common-lines  |  grep "^<"  |  sed 's|^< ||'  >"$pHtmNonNlkNwpWeb_diffL769"

# find active run functions: $ grep  "^	[A-Za-z]"  "$d_bin"'webLocal/webLocal run step-by-step.sh'
# $ bash  "$d_bin"'webLocal/webLocal run step-by-step.sh'  


#] +-----+
#] step 2  - [get, check] links [All, Int, Ext, Bad]  

#]    a) Howell's html files with links: 
	pHtmNwpWebL_get_pLnkLL					#(no args) [get, analyze] links in my .Htm[Nwp, Web].html files
													# my .HtmNlk.html files are NOT included, as they don't have internal links (/home/bill/web/)

#]    b) non-Howell html files
#	webLocal_get_links						#(no args) [get, check] links [All, Int, Ext, Bad, BMkInn, BmkOut]
#	pLnkIntPthL_get_pGodBadLL 			#(no args) all IntPths split into [good, bad]
#	pLnkIntBmkL_get_pGodBadLL				#(no args) all IntBmks split to [good, bad]


#]    c) manually fix links as per pLnkIntPthBad769='pLnkIntPthBad.txt'
# [lazy, long] way : 
# 1. put AND[tab, corrected link] in copy of 'pLnkIntPthBad.txt' 
# 	(auto-generate replace, manuall fix those)
# 2. replace in ALL pHtmInc769='pHtmIncL.txt'
# sed 's|\(.*\)|\1\t\1|'  "$pLnkIntPthBad769"  >"$pLnkIntPthManfix769"
# 09May2025 I need a more efficient algorithm rather than going though every pLnkInt ~2000) for every strP!! (~200)  2000*200=400,000 passes!


#] pWebPageL_pStrP_replace					#(pHtmInc pLnkIntPthManfix) general pStrP replacement in webPages
#	pWebPageL_pStrP_replace  "$pHtmInc769"  "$pLnkIntPthManfix769"


# find active run functions: $ grep  "^	[A-Za-z]"  "$d_bin"'webLocal/webLocal run step-by-step.sh'
# $ bash  "$d_bin"'webLocal/webLocal run step-by-step.sh'  

#] +-----+
#] step 3  - [setup, fix] bookmarks [BMkInn, BmkOut]

	#(pinnL povr p_log) find all strQuotes  (sedStrtL hard-coded for now) uncomment both lines
	#pLog222="$d_webWork"'pLog pinnL_sedExpr_get_poutExprL.txt'
	#pinnL_sedExpr_get_povr  "$d_webWork"'fileopsWork/'  "$pHtmInc769"  "$pLnkIntBmkManfix"  "$pLog222" 

	# not created yet? : 
	#pLnkIntBmkL_get_pGodBadLL				#(no args) all IntBmks split to [good, bad]


#] after bmk fixes, upLoad corrected pHtmIncL.txt, quit this file & other d_webLocals, then :  
#]    open "$d_webLocal"'webOnline library[, run].sh', [study, adjust] dWeb_uploadNonWebPage_online  
#]       ensure d_webOnly up-to-date : rm  [dir, webPage]s, then create [dir, fil]s
#]       change lnkRoot : sed  's|\/home\/bill\/web\/|http://www.BillHowell.ca/|g'  
#]    


# find active run functions: $ grep  "^	[A-Za-z]"  "$d_bin"'webLocal/webLocal run step-by-step.sh'
# $ bash  "$d_bin"'webLocal/webLocal run step-by-step.sh'  

#] +-----+
#] step 4  - manual [setup, fix] * classes (goto Menu bookmarks)
	#pWebYesL_get_pClsWebL 					# (no args?) extract a list of classes from all webPages
	#pWebPageL_notIn_pHtmlClassAllL 		# (no args) files not in one or other dir
													# 05May2025 not debugged yet: pWebPageL_notIn_pHtmlClassAllL
	#pOvrClassL_get_pClassL 				# (no args) extract a list of classes from pOvrClassL
													# 05May2025 not created yet: pOvrClassL_get_pClassL
	#pHtmlL_putClass_pStrPL 				# (pHtmlL  pStrPL) replace ALL <:code:> phrases
													# (no-workee)
	#pOvrClassL_put_pHead_sub 				# (pClassL pHeadTplt) replace header, eg webPages
	#pOvrClassL_put_pHead 					# (no args) replace webPages headers


#] webSite extensions: generate pLnkIntPthLsts for each of [html, txt, ods, png, jpg, etc]
	#not created yet (used to have) 		# generate pthLsts of Howells [web, Href, Img, Extrn]


	#povrL_pStrP_replace  1  1  "$pWebYes769"  "$pStrPL_769"



# convenient place to put this 2nd copy : 
	#dir_archive_dirDated  "$d_bin"'webLocal/'



# find active run functions: $ grep  "^	[A-Za-z]"  "$d_bin"'webLocal/webLocal run step-by-step.sh'
# $ bash  "$d_bin"'webLocal/webLocal run step-by-step.sh'  

# enddoc
