@yozora/tokenizer-html-block 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020-2021 guanghechen (me.guanghechen@gmail.com)
3
+ Copyright (c) 2020-2022 guanghechen (me.guanghechen@gmail.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yozora/tokenizer-html-block",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "author": {
5
5
  "name": "guanghechen",
6
6
  "url": "https://github.com/guanghechen/"
@@ -30,14 +30,14 @@
30
30
  ],
31
31
  "scripts": {
32
32
  "build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.js",
33
- "prebuild": "rimraf lib/ && tsc -p tsconfig.src.json --emitDeclarationOnly",
33
+ "prebuild": "rimraf lib/",
34
34
  "prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build",
35
35
  "test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
36
36
  },
37
37
  "dependencies": {
38
- "@yozora/ast": "^2.0.2",
39
- "@yozora/character": "^2.0.2",
40
- "@yozora/core-tokenizer": "^2.0.2"
38
+ "@yozora/ast": "^2.0.3",
39
+ "@yozora/character": "^2.0.3",
40
+ "@yozora/core-tokenizer": "^2.0.3"
41
41
  },
42
- "gitHead": "6911295e9eacfa29563fe93494704190e50625fd"
42
+ "gitHead": "8cc8f95cfebc8d752bc3272cdd24965f540c130b"
43
43
  }
@@ -1,26 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * Eat block html start condition 1:
4
- *
5
- * line begins with the string `<script`, `<pre`, or
6
- * `<style` (case-insensitive), followed by whitespace, the string `>`,
7
- * or the end of the line.
8
- *
9
- * @param nodePoints
10
- * @param startIndex
11
- * @param endIndex
12
- * @see https://github.github.com/gfm/#start-condition
13
- */
14
- export declare function eatStartCondition1(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, tagName: string): number | null;
15
- /**
16
- * Eat block html end condition 1:
17
- *
18
- * line contains an end tag `</script>`, `</pre>`,
19
- * or `</style>` (case-insensitive; it need not match the start tag).
20
- *
21
- * @param nodePoints
22
- * @param startIndex
23
- * @param endIndex
24
- * @see https://github.github.com/gfm/#start-condition
25
- */
26
- export declare function eatEndCondition1(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,23 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * Eat block html start condition 2:
4
- *
5
- * Line begins with the string `<!--`.
6
- *
7
- * @param nodePoints
8
- * @param startIndex
9
- * @param endIndex
10
- * @see https://github.github.com/gfm/#start-condition
11
- */
12
- export declare function eatStartCondition2(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
- /**
14
- * Eat block html end condition 2:
15
- *
16
- * line contains the string `-->`.
17
- *
18
- * @param nodePoints
19
- * @param startIndex
20
- * @param endIndex
21
- * @see https://github.github.com/gfm/#start-condition
22
- */
23
- export declare function eatEndCondition2(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,23 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * Eat block html start condition 3:
4
- *
5
- * line begins with the string `<?`.
6
- *
7
- * @param nodePoints
8
- * @param startIndex
9
- * @param endIndex
10
- * @see https://github.github.com/gfm/#start-condition
11
- */
12
- export declare function eatStartCondition3(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
- /**
14
- * Eat block html end condition 3:
15
- *
16
- * line contains the string `?>`.
17
- *
18
- * @param nodePoints
19
- * @param startIndex
20
- * @param endIndex
21
- * @see https://github.github.com/gfm/#start-condition
22
- */
23
- export declare function eatEndCondition3(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,23 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * Eat block html start condition 4:
4
- *
5
- * line begins with the string `<!` followed by an uppercase ASCII letter.
6
- *
7
- * @param nodePoints
8
- * @param startIndex
9
- * @param endIndex
10
- * @see https://github.github.com/gfm/#start-condition
11
- */
12
- export declare function eatStartCondition4(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
- /**
14
- * Eat block html end condition 4:
15
- *
16
- * line contains the character >.
17
- *
18
- * @param nodePoints
19
- * @param startIndex
20
- * @param endIndex
21
- * @see https://github.github.com/gfm/#start-condition
22
- */
23
- export declare function eatEndCondition4(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,23 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * Eat block html start condition 5:
4
- *
5
- * line begins with the string `<![CDATA[`.
6
- *
7
- * @param nodePoints
8
- * @param startIndex
9
- * @param endIndex
10
- * @see https://github.github.com/gfm/#start-condition
11
- */
12
- export declare function eatStartCondition5(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
13
- /**
14
- * Eat block html end condition 5:
15
- *
16
- * line contains the string `]]>`.
17
- *
18
- * @param nodePoints
19
- * @param startIndex
20
- * @param endIndex
21
- * @see https://github.github.com/gfm/#start-condition
22
- */
23
- export declare function eatEndCondition5(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;
@@ -1,22 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * Eat block html start condition 6:
4
- *
5
- * line begins the string `<` or `</` followed by one of
6
- * the strings (case-insensitive) `address`, `article`, `aside`, `base`,
7
- * `basefont`, `blockquote`, `body`, `caption`, `center`, `col`, `colgroup`,
8
- * `dd`, `details`, `dialog`, `dir`, `div`, `dl`, `dt`, `fieldset`,
9
- * `figcaption`, `figure`, `footer`, `form`, `frame`, `frameset`, `h1`,
10
- * `h2`, `h3`, `h4`, `h5`, `h6`, `head`, `header`, `hr`, `html`, `iframe`,
11
- * `legend`, `li`, `link`, `main`, `menu`, `menuitem`, `nav`, `noframes`,
12
- * `ol`, `optgroup`, `option`, `p`, `param`, `section`, `source`, `summary`,
13
- * `table`, `tbody`, `td`, `tfoot`, `th`, `thead`, `title`, `tr`, `track`,
14
- * `ul`, followed by whitespace, the end of the line, the string `>`,
15
- * or the string `/>`.
16
- *
17
- * @param nodePoints
18
- * @param startIndex
19
- * @param endIndex
20
- * @see https://github.github.com/gfm/#start-condition
21
- */
22
- export declare function eatStartCondition6(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, tagName: string): number | null;
@@ -1,14 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * Eat block html start condition 7:
4
- *
5
- * line begins with a complete open tag (with any tag name
6
- * other than `script`, `style`, or `pre`) or a complete closing tag,
7
- * followed only by whitespace or the end of the line
8
- *
9
- * @param nodePoints
10
- * @param startIndex
11
- * @param endIndex
12
- * @see https://github.github.com/gfm/#start-condition
13
- */
14
- export declare function eatStartCondition7(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, tagName: string, potentialOpenTag: boolean): number | null;
@@ -1,10 +0,0 @@
1
- import type { IMatchBlockHookCreator } from '@yozora/core-tokenizer';
2
- import type { IThis, IToken, T } from './types';
3
- /**
4
- * An HTML block is a group of lines that is treated as raw HTML (and will not
5
- * be escaped in HTML output).
6
- *
7
- * @see https://github.com/syntax-tree/mdast#html
8
- * @see https://github.github.com/gfm/#html-blocks
9
- */
10
- export declare const match: IMatchBlockHookCreator<T, IToken, IThis>;
@@ -1,3 +0,0 @@
1
- import type { IParseBlockHookCreator } from '@yozora/core-tokenizer';
2
- import type { INode, IThis, IToken, T } from './types';
3
- export declare const parse: IParseBlockHookCreator<T, IToken, INode, IThis>;
@@ -1,13 +0,0 @@
1
- import type { IBlockTokenizer, IMatchBlockHookCreator, IParseBlockHookCreator } from '@yozora/core-tokenizer';
2
- import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
3
- import type { INode, IThis, IToken, ITokenizerProps, T } from './types';
4
- /**
5
- * Lexical Analyzer for HtmlBlock.
6
- * @see https://github.com/syntax-tree/mdast#html
7
- * @see https://github.github.com/gfm/#html-blocks
8
- */
9
- export declare class HtmlBlockTokenizer extends BaseBlockTokenizer<T, IToken, INode, IThis> implements IBlockTokenizer<T, IToken, INode, IThis> {
10
- constructor(props?: ITokenizerProps);
11
- readonly match: IMatchBlockHookCreator<T, IToken, IThis>;
12
- readonly parse: IParseBlockHookCreator<T, IToken, INode, IThis>;
13
- }
@@ -1,64 +0,0 @@
1
- import type { Html, HtmlType } from '@yozora/ast';
2
- import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, IPhrasingContentLine, ITokenizer } from '@yozora/core-tokenizer';
3
- export declare type T = HtmlType;
4
- export declare type INode = Html;
5
- export declare const uniqueName = "@yozora/tokenizer-html-block";
6
- export declare type HtmlBlockConditionType = 1 | 2 | 3 | 4 | 5 | 6 | 7;
7
- /**
8
- * Middle state during the whole match and parse phase.
9
- */
10
- export interface IToken extends IPartialYastBlockToken<T> {
11
- /**
12
- * Number of conditions defined in GFM:
13
- *
14
- * 1. Start condition: line begins with the string `<script`, `<pre`, or
15
- * `<style` (case-insensitive), followed by whitespace, the string `>`,
16
- * or the end of the line.
17
- *
18
- * End condition: line contains an end tag `</script>`, `</pre>`,
19
- * or `</style>` (case-insensitive; it need not match the start tag).
20
- *
21
- * 2. Start condition: line begins with the string `<!--`.
22
- * End condition: line contains the string `-->`.
23
- *
24
- * 3. Start condition: line begins with the string `<?`.
25
- * End condition: line contains the string `?>`.
26
- *
27
- * 4. Start condition: line begins with the string `<!` followed by an
28
- * uppercase ASCII letter.
29
- *
30
- * End condition: line contains the character >.
31
- *
32
- * 5. Start condition: line begins with the string `<![CDATA[`.
33
- * End condition: line contains the string `]]>`.
34
- *
35
- * 6. Start condition: line begins the string `<` or `</` followed by one of
36
- * the strings (case-insensitive) `address`, `article`, `aside`, `base`,
37
- * `basefont`, `blockquote`, `body`, `caption`, `center`, `col`, `colgroup`,
38
- * `dd`, `details`, `dialog`, `dir`, `div`, `dl`, `dt`, `fieldset`,
39
- * `figcaption`, `figure`, `footer`, `form`, `frame`, `frameset`, `h1`,
40
- * `h2`, `h3`, `h4`, `h5`, `h6`, `head`, `header`, `hr`, `html`, `iframe`,
41
- * `legend`, `li`, `link`, `main`, `menu`, `menuitem`, `nav`, `noframes`,
42
- * `ol`, `optgroup`, `option`, `p`, `param`, `section`, `source`, `summary`,
43
- * `table`, `tbody`, `td`, `tfoot`, `th`, `thead`, `title`, `tr`, `track`,
44
- * `ul`, followed by whitespace, the end of the line, the string `>`,
45
- * or the string `/>`.
46
- *
47
- * End condition: line is followed by a blank line.
48
- *
49
- * 7. Start condition: line begins with a complete open tag (with any tag name
50
- * other than `script`, `style`, or `pre`) or a complete closing tag,
51
- * followed only by whitespace or the end of the line.
52
- *
53
- * End condition: line is followed by a blank line.
54
- *
55
- * @see https://github.github.com/gfm/#start-condition
56
- */
57
- condition: HtmlBlockConditionType;
58
- /**
59
- * Contents
60
- */
61
- lines: Array<Readonly<IPhrasingContentLine>>;
62
- }
63
- export declare type IThis = ITokenizer;
64
- export declare type ITokenizerProps = Partial<IBaseBlockTokenizerProps>;
@@ -1,24 +0,0 @@
1
- import type { INodeInterval, INodePoint } from '@yozora/character';
2
- export interface RawHTMLAttribute {
3
- /**
4
- * Attribute name.
5
- */
6
- name: INodeInterval;
7
- /**
8
- * Attribute value.
9
- */
10
- value?: INodeInterval;
11
- }
12
- /**
13
- * An attribute consists of whitespace, an attribute name, and an optional
14
- * attribute value specification.
15
- *
16
- * @param nodePoints
17
- * @param startIndex
18
- * @param endIndex
19
- * @see https://github.github.com/gfm/#attribute
20
- */
21
- export declare function eatHTMLAttribute(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): {
22
- attribute: RawHTMLAttribute;
23
- nextIndex: number;
24
- } | null;
@@ -1,11 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * A tag name consists of an ASCII letter followed by zero or more ASCII
4
- * letters, digits, or hyphens (-).
5
- *
6
- * @param nodePoints
7
- * @param startIndex
8
- * @param endIndex
9
- * @see https://github.github.com/gfm/#tag-name
10
- */
11
- export declare function eatHTMLTagName(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number | null;