You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this great, easy-to-use, smartly thought out, library.
According to comments, the selectNodes function is a DFS implementation. I'm not completely sure (manual recursion is not my forte), but I think it's not.
Example case:
$ stack ghci
> :set -XOverloadedString
> let xml = "<html><div><p>p1</p><p>p2</p><blockquote><p>p3</p></blockquote><p>p4</p></div></html>"
> scrapeStringLike xml (texts $ "div" // "p")
Just ["p1","p2","p4","p3"]
Thanks for this great, easy-to-use, smartly thought out, library.
According to comments, the selectNodes function is a DFS implementation. I'm not completely sure (manual recursion is not my forte), but I think it's not.
Example case:
But this XML:
Should, in DFS, be processed through in the order given by the letter in parenthesis in the example below:
So the selector should yield
Just ["p1","p2","p3","p4"]
.Unless the previous result was the intended behaviour ? In which case I think comments and README should warn about this.
Suggested fix
In this pattern (https://github.com/fimad/scalpel/blob/master/scalpel-core/src/Text/HTML/Scalpel/Internal/Select.hs#L222), we should not have:
Or we won't get depth-first; we should rather have:
This pass tests and gives the proper result with the former ghci example. I have a PR ready to fire if needed.
The text was updated successfully, but these errors were encountered: