p, pre, br, b, img, separator, i, u, small, mark, code tags
This commit is contained in:
@@ -23,6 +23,18 @@ class HTMLElement:
|
||||
|
||||
func get_id() -> String:
|
||||
return get_attribute("id")
|
||||
|
||||
func get_collapsed_text() -> String:
|
||||
# Collapse whitespace: replace multiple spaces, tabs, newlines with single space
|
||||
var collapsed = text_content.strip_edges()
|
||||
# Replace multiple whitespace characters with single space
|
||||
var regex = RegEx.new()
|
||||
regex.compile("\\s+")
|
||||
return regex.sub(collapsed, " ", true)
|
||||
|
||||
func get_preserved_text() -> String:
|
||||
# For pre tags - preserve all whitespace
|
||||
return text_content
|
||||
|
||||
class ParseResult:
|
||||
var root: HTMLElement
|
||||
@@ -149,6 +161,10 @@ func get_title() -> String:
|
||||
var title_element = find_first("title")
|
||||
return title_element.text_content if title_element != null else ""
|
||||
|
||||
func get_icon() -> String:
|
||||
var icon_element = find_first("icon")
|
||||
return icon_element.get_attribute("src")
|
||||
|
||||
func get_meta_content(name_: String) -> String:
|
||||
var meta_elements = find_all("meta", "name")
|
||||
for element in meta_elements:
|
||||
|
||||
Reference in New Issue
Block a user