Move to Teal 🚀 #6

Merged
Aire-One merged 24 commits from feat/#1 into master 2022-10-11 18:52:08 +02:00
2 changed files with 39 additions and 0 deletions
Showing only changes of commit 1b7be87040 - Show all commits

16
types/web_sanitize.d.tl Normal file
View File

@ -0,0 +1,16 @@
local record Web_Sanitize
sanitize_html: function(unsafe_html: string): string
extract_text: function(unsafe_html: string): string
sanitize_style: function(unsafe_style_attributes: string): string
record whitelist
clone: function(): whitelist
tags: table
add_attributes: table
self_closing: table
end
Sanitizer: function(parameters: table): function(unsafe_html: string): string
end
return Web_Sanitize

View File

@ -0,0 +1,23 @@
local record Scanner
record HTMLNode
tag: string
type: string | nil
num: number
self_closing: boolean | nil
attr: table
outer_html: function(self: HTMLNode): string
inner_html: function(self: HTMLNode): string
inner_text: function(self: HTMLNode): string
-- TODO : add replacement methods
end
record NodeStack
-- stack[n] - get the nth item in the stack (as an HTMLNode)
current: function(self: NodeStack): HTMLNode
is: function(query: string): boolean
end
scan_html: function(html_text: string, callback: function(stack: NodeStack), opts: table)
end
return Scanner