Authors: Steve Roques.
em_filter — Public API and HTML Utilities
All nodes in the Emergence system are agents. The Queen connects to em_disco the same way any other agent does.
Every handler module must export:
handle(Body :: binary(), Memory :: map()) -> {Result :: term(), NewMemory :: map()}
Memory is always a live map. Returning the same map as NewMemory is valid for stateless behaviour — no special config needed.
capabilities => [binary()] Announced to em_disco via agent_hello. Defaults to [].
memory => ram | ets ram (default): memory lives in the gen_server state and resets to #{} if the worker is restarted. ets: memory is persisted in an ETS table and survives worker restarts within the same BEAM session.| base_capabilities/0 | Returns the root capabilities shared by all em_filter agents. |
| clean_text/3 | |
| decode_hex_entities/1 | |
| decode_html_entities/1 | |
| decode_named_entities/1 | |
| decode_numeric_entities/1 | |
| ensure_binary/1 | |
| extract_attribute/2 | |
| extract_elements/2 | |
| get_text/1 | |
| resolve_named_entity/1 | |
| safe_binary_replace/3 | |
| should_skip_link/2 | |
| start_agent/3 | |
| stop_agent/1 | |
| strip_scripts/1 |
base_capabilities() -> [binary()]
Returns the root capabilities shared by all em_filter agents.
clean_text(D::term(), I::term(), Dt::term()) -> binary()
decode_hex_entities(Text::binary()) -> binary()
decode_html_entities(T::binary()) -> binary()
decode_named_entities(Text::binary()) -> binary()
decode_numeric_entities(Text::binary()) -> binary()
ensure_binary(B::term()) -> binary()
extract_attribute(E::binary(), Attr::string()) -> {ok, binary()} | error
extract_elements(Html::binary(), Selector::string()) -> term()
get_text(E::binary()) -> binary()
resolve_named_entity(X1::binary()) -> binary() | undefined
safe_binary_replace(S::binary(), P::binary(), R::binary()) -> binary()
should_skip_link(Link::binary(), Excluded::[string()]) -> boolean()
start_agent(AgentName::atom(), HandlerModule::module(), Config::map()) -> {ok, pid()} | {error, term()}
stop_agent(AgentName::atom()) -> ok | {error, term()}
strip_scripts(Html::binary() | string()) -> {ok, binary()} | {error, cleaning_failed}
Generated by EDoc