Quick Start Guide
-----------------
-1. Open ``test.html`` in your browser.
+1. Open ``parser_tests_coffee.html`` in your browser.
2. Open the console (right-click, inspect this element, console)
4. Try running the parser in the console, example:
- window.wheic.parse_html("<p>foo</p>", {fragment: "body"})
+ window.wheic_parser.parse("<p>foo</p>", {fragment: "body"})
For further reading, see "Running Under node.js" below.
Running Under node.js
---------------------
-Dependancies: node.js, coffeescript
+Dependencies: 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:
+4. Compile to javascript:
- coffee test.coffee
+ make
-Or use the parser from your own code:
+Now you can do any of these things in any order:
- wheic = require './parse-html.coffee'
- dom = wheic.parse_html "foo <b>bar"
+* Run the tests directly from CoffeeScript:
+
+ coffee parser_tests.coffee
+
+* Test the compiled (javascript) parser in your favorite browser by opening
+ up ``parser_tests.html`` and looking at the console.
+
+* Run tests via compiled code:
+
+ nodejs parser_tests.js
+
+* Try using the parser in your own javascript node.js project:
+
+ var html5 = require('./parser.js');
+ var dom = html5.parse("<p>hi</p>", {fragment: 'body'});
+ ...
+
+* Try using the parser in your own CoffeeScript node.js project:
+
+ html5 = require './parser.js'
+ dom = html5.parse "<p>hi</p>", fragment: 'body'
+ ...
+
+ Note: the CoffeeScript compile time is significant, so you'll want to use
+ the compiled javascript even though you could use the ``.coffee`` version.
Feedback, Questions, Etc