From b6b01c29e7c3224935fc1ebba63cc0da4222bdb2 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 7 Apr 2017 22:46:27 -0500 Subject: [PATCH] fix format README.md (#46) --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2472c69..370245c 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -#LuaRock "htmlparser" +# LuaRock "htmlparser" Parse HTML text into a tree of elements with selectors [1]: http://wscherphof.github.com/lua-set/ [2]: http://api.jquery.com/category/selectors/ -##Install +## Install Htmlparser is a listed [LuaRock](http://luarocks.org/repositories/rocks/). Install using [LuaRocks](http://www.luarocks.org/): `luarocks install htmlparser` -###Dependencies +### Dependencies Htmlparser depends on [Lua 5.2](http://www.lua.org/download.html) (while work with LuaJIT, which provides 5.1-compatible ABI), and on the ["lua-set"][1] package, which is installed along automatically. To be able to run the tests, [lunitx](https://github.com/dcurrie/lunit) also comes along as a LuaRock -##Usage +## Usage Start off with ```lua pcall(require, "luarocks.loader") @@ -42,7 +42,7 @@ end ``` The root element is a container for the top level elements in the parsed text, i.e. the `` element in a parsed html document would be a child of the returned root element. -##Selectors +## Selectors Supported selectors are a subset of [jQuery's selectors][2]: - `"*"` all contained elements @@ -63,10 +63,10 @@ Supported selectors are a subset of [jQuery's selectors][2]: Selectors can be combined; e.g. `".class:not([attribute]) element.class"` -##Element type +## Element type All tree elements provide, apart from `:select` and `()`, the following accessors: -###Basic +### Basic - `.name` the element's tagname - `.attributes` a table with keys and values for the element's attributes; `{}` if none - `.id` the value of the element's id attribute; `nil` if not present @@ -75,7 +75,7 @@ All tree elements provide, apart from `:select` and `()`, the following accessor - `.nodes` an array with the element's child elements, `{}` if none - `.parent` the element that contains this element; `root.parent` is `nil` -###Other +### Other - `.index` sequence number of elements in order of appearance; root index is `0` - `:gettext()` the complete element text, starting with `""` or `""` - `.level` how deep the element is in the tree; root level is `0` @@ -86,7 +86,7 @@ All tree elements provide, apart from `:select` and `()`, the following accessor - `.deeperids` as `.deeperelements`, but keyed on id value - `.deeperclasses` as `.deeperelements`, but keyed on class name -##Limitations +## Limitations - Attribute values in selector strings cannot contain any spaces - The spaces before and after the `>` in a `parent > child` relation are mandatory - `