mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-11 18:45:34 +00:00
30 lines
671 B
Python
30 lines
671 B
Python
import pluggy
|
|
|
|
hookimpl = pluggy.HookimplMarker("conditions")
|
|
|
|
@hookimpl
|
|
def register_operators():
|
|
def starts_with(_, text, prefix):
|
|
return text.lower().startswith(prefix.lower())
|
|
|
|
def ends_with(_, text, suffix):
|
|
return text.lower().endswith(suffix.lower())
|
|
|
|
return {
|
|
"starts_with": starts_with,
|
|
"ends_with": ends_with
|
|
}
|
|
|
|
@hookimpl
|
|
def register_operator_choices():
|
|
return [
|
|
("starts_with", "Text Starts With"),
|
|
("ends_with", "Text Ends With"),
|
|
]
|
|
|
|
@hookimpl
|
|
def register_field_choices():
|
|
return [
|
|
("meta_description", "Meta Description"),
|
|
("meta_keywords", "Meta Keywords"),
|
|
] |