From: Jason Woofenden
Date: Fri, 12 May 2017 17:37:13 +0000 (-0400)
Subject: parser tests to javascript
X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-html5-editor.git;a=commitdiff_plain;h=80153058975905b53418f34498b799922f3def07;hp=5aef791edd38fb3d70a71266ad0b42cf9fb45593
parser tests to javascript
---
diff --git a/.gitignore b/.gitignore
index e96e716..4a481e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-/parser_tests.js
/editor.js
/editor_tests.js
/page_dark.css
diff --git a/Makefile b/Makefile
index 0c8ee69..ec22ed0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-OBJECTS= parser_tests.js editor.js editor_tests.js page_dark.css
+OBJECTS= editor.js editor_tests.js page_dark.css
all: $(OBJECTS)
diff --git a/README.md b/README.md
index 26edc34..faf03b3 100644
--- a/README.md
+++ b/README.md
@@ -99,5 +99,5 @@ Now you can do any of these things in any order:
Feedback, Questions, Etc
------------------------
-Please communicate directly with Jason Woofenden by email: jason@jasonwoof.com
-or on freenode /msg JasonWoof
+Please communicate directly with Jason Woofenden via his website:
+https://jasonwoof.com/contact
diff --git a/parser.js b/parser.js
index ea87c85..7df5113 100644
--- a/parser.js
+++ b/parser.js
@@ -41,7 +41,7 @@
//
// See README.md for how to run this file in the browser or in node.js.
//
-// This file exports a single useful function: parse_tml, and some constants
+// This file exports a single useful function: parse, and some constants
// (see the bottom of this file for those.)
//
// Call it like this:
@@ -52,7 +52,13 @@
//
// peach_parser.parse("
hi
", {fragment: "body"})
//
-// return value is an array of Nodes, see "class Node" below.
+// return value is an array of Nodes, A Node contains:
+// type: one of: "tag", "text", "comment", "doctype"
+// text: contents for text/comment nodes
+// attrs: object of attributes, eg {href: "#main"}
+// children: array of Nodes
+// namespace: one of: "html", "mathml", "svg"
+// parent: another Node or null
// This code is a work in progress, eg try search this file for "fixfull",
// "TODO" and "FIXME"
@@ -145,10 +151,11 @@ function Node (type, args) {
this.name = args.name != null ? args.name : '' // tag name
this.text = args.text != null ? args.text : '' // contents for text/comment nodes
this.attrs = args.attrs != null ? args.attrs : {}
- this.attrs_a = args.attr_k != null ? args.attr_k : [] // attrs in progress, TYPE_START_TAG only
this.children = args.children != null ? args.children : []
this.namespace = args.namespace != null ? args.namespace : NS_HTML
this.parent = args.parent != null ? args.parent : null
+ // private:
+ this.attrs_a = args.attr_k != null ? args.attr_k : [] // attrs in progress, TYPE_START_TAG only
this.token = args.token != null ? args.token : null
this.flags = args.flags != null ? args.flags : {}
if (args.id != null) {
diff --git a/parser_tests.coffee b/parser_tests.coffee
deleted file mode 100644
index cc65725..0000000
--- a/parser_tests.coffee
+++ /dev/null
@@ -1,8019 +0,0 @@
-# Copyright (c) 2006-2015 Jason Woofenden, James Graham, Geoffrey Sneddon, and
-# other contributors
-#
-# The values in the following data structure were extracted from the project at
-# https://github.com/html5lib/html5lib-tests which has the following notice:
-#
-# Copyright (c) 2006-2013 James Graham, Geoffrey Sneddon, and
-# other contributors
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# The rest of this file was written by Jason Woofenden in 2015-2016, and is
-# released under the terms of the CC0 license:
-# http://creativecommons.org/publicdomain/zero/1.0/ and into the public domain
-
-tests = [
- {
- name: "adoption01.dat #1"
- html: "