mirror of
https://github.com/msva/lua-htmlparser.git
synced 2024-11-27 12:44:22 +00:00
"settext" node method implementation. Fixes #38
This commit is contained in:
parent
07a1b0fde8
commit
7c245ae7a2
@ -117,14 +117,18 @@ function ElementNode:gettext()
|
|||||||
return string.sub(self.root._text, self._openstart, self._closeend)
|
return string.sub(self.root._text, self._openstart, self._closeend)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ElementNode:getcontent()
|
function ElementNode:settext(c)
|
||||||
return string.sub(self.root._text, self._openend + 1, self._closestart - 1)
|
self.root._text=c
|
||||||
end
|
end
|
||||||
|
|
||||||
function ElementNode:textonly()
|
function ElementNode:textonly()
|
||||||
return (self:gettext():gsub("<[^>]*>",""))
|
return (self:gettext():gsub("<[^>]*>",""))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ElementNode:getcontent()
|
||||||
|
return string.sub(self.root._text, self._openend + 1, self._closestart - 1)
|
||||||
|
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