diff --git a/types/web_sanitize.d.tl b/types/web_sanitize.d.tl new file mode 100644 index 0000000..f94455f --- /dev/null +++ b/types/web_sanitize.d.tl @@ -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 diff --git a/types/web_sanitize/query/scan_html.d.tl b/types/web_sanitize/query/scan_html.d.tl new file mode 100644 index 0000000..a9f886b --- /dev/null +++ b/types/web_sanitize/query/scan_html.d.tl @@ -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