mirror of
https://github.com/msva/lua-htmlparser.git
synced 2024-11-27 12:44:22 +00:00
After proofreading on the site
This commit is contained in:
parent
4a9fa0a790
commit
24e1a7d660
61
README.md
61
README.md
@ -36,20 +36,21 @@ end
|
|||||||
```
|
```
|
||||||
|
|
||||||
###Selectors
|
###Selectors
|
||||||
- "element"
|
- `"element"`
|
||||||
- "#id"
|
- `"#id"`
|
||||||
- ".class"
|
- `".class"`
|
||||||
- "[attribute]"
|
- `"[attribute]"`
|
||||||
- "[attribute=value]"
|
- `"[attribute=value]"`
|
||||||
- "[attribute!=value]"
|
- `"[attribute!=value]"`
|
||||||
- "[attribute|=value]"
|
- `"[attribute|=value]"`
|
||||||
- "[attribute*=value]"
|
- `"[attribute*=value]"`
|
||||||
- "[attribute~=value]"
|
- `"[attribute~=value]"`
|
||||||
- "[attribute^=value]"
|
- `"[attribute^=value]"`
|
||||||
- "[attribute$=value]"
|
- `"[attribute$=value]"`
|
||||||
- ":not(selector)"
|
- `":not(selector)"`
|
||||||
- "ancestor descendant"
|
- `"ancestor descendant"`
|
||||||
- "parent > child"
|
- `"parent > child"`
|
||||||
|
|
||||||
Selectors can be combined; e.g. ".class:not([attribute]) element.class"
|
Selectors can be combined; e.g. ".class:not([attribute]) element.class"
|
||||||
|
|
||||||
####Limitations
|
####Limitations
|
||||||
@ -57,19 +58,19 @@ Selectors can be combined; e.g. ".class:not([attribute]) element.class"
|
|||||||
- Likewise, for the parent > child relation, the spaces before and after the > are mandatory
|
- Likewise, for the parent > child relation, the spaces before and after the > are mandatory
|
||||||
|
|
||||||
###Element type
|
###Element type
|
||||||
The tree elements provide, apart from :select and (), the following accessors:
|
All tree elements provide, apart from `:select` and `()`, the following accessors:
|
||||||
- .name = the elements tagname
|
- `.name` = the element's tagname
|
||||||
- .attributes = a table with keys and values for the element's attributes
|
- `.attributes` = a table with keys and values for the element's attributes; `{}` if none
|
||||||
- .id = the value of the element's id attribute, if present
|
- `.id` = the value of the element's id attribute; `nil` if not present
|
||||||
- .classes = an array with the classes listed in element's class attribute, if any
|
- `.classes` = an array with the classes listed in element's class attribute; `{}` if none
|
||||||
- :getcontent() = the raw text between the opening and closing tags of the element
|
- `:getcontent()` = the raw text between the opening and closing tags of the element; `""` if none
|
||||||
- .nodes = an array with the element's child elements
|
- `.nodes` = an array with the element's child elements, `{}` if none
|
||||||
- .parent = the elements that contains this element; root.parent is nil
|
- `.parent` = the elements that contains this element; `root.parent` is `nil`
|
||||||
- :gettext() = the raw text of the complete element, starting with `"<tagname"` and ending with `"/>"`
|
- `:gettext()` = the raw text of the complete element, starting with `"<tagname"` and ending with `"/>"`
|
||||||
- .level = how deep the element is in the tree; root level is 0
|
- `.level` = how deep the element is in the tree; root level is `0`
|
||||||
- .root the root element of the tree; root.root is root
|
- `.root` the root element of the tree; `root.root` is `root`
|
||||||
- .deepernodes = a Set containing all elements in the tree beneath this element, including this element's .nodes
|
- `.deepernodes` = a Set containing all elements in the tree beneath this element, including this element's `.nodes`; `{}` if none
|
||||||
- .deeperelements = a table with a key for each distinct tagname in .deepernodes, containing a Set of all deeper element nodes with that name
|
- `.deeperelements` = a table with a key for each distinct tagname in `.deepernodes`, containing a Set of all deeper element nodes with that name; `{}` in none
|
||||||
- .deeperattributes = as .deeperelements, but keyed on attribute name
|
- `.deeperattributes` = as `.deeperelements`, but keyed on attribute name
|
||||||
- .deeperids = as .deeperelements, but keyed on id value
|
- `.deeperids` = as `.deeperelements`, but keyed on id value
|
||||||
- .deeperclasses = as .deeperelements, but keyed on class name
|
- `.deeperclasses` = as `.deeperelements`, but keyed on class name
|
||||||
|
Loading…
Reference in New Issue
Block a user