Strip Meta Keyword/Description Tags
This clip will strip the meta tags but preserves the keywords and descriptions as html comments.
;effort by don at htmlfixit.com
;1/13/05
;clip strips html meta tags of type
;keywords and description from a document
;but leaves the keywords or description content
;in a comment with a preceeding comment saying
;what tag it came out of
;go to start of document
^!Jump Doc_Start
;loop to check each tag to see if it is a meta
:Loop
;set counter to 0 -- unless changes will not process
;this tag
^!Set %processmeta%="0"
;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 meta cycle to next via NotTag subroutine
^!Set %TAG%="^$GetHtmlTag(TRUE)$"
^!IfTrue ^$IsEmpty(^%TAG%)$ NotTag
^!Set %TAGNAME%="^$GetHtmlTagName("^%TAG%";UPPERCASE)$"
^!If "META" = "^%TAGNAME%" Meta ELSE NotTag
:NotTag
^!Jump Select_End
^!Goto Loop
;if meta tag, figure out if it is a description
;or a keyword metatag
:Meta
^!Set %METATAG%="^$GetSelection$"
;two long lines follow
^!Set %METAHTTP%="^$StrPos("HTTP-EQUIV=";"^$StrUpper("^%METATAG%")$";False)$"
^!Set %METADESCRIPTION%="^$StrPos("Description";"^$StrUpper("^%METATAG%")$";False)$"
;if description click the counter to one so we know what it is
^!If "^%METADESCRIPTION%" <> "0" next ELSE Skip_1
^!Set %NEEDPROCESSING%="1"
;if it is keyword click the counter to two so we know what it is
;long line follows
^!Set %METAKEYWORDS%="^$StrPos("Keywords";"^$StrUpper("^%METATAG%")$";False)$"
^!If "^%METAKEYWORDS%" <> "0" next ELSE Skip_1
^!Set %NEEDPROCESSING%="2"
^!If "^%NEEDPROCESSING%" = "0" Loop ELSE ProcessMeta
;we have either description or keywords meta
;so process it
:ProcessMeta
;trim out everything before and after content
;using left and right trims or copies
;long line follows
^!Set %METACONTENT%="^$StrPos("CONTENT=";"^$StrUpper("^%METATAG%")$";False)$"
^!Set %METACONTENT%=^$Calc(^%METACONTENT%+7)$
^!Set %METATAG%=^$StrDeleteLeft("^%METATAG";^%METACONTENT%)$
^!Set %QUOTE%="^$StrCopyLeft("^%METATAG";1)$"
^!Set %METATAG%=^$StrDeleteLeft("^%METATAG";1)$
^!Set %CLOSEQUOTE%="^$StrPos("^%QUOTE%";"^%METATAG%";False)$"
^!Set %METATAG%=^$StrCopyLeft("^%METATAG%";^$Calc(^%CLOSEQUOTE%-1)$)$
;insert proper comment for type of tag being cleaned
^!If "^%NEEDPROCESSING%" = "1" Next ELSE Skip_1
^!InsertHtml
^!If "^%NEEDPROCESSING%" = "2" Next ELSE Skip_1
^!InsertHtml
;replace the existing tag with the words in a comment tag
^!InsertHtml
^!Goto NotTag
:Finish
^!Info [C]finished with this file
^!Goto EXIT
;line 86 including all blanks and comments>>>>>