-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,494 additions
and
5,559 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Publish | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Publish package | ||
run: npx jsr publish |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"type": "node", | ||
"program": "${workspaceFolder}/main.ts", | ||
"cwd": "${workspaceFolder}", | ||
"env": {}, | ||
"runtimeExecutable": "C:\\Users\\mgamb\\.deno\\bin\\deno.EXE", | ||
"runtimeArgs": [ | ||
"run", | ||
"--inspect-wait", | ||
"--allow-all" | ||
], | ||
"attachSimplePort": 9229 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"deno.enable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# HtmlParser | ||
|
||
|
||
```html | ||
<div><input disabled required type='text' /></div> | ||
<div><input disabled required type="text" /></div> | ||
``` | ||
|
||
```js | ||
const hp = new HtmlParser() | ||
const hp = new HtmlParser(); | ||
|
||
let result = hp.Parse("<div><input disabled required type='text' /></div>") | ||
let result = hp.Parse("<div><input disabled required type='text' /></div>"); | ||
``` | ||
|
||
![Screenshot](docs/output-screenshot.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
export const snapshot = {}; | ||
|
||
snapshot[`HtmlParser Tests > simple test 1`] = ` | ||
HtmlNode { | ||
_outerHTML: "<div />", | ||
attributes: { | ||
"/": undefined, | ||
}, | ||
children: [], | ||
content: undefined, | ||
endIndex: 7, | ||
endTag: undefined, | ||
selfClosing: undefined, | ||
startIndex: 0, | ||
tag: "div", | ||
type: 3, | ||
} | ||
`; | ||
|
||
snapshot[`HtmlParser Tests > attribute test 1`] = ` | ||
HtmlNode { | ||
_outerHTML: "<input disabled required type='text' />", | ||
attributes: { | ||
disabled: undefined, | ||
required: undefined, | ||
type: "text", | ||
}, | ||
children: [], | ||
content: undefined, | ||
endIndex: 39, | ||
endTag: "", | ||
selfClosing: true, | ||
startIndex: 0, | ||
tag: "input", | ||
type: 3, | ||
} | ||
`; | ||
|
||
snapshot[`HtmlParser Tests > attribute test 2`] = ` | ||
HtmlNode { | ||
_outerHTML: "<div><input disabled required type='text' /></div>", | ||
attributes: {}, | ||
children: [ | ||
HtmlNode { | ||
_outerHTML: "<input disabled required type='text' />", | ||
attributes: { | ||
disabled: undefined, | ||
required: undefined, | ||
type: "text", | ||
}, | ||
children: [], | ||
content: undefined, | ||
endIndex: 44, | ||
endTag: "", | ||
selfClosing: true, | ||
startIndex: 5, | ||
tag: "input", | ||
type: 3, | ||
}, | ||
], | ||
content: undefined, | ||
endIndex: 50, | ||
endTag: "div", | ||
selfClosing: undefined, | ||
startIndex: 0, | ||
tag: "div", | ||
type: 3, | ||
} | ||
`; | ||
|
||
snapshot[`HtmlParser Tests > incomplete sample 1`] = ` | ||
[ | ||
HtmlNode { | ||
_outerHTML: '<article id="edito', | ||
attributes: { | ||
dito: "ito", | ||
id: "edito", | ||
ito: "to", | ||
o: undefined, | ||
to: "o", | ||
}, | ||
children: [], | ||
content: undefined, | ||
endIndex: 18, | ||
endTag: undefined, | ||
selfClosing: undefined, | ||
startIndex: 0, | ||
tag: "article", | ||
type: 3, | ||
}, | ||
] | ||
`; | ||
|
||
snapshot[`HtmlParser Tests > jsx sample 1`] = ` | ||
[ | ||
HtmlNode { | ||
_outerHTML: "<fieldset> | ||
<legend>Enter temperature in {scaleNames[scale]}:</legend> | ||
<input value={temperature} | ||
onChange={this.handleChange} /> | ||
</fieldset>", | ||
attributes: {}, | ||
children: [ | ||
HtmlNode { | ||
_outerHTML: "<legend>Enter temperature in {scaleNames[scale]}:</legend>", | ||
attributes: {}, | ||
children: [ | ||
HtmlNode { | ||
_outerHTML: undefined, | ||
attributes: {}, | ||
children: [], | ||
content: "Enter temperature in {scaleNames[scale]}:", | ||
endIndex: 0, | ||
endTag: undefined, | ||
selfClosing: undefined, | ||
startIndex: 0, | ||
tag: undefined, | ||
type: 4, | ||
}, | ||
], | ||
content: undefined, | ||
endIndex: 77, | ||
endTag: "legend", | ||
selfClosing: undefined, | ||
startIndex: 19, | ||
tag: "legend", | ||
type: 3, | ||
}, | ||
HtmlNode { | ||
_outerHTML: "<input value={temperature} | ||
onChange={this.handleChange} />", | ||
attributes: { | ||
onChange: "{this.handleChange}", | ||
value: "{temperature} | ||
", | ||
}, | ||
children: [], | ||
content: undefined, | ||
endIndex: 159, | ||
endTag: "", | ||
selfClosing: true, | ||
startIndex: 86, | ||
tag: "input", | ||
type: 3, | ||
}, | ||
], | ||
content: undefined, | ||
endIndex: 177, | ||
endTag: "fieldset", | ||
selfClosing: undefined, | ||
startIndex: 0, | ||
tag: "fieldset", | ||
type: 3, | ||
}, | ||
] | ||
`; |
Oops, something went wrong.