build(types): web_sanitize minimal definition
This commit is contained in:
parent
90c2aa4bc2
commit
1b7be87040
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue