Rony,
Sorry for not replying about your program earlier :-[. My initial
reaction was that it seemed to be somewhat of a duplicate of Erich's
program except that it is run against the source BEFORE the transform as
opposed to against the .fo file after the transform. I was also
concerned that there might be some exceptional cases that would not be
caught by your code and would still leave blank lines. So I have not
tried it yet having had other "fish to fry". There is one big advantage
to removing the blanks from the source and that is that the page numbers
in the index would then be correct which they are not (in many cases)
using Erich's program. This is because in removing the blank lines the
document gets shorter and sections may move to earlier page numbers but
the index is generated during the transform step while the blanks are
still present thus creating errors in the final PDF. I hope to try your
program soon and I will let you know my results.
Gil B.
On 2/21/2020 6:44 AM, Rony G. Flatscher wrote:
On 20.02.2020 23:20, P.O. Jonsson wrote:
This is just to inform that I have managed to inject Erich Rexx
script in my build chain so that my built documents should now be
100% the same as yours and the ones built by Erich or Rick. I could
only test it on rexxref.pdf but that is a beast and if it works there
the rest should be ok.
Removing the additional spaces shrunk rexxref.pdf with 10 pages and
ooDialog with 182 pages ! ooDialog.pdf is now ???only??? 1898 pages :-)
The following program needs to be run from "oorexx/doc/trunk" and will
replace leading and trailing empty lines in the content of
"programlisting" elements which are probably the cause for the blank
lines.
If you then run the documentation generation, then those blank lines
should not show up anymore.
Program "stripBlankLinesFromProgramlistingElements.rex" that removes
leading and trailing CR-LF from programlistings. Run it in the
doc-branch you want to work with, e.g. from "oorexx/doc/trunk":
---rgf, 2020-02-02: strip CR-LF from ooRexx xml program listings
start=.dateTime~new
call sysfiletree "*.xml", "files.", "FOS"
end =.dateTime~new
say "SysFileTree duration:" end-start", about to process" files.0 "files"
len=files.0~length
do i=1 to files.0
say i~right(len)":" files.i
call stripBlankLines files.i
end
end =.dateTime~new
say "processed" .count~counter "<programlisting> elements, duration:"
end-start
::routine stripBlankLines
parse arg fileName
inStr=.stream~new(fileName)~~open("read")
chars=inStr~chars
allChars=inStr~charin(1,chars)
inStr~close
startNeedle="<programlisting>"
endNeedle ="</programlisting>"
crlf ="0d0a"x
mbOut=.mutableBuffer~new(,chars)
do while allChars<>""
parse var allChars before (startNeedle) program (endNeedle) allChars
if program="" then
do
if allChars="" then -- arrived at end of file
mbOut~append(before)
else -- maybe a placeholder of whitespace
mbOut~append(before, startNeedle, program, endNeedle)
end
else -- strip leading and trailing CR-LF characters
do
mbOut~append(before, startNeedle, program~strip("both",crlf),
endNeedle)
.count~increase
end
end
-- write new file
.stream~new(fileName)~~open("write
replace")~~charout(mbOut~string)~close
::class count
::attribute counter class
::method init class
expose counter
counter=0
::method increase class
expose counter
counter+=1
If something would go wrong, then you could always re-instate the
original version of the documentation by issuing an "svn revert"
command, so testing the above program should be safe from that respect
as well.
Could you try that out and report whether it solved the empty line
problem? (The program can be run repeatedly, in the case that new
programlisting-code gets added to the documentation and there is a
need to remove leading and trailing empty lines again.)
---rony
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel
--
Gil Barmwater
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel