View Source Gluttony.Handler behaviour (gluttony v0.3.0)
This module defines the behaviour for handlers.
Both handle_element/2
, handle_content/2
and handle_cached/2
should return on of the following result tuples:
{:entry, chars_or_attrs}
- To indicate that a new entry should be created.{:entry, :key, value}
- To indicate that a entry should be updated with the given key and value.{:feed, :key, value}
- To indicate that the feed should be updated with the given key and value.{:cache, :key}
- To indicate that the given key should be cached. Because successive calls with the same key will clean the previous value, this should only be called onhandle_element
. This will guarantee that the cache will live through the tag lifecycle, instead of being cleaned on whenever new content is found.{:cache, :key, value}
- To indicate that the given key should be cached with the given value.{:cont, chars_or_attrs}
- To indicate that the current element should be ignored.
If the value is a list, it will be appended to the existing value. Otherwise, it will replace the current value. Its also possible to pass a list as the path to create a nested structure (all intermidiate values will be created).
Summary
Callbacks
This callback is called when and element is about to finish.
This callback is called when a content of a element is encountered.
This callback is called when a start element is encountered.
Types
Callbacks
This callback is called when and element is about to finish.
This callback is called when a content of a element is encountered.
This callback is called when a start element is encountered.