package
0.5.0
Repository: https://github.com/metafates/mangal-lua-libs.git
Documentation: pkg.go.dev

# README

HTML

Goquery lua port

Types

  • HTML
  • Document
  • Selection

HTML

FunctionArgumentsReturn
parsestringdocument

Document

FunctionArgumentsReturn
findstringselection

Selection

FunctionArgumentsDescriptionReturn
findstringFind gets the descendants of each element in the current set of matched elements, filtered by a selector. It returns a new Selection object containing these matched elements.selection
eachfunction(num, selection)Each iterates over a Selection object, executing a function for each matched element. It returns the current Selection object. The function f is called for each element in the selection with the index of the element in that selection starting at 0, and a Selection that contains only that element.
attrstringAttr gets the specified attribute's value for the first element in the Selection.string
firstFirst reduces the set of matched elements to the first in the set. It returns a new Selection object, and an empty Selection object if the the selection is empty.selection
parentParent gets the parent of each element in the Selection. It returns a new Selection object containing the matched elements.selection
textText gets the combined text contents of each element in the set of matched elements, including their descendants.string
htmlHtml gets the HTML contents of the first element in the set of matched elements. It includes text and comment nodes.string
hasClassstringHasClass determines whether any of the matched elements are assigned the given class.boolean
isstringIs checks the current matched set of elements against a selector and returns true if at least one of these elements matches.boolean
nextNext gets the immediately following sibling of each element in the Selection. It returns a new Selection object containing the matched elements.selection
prevPrev gets the immediately preceding sibling of each element in the Selection. It returns a new Selection object containing the matched elements.selection

Example

local html = require("html")

local doc = html.parse("...")
doc:find(".classname > .anotherclass"):each(function(i, el)
    print(el:text())
end)

# Functions

No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author