Skip to content

Commit

Permalink
Document SAXParser changes from #247
Browse files Browse the repository at this point in the history
  • Loading branch information
inikulin committed May 1, 2018
1 parent 4754830 commit 0cad6b4
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 43 deletions.
48 changes: 5 additions & 43 deletions packages/parse5-sax-parser/docs/index.md
Expand Up @@ -119,19 +119,10 @@ Raised when the parser encounters a start tag.
| Param | Type |
| ------ | ------ |
| event | "startTag" |
| listener | `function` (see below) |
| listener | function (startTag: *[StartTagToken](./tokens/start-tag.md)*) |

**Returns:** `this`

**listener:** (name: *`string`*, attrs: *Attribute*[], selfClosing: *`boolean`*, location?: *[StartTagLocation](../../parse5/docs/source-code-location/start-tag-location.md)*): `void`

| Param | Type | Description |
| ------ | ------ | ------ |
| name |`string`|Tag name.|
|attrs|Attribute|List of attributes.|
|selfClosing|`boolean`|Indicates if the tag is self-closing.|
|`Optional` location|[StartTagLocation](../../parse5/docs/source-code-location/start-tag-location.md)|Start tag source code location info. Available if location info is enabled via [SAXParserOptions](sax-parser-options.md).|

___
<a id="on_endtag"></a>

Expand All @@ -146,17 +137,10 @@ Raised then parser encounters an end tag.
| Param | Type |
| ------ | ------ |
| event | "endTag" |
| listener | `function` (see below) |
| listener | function (endTag: *[EndTagToken](./tokens/end-tag.md)*) |

**Returns:** `this`

**listener:** (name: *`string`*, location?: *[Location](../../parse5/docs/source-code-location/location.md)*): `void`

| Param | Type | Description |
| ------ | ------ | ------ |
|name|`string`|Tag name.|
|`Optional` location|[Location](../../parse5/docs/source-code-location/location.md)| End tag source code location info. Available if location info is enabled via [SAXParserOptions](sax-parser-options.md)|

___
<a id="on_comment"></a>

Expand All @@ -171,16 +155,10 @@ Raised then parser encounters a comment.
| Param | Type |
| ------ | ------ |
| event | "comment" |
| listener | `function` (see below) |
| listener | function (comment: *[CommentToken](./tokens/comment.md)*) |

**Returns:** `this`

**listener:** (text: *`string`*, location?: *[Location](../../parse5/docs/source-code-location/location.md)*): `void`

| Param | Type | Description |
| ------ | ------ | ------ |
|text| `string`| Comment text.|
|`Optional` location| [Location](../../parse5/docs/source-code-location/location.md)| Comment source code location info. Available if location info is enabled via [SAXParserOptions](sax-parser-options.md)|
___
<a id="on_text"></a>

Expand All @@ -195,16 +173,10 @@ Raised then parser encounters text content.
| Param | Type |
| ------ | ------ |
| event | "text" |
| listener | `function` (see below)|
| listener | function (textContent: *[TextToken](./tokens/text.md)*)|

**Returns:** `this`

**listener:** (text: *`string`*, location?: [Location](../../parse5/docs/source-code-location/location.md)): `void`

| Param | Type | Description |
| ------ | ------ | ------ |
|text|`string`| Text content.|
|`Optional` location| [Location](../../parse5/docs/source-code-location/location.md)| Text content source code location info. Available if location info is enabled via [SAXParserOptions](sax-parser-options.md)|
___
<a id="on_doctype"></a>

Expand All @@ -219,18 +191,8 @@ Raised then parser encounters a [document type declaration](https://en.wikipedia
| Param | Type |
| ------ | ------ |
| event | "doctype" |
| listener | `function` (see below) |
| listener | function (textContent: *[DoctypeToken](./tokens/doctype.md)*) |

**Returns:** `this`

**listener:** (name: *`string`*, publicId: *`string`*, systemId: *`string`*, location?: [Location](../../parse5/docs/source-code-location/location.md)): `void`


| Param | Type | Description |
| ------ | ------ | ------ |
|name|`string`| Document type name.|
|publicId|`string`| Document type public identifier.|
|systemId|`string`| Document type system identifier.|
|`Optional` location| [Location](../../parse5/docs/source-code-location/location.md)| Document type declaration source code location info. Available if location info is enabled via [SAXParserOptions](sax-parser-options.md)|

___
19 changes: 19 additions & 0 deletions packages/parse5-sax-parser/docs/sax-parser-options.md
@@ -0,0 +1,19 @@
# Interface: SAXParserOptions

### Properties

* [sourceCodeLocationInfo](#locationinfo)

---

## Properties

<a id="locationinfo"></a>

### `<Optional>` sourceCodeLocationInfo

**● locationInfo**: *`boolean`*

Enables source code location information for the tokens. When enabled, each token event handler will receive [Location](../../parse5/docs/source-code-location/location.md) (or [StartTagLocation](../../parse5/docs/source-code-location/start-tag-location.md)) object as its last argument.

___
30 changes: 30 additions & 0 deletions packages/parse5-sax-parser/docs/tokens/comment.md
@@ -0,0 +1,30 @@
# Interface: CommentToken

### Properties

* [text](#text)
* [sourceCodeLocation](#sourcecodelocation)

---

## Properties

<a id="text"></a>

### text

**● text**: *`string`*

Comment text

___

<a id="sourcecodelocation"></a>

### `<Optional>` sourceCodeLocation

**● sourceCodeLocation**: *[Location](../../../parse5/docs/source-code-location/location.md)*

Comment source code location info. Available if location info is enabled via [SAXParserOptions](../sax-parser-options.md)

___
51 changes: 51 additions & 0 deletions packages/parse5-sax-parser/docs/tokens/doctype.md
@@ -0,0 +1,51 @@
# Interface: DoctypeToken

### Properties

* [name](#name)
* [publicId](#publicid)
* [systemId](#systemid)
* [sourceCodeLocation](#sourcecodelocation)

---

## Properties

<a id="name"></a>

### name

**● name**: *`string`*

Document type name.

___
<a id="publicid"></a>

### publicId

**● publicId**: *`string`*

Document type public identifier.

___
<a id="systemid"></a>

### systemId

**● systemId**: *`string`*

Document type system identifier.

___


<a id="sourcecodelocation"></a>

### `<Optional>` sourceCodeLocation

**● sourceCodeLocation**: *[Location](../../../parse5/docs/source-code-location/location.md)*

Text content source code location info. Available if location info is enabled via [SAXParserOptions](../sax-parser-options.md)

___
30 changes: 30 additions & 0 deletions packages/parse5-sax-parser/docs/tokens/end-tag.md
@@ -0,0 +1,30 @@
# Interface: EndTagToken

### Properties

* [name](#name)
* [sourceCodeLocation](#sourcecodelocation)

---

## Properties

<a id="name"></a>

### name

**● name**: *`string`*

Tag name

___

<a id="sourcecodelocation"></a>

### `<Optional>` sourceCodeLocation

**● sourceCodeLocation**: *[Location](../../../parse5/docs/source-code-location/location.md)*

End tag source code location info. Available if location info is enabled via [SAXParserOptions](../sax-parser-options.md)

___
49 changes: 49 additions & 0 deletions packages/parse5-sax-parser/docs/tokens/start-tag.md
@@ -0,0 +1,49 @@
# Interface: StartTagToken

### Properties

* [attrs](#attrs)
* [name](#name)
* [selfClosing](#selfclosing)
* [sourceCodeLocation](#sourcecodelocation)

---

## Properties

<a id="attrs"></a>

### attrs

**● attrs**: *Attribute*[]

List of attributes

___
<a id="name"></a>

### name

**● name**: *`string`*

Tag name

___
<a id="selfclosing"></a>

### selfClosing

**● selfClosing**: *`boolean`*

Indicates if the tag is self-closing

___
<a id="sourcecodelocation"></a>

### `<Optional>` sourceCodeLocation

**● sourceCodeLocation**: *[StartTagLocation](../../../parse5/docs/source-code-location/start-tag-location.md)*

Start tag source code location info. Available if location info is enabled via [SAXParserOptions](../sax-parser-options.md)

___
30 changes: 30 additions & 0 deletions packages/parse5-sax-parser/docs/tokens/text.md
@@ -0,0 +1,30 @@
# Interface: TextToken

### Properties

* [text](#text)
* [sourceCodeLocation](#sourcecodelocation)

---

## Properties

<a id="text"></a>

### text

**● text**: *`string`*

Text content

___

<a id="sourcecodelocation"></a>

### `<Optional>` sourceCodeLocation

**● sourceCodeLocation**: *[Location](../../../parse5/docs/source-code-location/location.md)*

Text content source code location info. Available if location info is enabled via [SAXParserOptions](../sax-parser-options.md)

___

0 comments on commit 0cad6b4

Please sign in to comment.