Remove Table Tags from XHTML or HTML Document

This clip should remove all table, tr, and td tags from a document including end tags.

;*** Effort by Don Passenger
;*** don a-t htmlfixit d-o-t com
;*** discuss things live in chat at http://htmlfixit.com
;*******************************************************
;clip strips html table tags from entire document

;go to start of document
^!Jump Doc_Start

;loop to check each tag to see if it is a table tag
: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 table tag cycle to next via NotTag subroutine ^!Set %TAG%="^$GetHtmlTag(TRUE)$" ^!IfTrue ^$IsEmpty(^%TAG%)$ NotTag ^!Set %TAGNAME%="^$GetHtmlTagName("^%TAG%";UPPERCASE)$" ;I think there are six tags in tables so ;these six options are tested and tag deleted if match ^!If "TABLE" = "^%TAGNAME%" Table ^!If "TD" = "^%TAGNAME%" Table ^!If "TR" = "^%TAGNAME%" Table ^!If "/TABLE" = "^%TAGNAME%" Table ^!If "/TD" = "^%TAGNAME%" Table ^!If "/TR" = "^%TAGNAME%" Table ^!Goto NotTag :NotTag ^!Jump Select_End ^!Goto Loop ;if TABLE tag delete it :Table ;delete the tag ;could just replace it with a
;or something like that if you wish
^!Keyboard DELETE

^!Goto NotTag

:Finish
^!Info [C]finished with this file
^!Goto End
;line 51 including all blanks and comments

Leave a Reply

Recent Posts

Archives

Topics