Skip to content

Commit b6dab00

Browse files
committed
Update READMEs, add a small section on module layout, note all examples are written from top-level import, update the cachebust on pydocs from 8.1.2 to 8.1.8, clear trailing whitespace.
1 parent bf12888 commit b6dab00

File tree

2 files changed

+80
-10
lines changed

2 files changed

+80
-10
lines changed

README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
AdvancedHTMLParser
33
==================
44

5-
AdvancedHTMLParser is an Advanced HTML Parser, with support for adding, removing, modifying, and formatting HTML.
5+
AdvancedHTMLParser is an Advanced HTML Parser, with support for adding, removing, modifying, and formatting HTML.
66

77
It aims to provide the same interface as you would find in a compliant browser through javascript ( i.e. all the getElement methods, appendChild, etc), as well as many more complex and sophisticated features not available through a browser. And most importantly, it's in python!
88

@@ -27,7 +27,7 @@ Another useful scenario is creating automated testing suites which can operate m
2727
Full API
2828
--------
2929

30-
Can be found http://htmlpreview.github.io/?https://github.com/kata198/AdvancedHTMLParser/blob/master/doc/AdvancedHTMLParser.html?vers=8.1.2 .
30+
Can be found http://htmlpreview.github.io/?https://github.com/kata198/AdvancedHTMLParser/blob/master/doc/AdvancedHTMLParser.html?vers=8.1.8 .
3131

3232

3333
Examples
@@ -40,6 +40,41 @@ Short Doc
4040
---------
4141

4242

43+
**The Package and Modules**
44+
45+
The top-level module in this package is "*AdvancedHTMLParser*."
46+
47+
48+
import AdvancedHTMLParser
49+
50+
51+
Most everything "public" is available through this top-level module, but some corner-case usages may require importing from a submodule. All of these associations can be found through the pydocs.
52+
53+
54+
For example, to access AdvancedTag, the recommended path is just to import the top-level, and use dot-access:
55+
56+
import AdvancedHTMLParser
57+
58+
myTag = AdvancedHTMLParser.AdvancedTag('div')
59+
60+
61+
However, you can also import AdvancedTag through this top-level module:
62+
63+
import AdvancedHTMLParser
64+
65+
from AdvancedHTMLParser import AdvancedTag
66+
67+
68+
Or, you can import from the specific sub-module, directly:
69+
70+
import AdvancedHTMLParser
71+
72+
from AdvancedHTMLParser.Tags import AdvancedTag
73+
74+
75+
All examples below are written as if "import AdvancedHTMLParser" has already been performed, and all relations in examples are based off usages from the top-level import, only.
76+
77+
4378
**AdvancedHTMLParser**
4479

4580
Think of this like "document" in a browser.
@@ -155,7 +190,7 @@ It also exposes the various getElement\* functions which operate on the elements
155190

156191
For example:
157192

158-
193+
159194
# Filter off the parser all tags with "item" in class
160195
tagCollection = document.getElementsByClassName('item')
161196

@@ -217,7 +252,7 @@ some of these include:
217252

218253
getPeersByAttr - Gets peers by an arbitrary attribute/value combination
219254

220-
getPeersWithAttrValues - Gets peers by an arbitrary attribute/values combination.
255+
getPeersWithAttrValues - Gets peers by an arbitrary attribute/values combination.
221256

222257
getPeersByClassName - Gets peers that contain a given class name
223258

@@ -412,7 +447,7 @@ InvalidAttributeNameException - An attribute name was found that contained an in
412447
IndexedAdvancedHTMLParser
413448
=========================
414449

415-
IndexedAdvancedHTMLParser provides the ability to use indexing for faster search. If you are just parsing and not modifying, this is your best bet. If you are modifying the DOM tree, make sure you call IndexedAdvancedHTMLParser.reindex() before relying on them.
450+
IndexedAdvancedHTMLParser provides the ability to use indexing for faster search. If you are just parsing and not modifying, this is your best bet. If you are modifying the DOM tree, make sure you call IndexedAdvancedHTMLParser.reindex() before relying on them.
416451

417452
Each of the get\* functions above takes an additional "useIndex" function, which can also be set to False to skip index. See constructor for more information, and "Performance and Indexing" section below.
418453

README.rst

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
AdvancedHTMLParser
33
==================
44

5-
AdvancedHTMLParser is an Advanced HTML Parser, with support for adding, removing, modifying, and formatting HTML.
5+
AdvancedHTMLParser is an Advanced HTML Parser, with support for adding, removing, modifying, and formatting HTML.
66

77
It aims to provide the same interface as you would find in a compliant browser through javascript ( i.e. all the getElement methods, appendChild, etc), as well as many more complex and sophisticated features not available through a browser. And most importantly, it's in python!
88

@@ -35,7 +35,7 @@ Another useful scenario is creating automated testing suites which can operate m
3535
Full API
3636
--------
3737

38-
Can be found http://htmlpreview.github.io/?https://github.com/kata198/AdvancedHTMLParser/blob/master/doc/AdvancedHTMLParser.html?vers=8.1.2 .
38+
Can be found http://htmlpreview.github.io/?https://github.com/kata198/AdvancedHTMLParser/blob/master/doc/AdvancedHTMLParser.html?vers=8.1.8 .
3939

4040

4141
Examples
@@ -48,6 +48,41 @@ Short Doc
4848
---------
4949

5050

51+
**The Package and Modules**
52+
53+
The top-level module in this package is "*AdvancedHTMLParser*."
54+
55+
56+
import AdvancedHTMLParser
57+
58+
59+
Most everything "public" is available through this top-level module, but some corner-case usages may require importing from a submodule. All of these associations can be found through the pydocs.
60+
61+
62+
For example, to access AdvancedTag, the recommended path is just to import the top-level, and use dot-access:
63+
64+
import AdvancedHTMLParser
65+
66+
myTag = AdvancedHTMLParser.AdvancedTag('div')
67+
68+
69+
However, you can also import AdvancedTag through this top-level module:
70+
71+
import AdvancedHTMLParser
72+
73+
from AdvancedHTMLParser import AdvancedTag
74+
75+
76+
Or, you can import from the specific sub-module, directly:
77+
78+
import AdvancedHTMLParser
79+
80+
from AdvancedHTMLParser.Tags import AdvancedTag
81+
82+
83+
All examples below are written as if "import AdvancedHTMLParser" has already been performed, and all relations in examples are based off usages from the top-level import, only.
84+
85+
5186
**AdvancedHTMLParser**
5287

5388
Think of this like "document" in a browser.
@@ -167,7 +202,7 @@ It also exposes the various getElement\* functions which operate on the elements
167202

168203
For example:
169204

170-
205+
171206
# Filter off the parser all tags with "item" in class
172207

173208
tagCollection = document.getElementsByClassName('item')
@@ -237,7 +272,7 @@ some of these include:
237272

238273
getPeersByAttr \- Gets peers by an arbitrary attribute/value combination
239274

240-
getPeersWithAttrValues \- Gets peers by an arbitrary attribute/values combination.
275+
getPeersWithAttrValues \- Gets peers by an arbitrary attribute/values combination.
241276

242277
getPeersByClassName \- Gets peers that contain a given class name
243278

@@ -435,7 +470,7 @@ InvalidAttributeNameException - An attribute name was found that contained an in
435470
IndexedAdvancedHTMLParser
436471
=========================
437472

438-
IndexedAdvancedHTMLParser provides the ability to use indexing for faster search. If you are just parsing and not modifying, this is your best bet. If you are modifying the DOM tree, make sure you call IndexedAdvancedHTMLParser.reindex() before relying on them.
473+
IndexedAdvancedHTMLParser provides the ability to use indexing for faster search. If you are just parsing and not modifying, this is your best bet. If you are modifying the DOM tree, make sure you call IndexedAdvancedHTMLParser.reindex() before relying on them.
439474

440475
Each of the get\* functions above takes an additional "useIndex" function, which can also be set to False to skip index. See constructor for more information, and "Performance and Indexing" section below.
441476

0 commit comments

Comments
 (0)