diff --git a/README.md b/README.md index 3ea8303..2e9d39a 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ - [Install](#install) - [Features](#features) - [Docs](#docs) -- [Configuration](#configuration) - [Usage](#usage) +- [Configuration](#configuration) - [Struct Tag Grammar](#struct-tag-grammar) - [Functions](#functions) - [Builtin functions](#builtin-functions) @@ -227,7 +227,7 @@ type ExamData struct { > - eachTextJoin(sep) get each element text and join to string, return string. -> - nodeEq(index) reduces the set of matched elements to the one at the specified index, return Selection for nested struct. +> - eq(index) reduces the set of matched elements to the one at the specified index, return Selection for nested struct. > - ... diff --git a/_examples/advance/main.go b/_examples/advance/main.go index 5445e22..b80b7c6 100644 --- a/_examples/advance/main.go +++ b/_examples/advance/main.go @@ -36,20 +36,21 @@ type PageData struct { Title string `pagser:"title"` H1 string `pagser:"h1"` Navs []struct { - ID int `pagser:"->attrEmpty(id, -1)"` - Name string `pagser:"a"` - Url string `pagser:"a->attr(href)"` + ID int `pagser:"->attrEmpty(id, -1)"` + Name string `pagser:"a"` + Url string `pagser:"a->attr(href)"` + AbsUrl string `pagser:"a->absHref('https://github.com/foolin/pagser')"` } `pagser:".navlink li"` NavFirst struct { ID int `pagser:"->attrEmpty(id, -1)"` Name string `pagser:"a"` Url string `pagser:"a->attr(href)"` - } `pagser:".navlink li->nodeEq(0)"` + } `pagser:".navlink li->eq(0)"` NavLast *struct { ID int `pagser:"->attrEmpty(id, -1)"` Name string `pagser:"a"` Url string `pagser:"a->attr(href)"` - } `pagser:".navlink li->nodeEq(-1)"` + } `pagser:".navlink li->eq(-1)"` NavIds []int `pagser:".navlink li->eachAttrEmpty(id, -1)"` NavTexts []string `pagser:".navlink li"` NavEachTexts []string `pagser:".navlink li->eachText()"`