Sorry, attached the wrong version of the script, please use the one attached to this e-mail and
place it into the "tools" subdirectory.
---rony
On 21.12.2022 15:58, Rony G. Flatscher wrote:
On 21.12.2022 14:48, Gilbert Barmwater wrote:
Good morning! I am planning on working on this today, I just need a little more time. I will
also look at the revision string question as well.
Good morning, Gil!
Enclosed you and P.O. - and everyone else who is interested - to find a script
"updateEntityValues.rex" that allows to change the entity values for YEAR, VERSION and EDITION for
all ${book}.ent definitions; just finished initial testing.
It is supposed to be stored in "docs\branches\5.0.0\tools". If so, you can
invoke it as:
updateEntityValues ..
and it will list all book entitiy definitions for YEAR, VERSION, EDITION
To change the YEAR value you would:
updateEntityValues -y 2099 ..
To change the VERSION you would (from explicitly "5.0.0" to "5.6.7"):
updateEntityValues -v "5.0.0 -> 5.6.7" ..
To change the EDITION you would:
updateEntityValues -e "2022.12.24" ..
To see the results then
updateEntityValues ..
---
TODO: adding the string " (last revised on YYYY-MM-DD with rNNNNN)" to the
EDITION string.
So if you can wait a while (maybe a few hours) I can come up with a revised ;) version of the
enclosed utility script.
---rony
On 12/21/2022 6:21 AM, Rony G. Flatscher wrote:
Dear P.O.,
On 21.12.2022 09:45, ooRexx wrote:
When I looked a bit closer I found the change :-) If you agree I prefer that I do the update
for macOS and Linux tools, they are in these two zipped folders
oorexxdocs_macOS_2022-06-30.zip
+1
oorexxdocs-Ubuntu_2020-06-16.zip
I will test and build and then update those files with the new template. If I understand
correctly we need to do the update in two places:
/docs/trunk/tools/
/docs/branches/5.0.0/tools/
Correct?
Yes. Best first in docs/branches/5.0.0/tools and once all changes for the release are done copy
docs/branches/5.0.0/tools to docs/trunk/tools at the end of this week when the release is
hopefully done.
I leave the Windows tools to Gil.
+1
For information the “official” building of the documentation is done on macOS nowadays, I
retired the building on Windows some time ago.
Best regards
---rony
On 20. Dec 2022, at 20:05, Rony G. Flatscher <rony.flatsc...@wu.ac.at> wrote:
All intended changes to docs/branches/5.0.0 are done with the exception of replacing "pdf.xsl"
in "docs/branches/5.0.0/tools/bldoc_orx" and "docs/branches/5.0.0/tools/bldoc_win" with the
attached one which causes the title page to be generated without the authors (who still remain
listed in the book on page 2).
Once Gil and/or P.O approve I would copy all changes to "docs/trunk" and then update the
EDITION entity definitions in trunk to point to the new year 2023.
Will call it a day now.
---rony
/* purpose: - allow updating the entity values for YEAR, VERSION and EDITION
in the appropriate books (${book}/en-US/${book].ent)
usage: - no argument: show the current values of the entites YEAR, VERSION
and EDITION for each book
- arguments: [-y "year string"] [-v "version string"] [-e "edition string"] [directory]
date: 2022-12-21
version: 0.01
*/
-- using .sysCargs as this supplies the arguments like the shell:
-- updateEntityValues.rex -y "2022" ..
-- updateEntityValues.rex -v "5.0.0 -> 5.1.0" ..
-- updateEntityValues.rex -e "2022.12.24" ..
call analyzeArgs
if .argYear | .argVersion | .argEdition then -- update any of the entity values?
do
call updateEntityValues
end
exit
analyzeArgs: procedure
pkgLocal=.context~package~local
argNum=.sysCargs~items
if argNum<2 then -- show values: either no argument (currDir) or directory argument
do
if argNum=0 then pkgLocal~dir="."
else pkgLocal~dir=.sysCArgs[1]
if \sysFileExists(.dir) then
do
.error~say("directory" pp(.dir) "does not exist, aborting ...")
exit -1
end
call showEntityValues
exit 0
end
if argNum//2=1 then -- uneven, last argument is the directory argument
do
pkgLocal~dir=.sysCargs[argNum] -- assign directory argument
if \sysFileExists(.dir) then
do
.error~say("directory" pp(.dir) "does not exist, aborting ...")
exit -2
end
argNum-=1 -- now only switch/value pairs if any
end
say ".dir:" pp(.dir)
pkgLocal~argYear =.false -- default values
pkgLocal~argVersion=.false
pkgLocal~argEdition=.false
do i=1 to argNum by 2
select case .sysCargs[i]
when "-y" then -- latest year value: if alreay a year range, then change the upper year to the supplied one
do
pkgLocal~yearValue =.sysCargs[i+1]~strip
pkgLocal~argYear =.true
end
when "-v" then -- replace for all
do
parse value .sysCargs[i+1] with currValue "->" newValue
if newValue<>"" then
do
pkgLocal~versionCurrValue=currValue~strip
pkgLocal~versionNewValue =newValue~strip
pkgLocal~argVersion =.true
end
end
when "-e" then
do
pkgLocal~editionValue=.sysCargs[i+1] -- replace for all plus add book's revision information
pkgLocal~argEdition =.true
end
otherwise
say "unknown switch" pp(.sysCargs[i]) "with value" pp(.sysCargs[i+1])", aborting ..."
exit -3
end
end
return
::routine showEntityValues -- show the entity values YEAR, VERSION and EDITION of all books
dirSep=.rexxInfo~directorySeparator
tgtDir=.dir || dirSep
call sysFileTree tgtDir"*", "dirs.", "DO"
do i=1 to dirs.0
bookPath=dirs.i
book=FileSpec('name',dirs.i) -- get directory assume it is a book
-- say "... book:" pp(book) "bookPath="pp(bookPath)
entFile=bookPath || dirSep || "en-US" || dirSep || book".ent"
-- say "... book:" pp(book) "entFile:" pp(entFile)
if SysFileExists(entFile) then
do
res=analyzeEntFile(entFile) -- returns the values
say (book~left(17,'.')) res
end
else
say entFile": does not exist, skipping ..."
end
::routine analyzeEntFile
parse arg entFile
s=.stream~new(entFile)~~open("read")
str=s~arrayin~makeString -- get file's content
s~close
res=""
do ent over "YEAR", "VERSION", "EDITION"
needle1='<!ENTITY' ent
needle2='>'
res=res ent":"
pos=1 -- start out
do forever
-- say "... a) pos:" pp(pos) "needle1:" pp(needle1)
pos=pos(needle1,str,pos) -- look for the needle
-- say "... b) pos:" pp(pos) "needle1:" pp(needle1)
if pos=0 then
do
res=res pp("n/a") -- not available (maybe commented out)
-- say "... cannot find" pp(needle1) "..."
leave
end
posCommEnd=lastPos('-->',str,pos) -- in an XML comment?
if posCommEnd>0 then
do
posCommStart=lastPos('<!--',str,pos)
if posCommEnd<posCommStart then -- we are in a comment
do
pos=pos("-->",str,posCommStart) -- position on end of comment
if pos=0 then
do
res=res pp("problem: XML end comment '-->' missing!")
leave
end
iterate
end
end
-- o.k. outside of a comment
-- parse var str =(pos) (needle1) val (needle2)
parse var str 1 preStr +(pos-1) =(pos) (needle1) val (needle2)
-- say "... pos="pp(pos) "needle1="pp(needle1) "val="pp(val) "| str~substr(pos,10):" pp(str~substr(pos,10))
res = res val~strip
leave
end
end
return strip(res)
::routine updateEntityValues -- show the entity values YEAR, VERSION and EDITION of all books
dirSep=.rexxInfo~directorySeparator
tgtDir=.dir || dirSep
call sysFileTree tgtDir"*", "dirs.", "DO"
do i=1 to dirs.0
bookPath=dirs.i
book=FileSpec('name',dirs.i) -- get directory assume it is a book
-- say "... book:" pp(book) "bookPath="pp(bookPath)
entFile=bookPath || dirSep || "en-US" || dirSep || book".ent"
-- say "... book:" pp(book) "entFile:" pp(entFile)
if SysFileExists(entFile) then
do
res=updateEntFile(entFile) -- returns the values
say (book~left(17,'.')) res
end
end
::routine updateEntFile
parse arg entFile
s=.stream~new(entFile)~~open("read")
str=s~charIn(1,s~chars)
s~close
res=""
mb=.MutableBuffer~new
do ent over "YEAR", "VERSION", "EDITION"
select case ent -- skip entity ?
when 'YEAR' then if .argYear =.false then iterate
when 'VERSION' then if .argVersion=.false then iterate
when 'EDITION' then if .argEdition=.false then iterate
otherwise nop
end
needle1='<!ENTITY' ent
needle2='>'
res=res ent":"
pos=1 -- start out
do forever
-- say "... a) pos:" pp(pos) "needle1:" pp(needle1)
pos=pos(needle1,str,pos) -- look for the needle
-- say "... b) pos:" pp(pos) "needle1:" pp(needle1)
if pos=0 then
do
res=res pp("n/a") -- not available (maybe commented out)
-- say "... cannot find" pp(needle1) "..."
leave
end
posCommEnd=lastPos('-->',str,pos) -- in an XML comment?
if posCommEnd>0 then
do
posCommStart=lastPos('<!--',str,pos)
if posCommEnd<posCommStart then -- we are in a comment
do
pos=pos("-->",str,posCommStart) -- position on end of comment
if pos=0 then
do
res=res pp("problem: XML end comment '-->' missing!")
leave
end
iterate
end
end
-- o.k. outside of a comment
parse var str 1 preStr +(pos-1) =(pos) (needle1) '"' val '"' (needle2) str
-- say "... pos="pp(pos) "needle1="pp(needle1) "val="pp(val) "| str~substr(pos,10):" pp(str~substr(pos,10))
mb~append(preStr,needle1,' "')
select case ent -- process entity
when 'YEAR' then -- replace or change upper year
do
if val~pos("-")>0 then
do
parse var val oldYear '-' currYear
mb~append(oldYear,'-',.yearValue)
end
else
do
mb~append(.yearValue)
end
end
when 'VERSION' then mb~append(val~changeStr(.versionCurrValue,.versionNewValue))
when 'EDITION' then mb~append(.editionValue) -- TODO: add revision info!
otherwise nop
end
mb~append('"',needle2)
res = res val~strip
leave
end
end
mb~append(str) -- append any left over
newContent=mb~string
-- replace file
.stream~new(entFile)~~open("replace")~~charout(newContent)~~close
return strip(res)
::requires "svnListRevisions.rex" -- get revision utility
::routine pp
return "["arg(1)"]"
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel