Closed soend closed 7 years ago
it looks like a bug.
Can you provide sample test-case code?
Here's simple test i used:
local htmlparser = require("htmlparser")
local root = htmlparser.parse([[
<div class="page-content__description">
<p>Test data</p>
</div>
<div class="pagecontentdescription">
<p>Test data</p>
</div>
]])
print(#root.nodes) -- => result should be 2
print(#root(".page-content__description")) -- => result should be 1
print(#root(".pagecontentdescription")) -- => result should be 1
Result should be 2,1,1 but im getting 2,0,1.
Sorry for long reply. I was too busy at work.
Can you describe a bit your current setup? Which version of module do you use? Which interpreter?
I just tried your test case with current code and all values that it returns exactly same as you predicted in comments.
$ cat tst.48.lua
local htmlparser = require("htmlparser")
local root = htmlparser.parse([[
<div class="page-content__description">
<p>Test data</p>
</div>
<div class="pagecontentdescription">
<p>Test data</p>
</div>
]])
local sel = root("div.page")
print(#root.nodes) -- => result should be 2
print(#root(".page-content__description")) -- => result should be 1
print(#root(".pagecontentdescription")) -- => result should be 1
-- ^ the code from your snippet
$ luajit tst.48.lua
2
1
1
$ lua5.1 tst.48.lua
2
1
1
$ lua5.2 tst.48.lua
2
1
1
$ lua5.3 tst.48.lua
2
1
1
Lua version: 5.3 htmlparser 0.3.2-1 (installed) - /usr/local/lib/luarocks/rocks-5.3
Running Debian version 8.7
Can you try to install 0.3.3 (or scm)?
P.S.: https://github.com/luarocks/luarocks-site/issues/107
That's why you can't just upgrade ☹
--
В письме от четверг, 1 июня 2017 г. 13:56:13 +07 пользователь soend написал:
Lua version: 5.3 htmlparser 0.3.2-1 (installed) - /usr/local/lib/luarocks/rocks-5.3
Ok, installed the scm version and it works now. Thanks for the help!
So, when @luarocks guys (or @leafo himself) will reroot luarocks package on me, I'll upload new versions to the default manifest and you'll be able to receive upgrade in "usual" way :)
package is rerooted now, and 0.3.3 is in the manifest, so feel free to upgrade/downgrade :)
Im have class name:
page-content__description
and when i try to find it like this:local sel = root("div.page-content__description")
i get not results. I didnt see this case in the limitations section, is this a bug or known limitation?