1.2.2 • Published 9 years ago
html-parse-regex v1.2.2
HTML-PARSE-REGEX
USING NEW PARSER - MANY FIXED BUGS!!
TWICE AS FAST - All process have a avg of 5 mileseconds!!!
I will help if you have any difficulty =)
Contact me by github:heyderpd. I'll be glad to help you.
Create tree object of html/xml raw file. Each node have:
- tag name
- all params tag parsed to a js object
- link to inner tags
First Steps NO MORE!
Now use es2015, don't need first steps! Thanks for: npm~lucasmreis
npm install npm install html-parse-regex
Example:
HTML
(<Object1>) <div id="A" align="left" style="margin-top:15px;">
(<Object2>) <div id="B" class="yttre">
(<Object3>) <strong>
(<Object4>) ASCII links
</strong>
</div>
</div>MAIN DATA OBJECT
html {
list: [ /* same object's but in list mode */
<Object1>,
<Object2>,
<Object3>,
<Object4>
],
tree: {
root: true,
link: { /* tree view mode */
childs: [ <Object1> ] /* object tag of div#A, base of this example */
}, /* inner this you found link for children tags */
},
shortcut: {
id: { A: <Object1>, B: <Object2> } /* link to tag object find by id */
}
error: {
forcedCloseTag: [ /* if need close any tag open tag will appear in this error object */
{ tag: 'a', start: 5, end: 38 }
]
}
}TAG OBJECT
/* TAG OBJECT */
<Object1> = {
tag: "div",
attrs: { id: "A", align: "left", style: "margin-top:15px;" },
start: 0,
end: 123,
link: {
father: tree,
childs: [ <Object2> ]
}
}
<Object2> = {
tag: "div",
attrs: { id: "B", class: "yttre" },
start: 0,
end: 123,
link: {
father: <Object1>,
childs: [ <Object3> ]
}
}
/* PURE TEXT OBJECT */
<Object4> = {
text: "ASCII links",
start: 20,
end: 31,
link: {
father: <Object3>
}
}##To create tree from raw html/xml Example:
import fs from 'fs';
import parse from 'html-parse-regex';
const htmlRaw = fs.readFileSync(`index.html`, 'utf8');
const html = parse(htmlRaw);1.2.2
9 years ago
1.2.1
9 years ago
1.2.0
9 years ago
1.1.3
9 years ago
1.1.2
9 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.7.3
9 years ago
0.7.2
9 years ago
0.7.1
9 years ago
0.7.0
9 years ago
0.6.5
9 years ago
0.6.4
9 years ago
0.6.3
9 years ago
0.6.2
9 years ago
0.6.1
9 years ago
0.6.0
9 years ago
0.5.1
9 years ago
0.5.0
9 years ago
0.4.8
9 years ago
0.4.7
10 years ago
0.4.6
10 years ago
0.4.5
10 years ago
0.4.4
10 years ago
0.4.3
10 years ago
0.4.2
10 years ago
0.4.1
10 years ago
0.4.0
10 years ago
0.0.0
10 years ago

