Delimiting Text Previous  Top  Next

SourceFilter identifieds delimited text in either of two ways:

a. by a pair of strings, Delete From and Delete To delimiters which open and close off the delimited text.
b. by a single string that identifies the rest of the line as text to be deleted.  

Either form of removing delimited text can be disabled.

Stripping Web Page  

One possible use for SourceFilter is to strip comments from javascript that is to be published in web-pages. It's good programming practice to build well-commented code - but these can slow-down loading of any web-page using it.

One way to get the best of both worlds is to keep a fully-commented master source, then use SourceFilter to strip down the comments prior to publishing the web-page. That is how this page is managed (the popup commented javascript source is 64KBytes, stripped down it's 32KBytes)

  1. In the "master" copy of the javascript source (say popupmast.js), use an editor Replace All operation to change all occurrences of // to (say) ///, and /* to /**, */ to **/. Then
  2. manually change back the comments you wish to keep in the published web page ((e.g. your copyright statements) by deleting the extra / and *'s.
  3. Make a copy of the master, saving with a new name (say, popup.js), and
  4. use SourceFilter on the copy to delete all /// to end of line text, and all /** to **/ comment text.
  5. Publish this copy (popup.js) to the web.

Last Revised
Web site relocated