From 0196688f752ff25bdb51d5014947bff62019f0cf Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sat, 16 Nov 2024 09:46:06 +1300 Subject: [PATCH] Testing --- doc/mkdocs.bat | 16 ++++++++++++++-- doc/mkdocs.ksc | 23 +++++++++++++++++++++-- doc/mkdocs.rex | 13 ++++++++----- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/doc/mkdocs.bat b/doc/mkdocs.bat index 9df3e217..3640cac3 100644 --- a/doc/mkdocs.bat +++ b/doc/mkdocs.bat @@ -153,15 +153,27 @@ k95.exe -Y -# 127 -C "save keymap %manual_dist_dir%default.ksc,exit" > NUL: REM Copy manual to the output directory updating version numbers, etc, as we go REM Parameters are: source-directory destination-directory, git-file-dates dry-run dev-mode web-mode use-https -k95.exe %docs_root%\mkdocs.ksc -Y -d -# 127 = %docs_root%\manual %OUT_DIR% %GIT_DATES% %DRY_RUN% %DEV_MODE% %WEB_MODE% %HTTPS_MODE% +k95.exe %docs_root%\mkdocs.ksc -Y -d -# 127 = %docs_root%\manual %OUT_DIR% %GIT_DATES% %DRY_RUN% %DEV_MODE% %WEB_MODE% %HTTPS_MODE% || goto :failed REM And update modified dates for anything that hasn't changed since the manual REM was added to git if "%DRY_RUN%" == "true" goto :skipfd -k95.exe -Y -H -# 127 -C ".manual_dir := %manual_dist_dir%,.modtime_file := %mtime_file%,rexx call setdates,exit" +k95.exe -Y -H -# 127 -C ".manual_dir := %manual_dist_dir%,.modtime_file := %mtime_file%,rexx call setdates,exit" || goto :failed :skipfd echo manual done. +goto :finished + +:failed +echo K95 Manual build failed with exit status: %errorlevel% +popd + +set REGINA_MACROS=%REGINA_MACROS_OLD% +set REGINA_MACROS_OLD= + +exit /B 1 + +:finished popd set REGINA_MACROS=%REGINA_MACROS_OLD% diff --git a/doc/mkdocs.ksc b/doc/mkdocs.ksc index b4f5855c..d0bfda76 100644 --- a/doc/mkdocs.ksc +++ b/doc/mkdocs.ksc @@ -201,22 +201,33 @@ define date_to_touch_date { ; Function to update tags in a single file def process_file { + echo process file local file_in file_out gitdate git_date define \%9 - .file_in := \Freplace(\%1,/,\\) - .file_out := \Freplace(\%2,/,\\) + ;.file_in := \Freplace(\%1,/,\\) + ;.file_out := \Freplace(\%2,/,\\) + .file_in := \%1 + .file_out := \%2 .gitdate := \%3 + echo Input \m(file_in) + echo Output \m(file_out) + echo Gitdate \m(gitdate) + ; ============================================================================ ; Get file modified date from git if requested if = \m(gitdate) 1 { + echo get git date... .git_date := \Fcommand(git log -1 --pretty="format:%ci" \m(file_in) 2> nul) + echo git date is \m(git_date) } ; Update the file. This is done in REXX as its easier (regular expressions) ; and faster. + echo Hand over to REXX rexx call mkdocs + echo back from REXX } @@ -258,11 +269,16 @@ echo Processing \fdim(&f) files... .\%x = 1 while <= \%x \fdim(&f) { + echo Loop Top .idx := \Fsearch(*.{htm,html},\&f[\%x]) + echo Idx \m(idx) .src_file := \&f[\%x] + echo src_file \m(src_file) .dst_file := \m(dest)\Fbasename(\&f[\%x]) + echo dst_file \m(dst_file) .src_date := \Fdate(\m(src_file)) + echo src_date \m(src_date) if = \m(idx) 1 { echo \%x. UPDATE \m(src_file) ---> \m(dst_file) @@ -271,6 +287,7 @@ while <= \%x \fdim(&f) { } else { process_file \m(src_file) \m(dst_file) \m(touch_files) } + echo File processed } else { echo \%x. COPY \m(src_file) ---> \m(dst_file) @@ -279,6 +296,7 @@ while <= \%x \fdim(&f) { echo copy /overwrite:always \m(src_file) \m(dst_file) } else { copy /overwrite:always \m(src_file) \m(dst_file) + if fail exit 1 } if = \m(touch_files) 1 { @@ -296,6 +314,7 @@ while <= \%x \fdim(&f) { } } } + echo Incrementing \%x increment \%x } diff --git a/doc/mkdocs.rex b/doc/mkdocs.rex index 19ca725f..8257c440 100644 --- a/doc/mkdocs.rex +++ b/doc/mkdocs.rex @@ -59,6 +59,9 @@ output_file = CKermit("return \m(file_out)") git_date = CKermit("return \m(git_date)") dev_mode = CKermit("return \m(dev_mode)") +input_file = changestr("/",input_file,"\") +output_file = changestr("/",output_file,"\") + /* 1 = use https://kermitproject.org, 0 = use http://kermitproject.org */ use_https = CKermit("return \m(use_https)") @@ -81,11 +84,11 @@ if use_html = 0 then do output_file = changestr(".html",output_file,".htm") end -/* +/**/ say "input_file =" input_file say "output_file =" output_file say "git date =" git_date -*/ + /* REXX doesn't allow returning stems, get_version_tags will create the tags * stem as a global, and populate it with information about the Kermit version @@ -187,7 +190,7 @@ do while lines(input_file) = 1 /* For debugging say fields.0 'fields' do i = 1 to fields.0 - say i '»'fields.i'«' + say i '�'fields.i'�' end*/ @@ -214,7 +217,7 @@ do while lines(input_file) = 1 /* For debugging say fields.0 'fields' do i = 1 to fields.0 - say i '»'fields.i'«' + say i '�'fields.i'�' end */ @@ -272,7 +275,7 @@ get_version_tags: procedure expose tags. /* For debugging: output each of the things found in the herald say fields.0 'fields' do i = 1 to fields.0 - say i '»'fields.i'«' + say i '�'fields.i'�' end*/ tags.ver_num = fields.1 /* $ver$ */