Skip to content

Commit

Permalink
docs: use aliases to shorten the example query
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jan 31, 2017
1 parent c863d75 commit c34f046
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,36 @@ Powerful, succinct, composable, extendable, declarative API.

```yaml
articles:
- select article
- select article {0,}
- body:
- select .body
- extract property innerHTML
- read property innerHTML
imageUrl:
- select img
- extract attribute src
- read attribute src
summary:
- select .body p:first-child
- extract property innerHTML
- select ".body p:first-child"
- read property innerHTML
- format text
title:
- select .title
- extract property textContent
- read property textContent
pageName:
- select .body
- extract property innerHTML
- read property innerHTML

```
> Not succinct enough for you? Use the pipe operator (`|`) to concatenate the commands!
> Not succinct enough for you? Use [aliases](#declare-subroutine-aliases) and the [pipe operator (`|`)](#the-pipe-operator-) to shorten and concatenate the commands:
>
> ```yaml
> ```
> articles:
> - select article
> - body: select .body | extract property innerHTML
> imageUrl: select img | extract attribute src
> summary: select .body p:first-child | extract property innerHTML | format text
> title: select .title | extract property textContent
> pageName: select .body | extract property innerHTML
> - sm article
> - body: s .body | rp innerHTML
> imageUrl: s img | ra src
> summary: s ".body p:first-child" | rp innerHTML | f text
> title: s .title | rp textContent
> pageName: s .body | rp innerHTML
>
> ```

Expand Down

0 comments on commit c34f046

Please sign in to comment.