Skip to content

Instantly share code, notes, and snippets.

@DmitrySoshnikov
Created April 19, 2011 10:14
Show Gist options
  • Save DmitrySoshnikov/927093 to your computer and use it in GitHub Desktop.
Save DmitrySoshnikov/927093 to your computer and use it in GitHub Desktop.
main(_Arg) ->
HTML = {p, [{text, "test"}, {class, "bold"}], [
{span, [{text, "value"}, {class, "bold"}], [
{span, [{text, "hi"}, {class, "bold"}], []}
]}
]},
Texts = get_text(HTML, []),
% ["value","test"]
?LOG(Texts).
get_text({_, _, []}, Result) -> Result;
get_text({_Tag, Attrs, [FirstChild | _]}, Texts) ->
get_text(FirstChild, [proplists:get_value(text, Attrs) | Texts]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment