JuliaWeb/Gumbo.jl

What wrong ? ERROR: UndefVarError: Leaves not defined

Closed this issue · 0 comments

Version 0.6.0 (2017-06-19 13:05 UTC)
Official http://julialang.org/ release
x86_64-w64-mingw32

julia> using Gumbo

julia> url="http://wp.pl"
"http://wp.pl"

julia> getpage(url) = parsehtml(String(read(download(url))))
getpage (generic function with 1 method)

julia> text_only(doc::HTMLDocument) = text_only(doc.root)
text_only (generic function with 1 method)

julia> text_only(frag) = join([text(leaf) for leaf in Leaves(frag) if leaf isa HTMLText], " ")
text_only (generic function with 2 methods)

julia> get_page_text(url) = text_only(getpage(url))
get_page_text (generic function with 1 method)

julia> doc=parsehtml(String(read(download(url))));

julia> text_only(doc.root[2])
ERROR: UndefVarError: Leaves not defined
Stacktrace:
[1] text_only(::Gumbo.HTMLElement{:body}) at .\REPL[5]:1

julia> typeof(doc)
Gumbo.HTMLDocument

Thx, Paul