Action
Remove HTML Comments
Removes HTML comments from a draft.
Steps
-
script
// Run this from a document whose HTML comments you want removed // Function to strip comments function stripHTMLComments(content){ cursor=0 comments=[] // Find all the HTML comments' positions while((open=content.indexOf("<!--",cursor))>-1){ // Have found what looks like a comment open close=content.indexOf("-->",open+4) if(close>=open+4){ // Have a matching comment close comments.push([open,close+3]) cursor=close+3 }else{ // No matching comment close - so break the loop break } } // Compose the edited string editedContent="" cursor=0 for(i=0;i<comments.length;i++){ editedContent=editedContent+content.substring(cursor,comments[i][0]) cursor=comments[i][1] } // Any text after the last comment editedContent=editedContent+content.substring(cursor) return editedContent } draft.content=stripHTMLComments(draft.content)
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.