View Source Earmark.TagSpecificProcessors (Earmark v1.4.46)

This struct represents a list of tuples {tag, function} from which a postprocessing function can be constructed

General Usage Examples:

iex(0)> tsp = new({"p", &Earmark.AstTools.merge_atts_in_node(&1, class: "one")})
...(0)> tsp = prepend_tag_function(tsp, "i", &Earmark.AstTools.merge_atts_in_node(&1, class: "two"))
...(0)> make_postprocessor(tsp).({"p", [], nil, nil})
{"p", [{"class", "one"}], nil, nil}

iex(1)> tsp = new({"p", &Earmark.AstTools.merge_atts_in_node(&1, class: "one")})
...(1)> tsp = prepend_tag_function(tsp, "i", &Earmark.AstTools.merge_atts_in_node(&1, class: "two"))
...(1)> make_postprocessor(tsp).({"i", [{"class", "i"}], nil, nil})
{"i", [{"class", "two i"}], nil, nil}

iex(2)> tsp = new({"p", &Earmark.AstTools.merge_atts_in_node(&1, class: "one")})
...(2)> tsp = prepend_tag_function(tsp, "i", &Earmark.AstTools.merge_atts_in_node(&1, class: "two"))
...(2)> make_postprocessor(tsp).({"x", [], nil, nil})
{"x", [], nil, nil}

Summary

Functions

Constructs a postprocessor function from this struct which will find the function associated to the tag of the node, and apply the node to it if such a function was found.

Convenience construction

Prepends a tuple {tag, function} to the list of such tuples.

Functions

Link to this function

make_postprocessor(tag_specific_processors)

View Source

Constructs a postprocessor function from this struct which will find the function associated to the tag of the node, and apply the node to it if such a function was found.

Convenience construction

iex(3)> new()
%Earmark.TagSpecificProcessors{}
Link to this function

prepend_tag_function(tsp, tf)

View Source
Link to this function

prepend_tag_function(tsp, tag, function)

View Source

Prepends a tuple {tag, function} to the list of such tuples.