-OBJECTS= parse-html.js test.js
+OBJECTS= parse-html.js test.js html5-named-entities.js
all: $(OBJECTS)
%.js: %.coffee
- coffee -c $<
+ coffee -c $< && sed -i -e 's/\(parse-html\|html5-named-entities\)[.]coffee/\1.js/g' $@
clean:
rm -f $(OBJECTS)
Dependancies: node.js, coffeescript
-You can get CoffeeScript with a command such as this:
+1. Install node.js https://nodejs.org/en/
- apt-get install coffeescript
+2. Install coffeescript. Try:
-or
+ apt-get install coffeescript
+ or
- npm install -g coffee-script
+ npm install -g coffee-script
-Now you can run the test suite like this:
+3. You can run the tests directly from coffeescript:
- coffee test.coffee
+ coffee test.coffee
-Or use the parser from your own code:
+4. Compile to javascript:
- wheic = require './parse-html.coffee'
- dom = wheic.parse_html "foo <b>bar"
+ make
+
+5. Run tests via compiled code:
+
+ nodejs test.js
+
+5. Try using the parser in your own code:
+
+ var wheic = require('./parse-html.js');
+ var dom = wheic.parse_html("<p>hi</p>", {fragment: 'body'});
+ ...
Feedback, Questions, Etc