Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrg committed Nov 15, 2024
1 parent 124bb96 commit 0196688
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
16 changes: 14 additions & 2 deletions doc/mkdocs.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
23 changes: 21 additions & 2 deletions doc/mkdocs.ksc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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 {
Expand All @@ -296,6 +314,7 @@ while <= \%x \fdim(&f) {
}
}
}
echo Incrementing \%x
increment \%x
}

Expand Down
13 changes: 8 additions & 5 deletions doc/mkdocs.rex
Original file line number Diff line number Diff line change
Expand Up @@ -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)")

Expand All @@ -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
Expand Down Expand Up @@ -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*/


Expand All @@ -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
*/

Expand Down Expand Up @@ -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$ */
Expand Down

0 comments on commit 0196688

Please sign in to comment.