Skip to content

Commit

Permalink
update to latest versions of parser and code gen
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Escalante committed Jul 24, 2018
1 parent 5f583ce commit aacd47f
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 44 deletions.
14 changes: 13 additions & 1 deletion README.md
Expand Up @@ -108,7 +108,7 @@ Here, the default plugins applied to `ph` at the top will apply to all compiles,

Plugins act on an [abstract syntax tree](https://www.wikiwand.com/en/Abstract_syntax_tree) which represents the HTML structure, but is easier to search and modify than plain text. It is a very simple [recursive tree structure](https://www.wikiwand.com/en/Tree_(data_structure)). Each node in the tree is represented by an object, which is required to have a `type` property. The default code generator supports three data types:

#### String
#### Text

A string of plain text. The `content` property contains the string.

Expand All @@ -120,6 +120,18 @@ A string of plain text. The `content` property contains the string.
}
```

#### Doctype

A document type declaration. The `content` property contains the full contents, same as a text node, but there is no entity escaping for a doctype node.

```js
{
type: 'doctype',
content: '<!doctype html>',
location: { line: 1, col: 1, startOffset: 1, endOffset: 15 }
}
```

#### Tag

An HTML tag. Must have a `name` property with the tag name. Can optionally have an `attrs` property, which is an object with the key being a `string`, and the value being either a `string` or `code` type, or an array of multiple. Can also optionally have a `content` property, which can contain a full AST.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -16,13 +16,13 @@
"code-frame": "^5.0.0",
"joi": "^12.0.0",
"lodash.merge": "^4.6.1",
"reshape-code-gen": "^1.0.0",
"reshape-parser": "^0.3.1",
"reshape-code-gen": "^2.0.0",
"reshape-parser": "^1.0.0",
"when": "^3.7.8"
},
"devDependencies": {
"ava": "^0.25.0",
"coveralls": "^3.0.1",
"coveralls": "^3.0.2",
"matcha": "^0.7.0",
"nyc": "^12.0.2",
"posthtml-parser": "^0.4.0",
Expand Down

0 comments on commit aacd47f

Please sign in to comment.