Delete All <a href> and <\a> Tags from a Document
This clip will remove all and
tags from a document. This includes all links, including all mailto: links. The version as written asks if you want to remove each tag. After you are comfortable with the clip, there is a comment telling you to take out the skip if you don’t want confirmation.
;*** Effort by Don Passenger
;*** don a-t htmlfixit d-o-t com
;*** discuss things live in chat at http://htmlfixit.com
;*** based on work by Larry and Jody and maybe Wayne
;*******************************************************
;delete any a href tags
;start at top of document
^!Jump Doc_Start
;### initialize everything
;look forwards to find the starting < :Loop
^!Find "<" TIS
;exit if find fails
^!IfError Finish
^!SetScreenUpdate Off
^!ClearVariables
;### %TAG% will be empty if cursor is not inside a tag.
^!Set %TAG%="^$GetHtmlTag(TRUE)$"
^!IfTrue ^$IsEmpty(^%TAG%)$ NotTag
;### So we found a tag. What tag is it?
^!Set %TAGNAME%="^$GetHtmlTagName("^%TAG%";UPPERCASE)$"
;react if it is an A tag (opening or closing)
^!If "/A" = "^%TAGNAME%" HREF
^!If "A" = "^%TAGNAME%" HREF ELSE NotTag
:HREF
^!Select HTMLTAG
;delete following line if you want it to not ask before deleting
^!Skip Leave this tag in:^%nl%^$GetSelection$^%nl%^%nl%(Press Ctrl+Alt and click button to abort.)^%nl%
^!Keyboard DELETE
^!Goto Loop
:NotTag
^!Jump Select_End
^!Goto Loop
;### clean up and go home
:Finish
^!SetScreenUpdate On
^!ClearVariables
;line 46 if you have all lines unrapped (including blank lines)