Remove Table Tags from XHTML or HTML Document

June 9, 2005 on 2:04 am | In Generic Clips | No Comments

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

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^

Bad Behavior has blocked 346 access attempts in the last 7 days.