Expand description
Documentation for scrapelect
’s built-in filters.
Conventions used:
- Signature of a filter:
value: T | name(arg_1: U_1, ...): V
means thatname
is a filter that takes a pipeline value of typeT
, has argumentsarg_i
of typeU_i
, and returns a value of typeV
- Specifying an arg type with a question mark (e.g.,
value: Value | dbg(msg: String?): Value
) means that that argument (e.g.,msg
) is optional and can be omitted.
- Specifying an arg type with a question mark (e.g.,
- List shorthand: a
List
is represented as[a_0, a_1, a_2, ..., a_n]
to mean that its elements area_0, ..., a_n
in that order. Indexing starts at 0. This syntax is currently not validscrapelect
, but it is useful to express in documentation. - Structure shorthand: similarly, a structure is represented as { key_1: value_1, key_2: value_2, … } to
indicate that it has keys that correspond to the given values. This is not valid
scrapelect
, but it is useful in documentation. - Element shorthand: an inline HTML element (e.g.,
<a href="github.com/suaviloquence/scrapelect">Link text</a>
) is also not validscrapelect
, but is useful to demonstrate howElement
s are used in filters.
Functions§
- and
filter_doc
- Signature:
value: Bool | and(with: Bool): Bool
- attrs
filter_doc
- Signature:
value: Element | attrs(): Structure
- dbg
filter_doc
- Signature:
value | dbg(msg: String?): Value
- eq
filter_doc
- Signature:
value | eq(to: Value): Bool
- float
filter_doc
- Signature:
value: (String or Int or Float) | float(): Float
- id
filter_doc
- Signature:
value | id(): Value
- int
filter_doc
- Signature:
value: (String or Int or Float) | int(): Int
- is_in
filter_doc
- Signature:
value | is_in(list: List): Bool
- keys
filter_doc
- Signature:
value: Structure | keys(): List<String>
- not
filter_doc
- Signature:
value: Bool | not(): Bool
- nth
filter_doc
- Signature:
value: List | nth(i: Int): Value
- or
filter_doc
- Signature:
value: Bool | or(with: Bool): Bool
- split
filter_doc
- Signature:
value: String | is_in(on: String?): List<String>
- strip
filter_doc
- Signature:
value: String | strip(): String
- take
filter_doc
- Signature:
value: Structure | take(key: String): Value
- tee
filter_doc
- Signature:
value | tee(into: String): Value
- text
filter_doc
- Signature:
value: Element | text(): String
- truthy
filter_doc
- Signature:
value | truthy(): Bool
- values
filter_doc
- Signature:
value: Structure | values(): List