mirror of
https://github.com/msva/lua-htmlparser.git
synced 2024-11-04 23:34:20 +00:00
"textonly" node method implementation. Fixes #47
This commit is contained in:
parent
5bcd0ab24c
commit
07a1b0fde8
@ -121,6 +121,10 @@ function ElementNode:getcontent()
|
|||||||
return string.sub(self.root._text, self._openend + 1, self._closestart - 1)
|
return string.sub(self.root._text, self._openend + 1, self._closestart - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ElementNode:textonly()
|
||||||
|
return (self:gettext():gsub("<[^>]*>",""))
|
||||||
|
end
|
||||||
|
|
||||||
function ElementNode:addattribute(k, v)
|
function ElementNode:addattribute(k, v)
|
||||||
self.attributes[k] = v
|
self.attributes[k] = v
|
||||||
if string.lower(k) == "id" then
|
if string.lower(k) == "id" then
|
||||||
|
Loading…
Reference in New Issue
Block a user