Module scrapelect::interpreter::filter::builtin
source · Expand description
Documentation for scrapelect’s built-in filters.
Conventions used:
- Signature of a filter:
value: T | name(arg_1: U_1, ...): Vmeans thatnameis a filter that takes a pipeline value of typeT, has argumentsarg_iof 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
Listis represented as[a_0, a_1, a_2, ..., a_n]to mean that its elements area_0, ..., a_nin 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 howElements are used in filters.
Functions§
- and
filter_docSignature:value: Bool | and(with: Bool): Bool - attrs
filter_docSignature:value: Element | attrs(): Structure - dbg
filter_docSignature:value | dbg(msg: String?): Value - eq
filter_docSignature:value | eq(to: Value): Bool - float
filter_docSignature:value: (String or Int or Float) | float(): Float - id
filter_docSignature:value | id(): Value - int
filter_docSignature:value: (String or Int or Float) | int(): Int - is_in
filter_docSignature:value | is_in(list: List): Bool - keys
filter_docSignature:value: Structure | keys(): List<String> - not
filter_docSignature:value: Bool | not(): Bool - nth
filter_docSignature:value: List | nth(i: Int): Value - or
filter_docSignature:value: Bool | or(with: Bool): Bool - split
filter_docSignature:value: String | is_in(on: String?): List<String> - strip
filter_docSignature:value: String | strip(): String - take
filter_docSignature:value: Structure | take(key: String): Value - tee
filter_docSignature:value | tee(into: String): Value - text
filter_docSignature:value: Element | text(): String - truthy
filter_docSignature:value | truthy(): Bool - values
filter_docSignature:value: Structure | values(): List