(view source code of htmltags.rex as plain text)
/* Convert HTML tags to uppercase *//* Display blank line */Say/* Leave debug information on errors */Signal On Error Name Quit
Signal On Failure Name Quit
Signal On Halt Name Quit
Signal On Syntax Name Quit
/* Initialize RexxUtil */If RxFuncQuery( "sysloadfuncs" ) <> 0 Then Do
Call RxFuncAdd "sysloadfuncs", "RexxUtil", "sysloadfuncs"
Call sysloadfuncsEnd/* Parse command line parameter(s) */Parse Upper Arg infiles dummy
If dummy <> "" Then Call Syntax
If infiles = "" Then Call Syntax
/* Check if file(s) exist */Call SysFileTree infiles, "infile.", "F"
If infile.0 = 0 Then Call Syntax "File not found: "||infiles
/* Covert tags in all specified files to uppercase */Do i = 1 To infile.0
Call CheckTags infile.iEndExitCheckTags: Procedure Expose outfile
/* Parse argument(s) */infile = Arg( 1 )
Parse Value infile With . . size . file
file = Strip( file )
Parse Upper Value file With outfile".HTM"
outfile = outfile||".UPC"
/* Read file */allstring = CharIn( file, 1, size )
Call LineOut file
/* Find all tags and convert them */newstring = ""
convert = 1
Do forever
Parse Value allstring With string"<"tag">"allstring
If tag = "" Then Do
Leave Endnewtag = ConvertTag( tag )
If newtag = "/SCRIPT" Then convert = 1
If convert = 1 Then tag = newtag
Say "Converted tag: <"||tag||">"||"0D0A"X
newstring = newstring||string||"<"||tag||">"
If left( newtag, 6 ) = "SCRIPT" Then convert = 0
EndIf allstring <> "" Then newstring = newstring||allstring
/* Save results */Call charout outfile, newstring
Call LineOut outfile
ReturnColorConvert: procedure expose outfile
/* Parse argument(s) */args = Arg( )
string = Arg( 1 )
If string > 1 Then Do i = 2 To args
string = string||","||Arg( i )
End /* Check if string is hex color designation */ /* and convert to uppercase if true */If Length( string ) = 7 Then Do
If Left( string, 1 ) = "#" Then Do
If DataType( Right( string, 6 ), "X" ) = 1 Then Do
string = Translate( string )
End End EndReturn stringConvertTag: procedure expose outfile
/* Parse argument(s) */args = Arg( )
tag = Arg( 1 )
If args > 1 Then Do i = 2 To args
tag = tag||","||Arg( i )
EndSay "Original tag: <"||tag||">"
/* First, remove line breaks from within tag */Do Until break = 0
break = Pos( "0D0A"X, tag )
If break > 1 Then Do
tag = SubStr( tag, 1, break - 1 )||" "||,
SubStr( tag, break + 2 )
End End /* Then, check for literals within tag */If Pos( '"', tag ) = 0 Then Do
newtag = Translate( tag )
EndElse Do
newtag = ""
Do Until qposo = 0
qposo = pos( '"', tag )
If qposo > 1 Then Do
newtag = newtag||Translate( SubStr( tag, 1, qposo ) )
tag = SubStr( tag, qposo + 1 )
Endqposc = Pos( '"', tag )
If qposc > 1 Then Do
qstr = SubStr( tag, 1, qposc - 1 )
newtag = newtag||ColorConvert( qstr )||'"'
tag = SubStr( tag, qposc + 1 )
EndElse Do
If qposc = 1 Then Do
newtag = newtag||'"'
tag = SubStr( tag, 2 )
EndElse Leave
End EndIf tag <> "" Then newtag = newtag||tag
EndReturn newtagQuit: Procedure Expose outfile
/* Close output file and end program */Call LineOut outfile
ExitReturnSyntax: Procedure Expose outfile
Parse arg errmsg
If errmsg <> "" Then Say "Error:"||"0D0A"X||errmsg||"0D0A0D0A"X
Say "HTMLTags.rex, Version 2.01"
Say "Convert HTML tag commands to uppercase for readability and to conform to"
Say "original HTML specifications"
SaySay "Usage: HTMLTAGS.REX <html_filespec>"
SaySay 'Result: Converted file with name of HTML file and extension ".UPC"'
SaySay "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Call QuitReturnpage last modified: 2025-10-11; loaded in 0.0092 seconds