Dear Rony,
I can confirm that this version removes further blank lines so that your
version is more similar, but not exactly identical to Erichs Fix.
Comparing ooDialog This is what I get
Nofix 2022 pages
Erich’s Fix 1840 pages
Rony’s 1st Fix 1920 pages
Rony’s 2nd fix 1811 pages
Regarding Gil´s proposal for a further fix the file api.xml in rexxpg is an
example:
api.xml
<example>
<title>API — Rexx CreateInterpreter</title>
<programlisting language="C++">
RexxInstance *instance;
RexxThreadContext *threadContext;
RexxOption options[25];
if (RexxCreateInterpreter(&instance, &threadContext, options)) {
…
}
</programlisting>
</example>
Hälsningar/Regards/Grüsse,
P.O. Jonsson
[email protected]
> Am 22.02.2020 um 18:58 schrieb Rony G. Flatscher <[email protected]>:
>
> Dear P.O.,
>
> thank you for all of your efforts and work which allowed me to quickly find
> the reason for spurious additional blank lines!
>
> The reason is that there are quite a few programlisting elements with a
> CDATA-section content which the script has not tackled so far.
>
> So here an adjusted version of the script that processes CDATA sections as
> well:
>
> ---rgf, 2020-02-02, 2020-02-22: 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>"
> cdataStart ="<![CDATA["
> cdataEnd ="]]>"
> crlf ="0d0a"x
> mbOut=.mutableBuffer~new(,chars)
> bEdited=.false
>
> 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
> do
> mbOut~append(before, startNeedle, program, endNeedle)
> .count~increase
> end
> end
> else -- strip leading and trailing CR-LF characters
> do
> -- check for CDATA-section, remove leading trailing blank lines
> there as well
> if program~pos(cdataStart)>0 then
> do
> parse var program (cdataStart) program (cdataEnd)
> mbOut~append(before, startNeedle, cdataStart,
> program~strip("both",crlf), cdataEnd, endNeedle)
> end
> else
> do
> mbOut~append(before, startNeedle, program~strip("both",crlf),
> endNeedle)
> end
>
> .count~increase
> bEdited=.true
> end
> end
>
> -- write new file, if strip changes took place
> if bEdited then
> .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
> Cheers,
>
> ---rony
>
>
>
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel