Skip to content

A browserified version of fb55/htmlparser2 modified to work in Google Apps Script

Notifications You must be signed in to change notification settings

Spencer-Easton/Apps-Script-htmlparser2-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Apps-Script-htmlparser2-library

A browserified version of fb55/htmlparser2 modified to work in Google Apps Script

This is a library of the htmlparser2 module that has been ran through browserify and modified for Apps Script.
You can either include the source code of this library or you can link to it with the ID:

1TLbGgQBCztnB0lOhcTYKg2UpXtpdDwocvfcx44w1tqFnHDJC5ZXy_BDo

Example of use:

 function myFunction() {   
  var htmlparser = htmlparser2.init();
  var parser = new htmlparser.Parser({
    onopentag: function(name, attribs){
      if(name === "div"){
        Logger.log("found div");
      }
    },
    ontext: function(text){
      Logger.log("-->" + text); 
    },
    onclosetag: function(tagname){
      if(tagname === "div"){
        Logger.log("end div");
      }
     }
  }, {decodeEntities: true});
  parser.write('<div>outer<div>inner<br>inner 2</div></div>');
  parser.end();  
}

See https://github.com/fb55/htmlparser2 for more info on this library.

About

A browserified version of fb55/htmlparser2 modified to work in Google Apps Script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published