Anonymous user
Rosetta Code/Fix code tags: Difference between revisions
→{{header|REXX}}: changed comments and indentation, added a comment. -- ~~~~
m (→{{header|REXX}}: re-aligned first comment, added whitespace. -- ~~~~) |
(→{{header|REXX}}: changed comments and indentation, added a comment. -- ~~~~) |
||
Line 347:
=={{header|REXX}}==
Some older REXXes don't have the '''changestr''' bif, so one is include here.▼
<lang rexx>/*REXX program fixes (changes) depreciated code tags with newer tags.*/
old. = /*define a default value for OLD.*/
▲old.1='<%s>' ; new.1='<lang %s>'
▲old.2='</%s>' ; new.2='</lang>'
▲old.3='<code %s>' ; new.3='<lang %s>'
▲old.4='</code>' ; new.4='</lang>'
▲ifid='Wikisource.txt' /* input file identifier. */
▲ofid='converted.txt' /*output " " */
▲ do while lines(ifid)\==0 /*keep trunkin' until done. */
_=linein(ifid) /*read a record from the input. */
do k=1 while old.j\==''
_=changestr(new.k,_,old.k) /*let REXX do the heavy lifting. */
end /*k*/
call lineout ofid,_ /*write out the re-formatted rec.*/
end /*while lines(ifid)\==0*/
<lang rexx>/*───────────────────────────CHANGESTR subroutine───────────────────────*/
changestr: procedure; parse arg o,h,n; r=; w=length(o); if w==0 then return n||h
do forever; parse var h y (o) _ +(w) h; if _=='' then return r||y; r=r||y||n; end</lang>
|