Make Content Between Span Tag Lower Case

This clip will find span tags and turn the content inside of them to lower case. The clip does not impact the first character or that string however. This is in response to a post to the clip list on yahoogroups.

;*** Effort by Don Passenger
;*** don at htmlfixit dot com
;*** discuss things live in chat at http://htmlfixit.com
;*** donations welcome at http://htmlfixit.com
;this clip will make all content between span tags
;lowercase except that first character of string
;is not affected
;posted at http://htmlfixit.com/blog/?p=352

;go to start of document
^!Jump Doc_Start

;loop to check each tag to see if it is a meta
:Loop
;find next tag start
^!Find “<” TIS
;quit when no more tags
^!IfError Finish

^!ClearVariables
;### %TAG% will be empty if cursor is not inside a tag.
;determine if tag and get the name of the tag
;if not span cycle to next via NotTag subroutine
^!Set %TAG%=”^$GetHtmlTag(TRUE)$”
^!IfTrue ^$IsEmpty(^%TAG%)$ NotTag
^!Set %TAGNAME%=”^$GetHtmlTagName(“^%TAG%”;UPPERCASE)$”
^!If “SPAN” = “^%TAGNAME%” SPAN ELSE NotTag

:NotTag
^!Jump Select_End
^!Goto Loop

;if span tag, process text to lowercase
:Span
^!SetDebug On
^!Jump Select_End
;figure out where cursor is
^!Set %row%=”^$GetRow$”
^!Set %column%=”^$GetCol$”
:SpanEnd
;find end meta tag
^!Find “<” TIS
^!Set %TAG%=”^$GetHtmlTag(TRUE)$”
^!IfTrue ^$IsEmpty(^%TAG%)$ SpanEnd
^!Set %TAGNAME%=”^$GetHtmlTagName(“^%TAG%”;UPPERCASE)$”
^!If “/SPAN” <> “^%TAGNAME%” SpanEnd
;get in front of the tag
^!Jump Select_Start
;select between spans
^!SelectTo ^%row%:^$Calc(^%column%+1)$
^!Keyboard CTRL+L
^!Goto Loop

;line 54 including all blanks and comments

Leave a Reply

Recent Posts

Archives

Topics