Permalink
Browse files

More work:

* move parser into lib
* import entities from html5lib
* get more stuff working in the tokenizer
  • Loading branch information...
1 parent 9af9585 commit 6af006b12a549feffc591aadc092f80a7eadeff9 @wycats committed Apr 4, 2012
Showing with 1,646 additions and 7 deletions.
  1. +26 −1 Rakefile
  2. +1,061 −0 constants.rb
  3. +404 −0 lib/entities.js
  4. +142 −3 { → lib}/parser.js
  5. +8 −2 spec/spec_helper.rb
  6. +5 −1 spec/tokenizer_spec.rb
View
@@ -1 +1,26 @@
-require "bundler/setup"
+require "json"
+require "./constants"
+
+task :default do
+ File.open("lib/entities.js", "w") do |file|
+ file.puts "return {\n named: {\n"
+
+ out = []
+ HTML5::ENTITIES.each do |entity, string|
+ out << %{ #{entity.dup.force_encoding('UTF-8').to_json}: #{string.force_encoding('UTF-8').to_json}}
+ end
+ file.puts out.join(",\n")
+ file.puts " },\n"
+
+ out = []
+ file.puts " windows: [\n"
+ HTML5::ENTITIES_WINDOWS1252.each do |entity|
+ out << %{ #{entity}}
+ end
+ file.puts out.join(",\n")
+ file.puts " ]\n"
+
+ file.puts "}"
+ end
+end
+
Oops, something went wrong.

0 comments on commit 6af006b

Please sign in to comment.