/* create an HTML version of a file or a CC-range portion */ /* David McRitchie -- The REXX Macros Toolbox -- 1997/05/21 */ /* http://www.geocities.com/davemcritchie/ */ /* Contact: DMcRitchie@hotmail.com */ /* TXT2HTML [TT] | [EX] */ /* (none) Group of lines surrounded by
 ... 
*/ /* TT Group of lines surrounded by ... , and */ /* individual lines prefixed by
*/ /* EX Group of lines surrounded by ... , and */ /* individual lines prefixed by "
 . ", */ /* particularly for single line examples. */ /* */ /* Features that should be added -- NX and CC-CC */ /* may present some additional problems. */ /* */ /* Documented: http://www.geocities.com/davemcritchie/nclist.htm */ /* Copyright 1997, F. David McRitchie */ /*********************************************************************/ address "ISREDIT" "MACRO NOPROCESS" parse upper arg TT "(member) = member" "(dataset) = dataset" "PROCESS RANGE C" "(frow) = LINENUM .zfrange" "(lastrow) = LINENUM .zlrange" "(lmax) = LINENUM .zlast" notesep = left("=",30,"=") "TXT2HTML" time('n') left("=",30,"=") "caps off" if frow = 000000 then frow = 1 /* spf/pc proof */ "label" frow "= .labf 0" "label" lastrow "= .labl 1" "line_before .labf = noteline (notesep)" "line_after .labl = noteline (notesep)" do row = frow to lastrow "(oldline) = line" row line = strip(oldline,"t") line = replace(line,"Ä","-") /* c4 to - */ line = replace(line,"",">") /* 10 to > */ line = replace(line,"Í","=") /* cd to = */ line = replace(line,"&","&") line = replace(line,"<","<") line = replace(line,">",">") line = replace(line,'"',""") line = replace(line,". ",".  ") line = replace(line,": ",":  ") if TT = "TT" then line="
"line if TT = "EX" then line="
  "line if line \= oldline then do /* ------------ note = length(oldline) "--" length(line) "line_before" row "= noteline (note)" ---------------------*/ "line_before" row "= noteline (oldline)" "line" row "= (line)" end; end "label" frow "= .labf 0" "label" lastrow "= .labl 1" nnote = "line_before .labf = noteline" if frow = 1 & lastrow = lmax then do /* ****/ "line_before .labf = dataline ''" "line_before .labf = dataline """"" "line_after .labl = dataline """"" "line_before .labf = dataline """"" "line_before .labf = dataline """dataset"" """" nnote """ make TITLE and H1 match""" line = "" "line_before .labf = dataline (line)" nnote """ fill in ... description""" line = "" "line_before .labf = dataline (line)" nnote """ fill in ... AUTHOR and OWNER_NAME""" line = "" "line_before .labf = dataline (line)" nnote """ fill in ... keywords""" line = "" "line_before .labf = dataline (line)" line = "" "line_before .labf = dataline (line)" nnote """ fill in ... AUTHOR and OWNER_NAME""" "line_before .labf = dataline """"" line = "" "line_before .labf = dataline (line)" "line_before .labf = dataline ""

"dataset"

" """" nnote """ make TITLE and H1 match""" "line_after .labl = dataline """"" end pre = "PRE"; if TT = "TT" | TT = "EX" then PRE = "TT" "line_before .labf = dataline ""<"PRE">""" "line_after .labl = dataline """"" exit Replace: procedure parse arg string, old, new lold = length(old) lnew = length(new) lll=length(string) /*<-- make SPF/PC work*/ if 0 = length(string) then return string if 0 = length(old) then return string P = 1; k=0 do forever k=k+1 p = pos(old, string, p) if p = 0 then signal xxx string = substr(string,1,p-1)new||substr(string,p+lold) p = p + lnew lll = lll - lold + lnew /* <--make SPF/PC work*/ end xxx: /*********************************************************************/ /* Following *@#*#* code is necessary for SPF/PC you figure it out */ /* I can't. Leave out this code and get spurious data if you */ /* convert http://www.geocities.com/davemcritchie/excel/pathname.txt */ /* SPF/PC is not limited to 255 byte records, you could start with */ /* a 150 byte record and end up with a 285 byte record. You could */ /* have 8000 byte records. YOU MAY RUN OUT OF MEMEMORY TOO. */ /*********************************************************************/ string = left(string,lll) return string exit