diff --git a/src/awesomewm.d.tl/entity/Module_Doc.tl b/src/awesomewm.d.tl/entity/Module_Doc.tl index a3efb86..67491cf 100644 --- a/src/awesomewm.d.tl/entity/Module_Doc.tl +++ b/src/awesomewm.d.tl/entity/Module_Doc.tl @@ -9,6 +9,7 @@ local record Module_Doc constructors: List methods: List static_functions: List + signals: List end local __Module_Doc: metatable = { diff --git a/src/awesomewm.d.tl/scraper/module_doc.tl b/src/awesomewm.d.tl/scraper/module_doc.tl index 8833020..495ba58 100644 --- a/src/awesomewm.d.tl/scraper/module_doc.tl +++ b/src/awesomewm.d.tl/scraper/module_doc.tl @@ -8,6 +8,10 @@ local utils = require "utils" local log = logger.log("scraper") +local function extract_node_text(node: scan.HTMLNode): string + return utils.sanitize_string(node:inner_text()) +end + local function extract_function_name(function_name_node: scan.HTMLNode): string return function_name_node and ((function_name_node.attr.name as string):gsub(".*:", "")) end @@ -20,9 +24,7 @@ local function extract_function_return_types(function_return_types_node: scan.HT local selector = "span.types .type" local html = function_return_types_node:outer_html() - return scraper_utils.scrape(html, selector, function(node: scan.HTMLNode): string - return utils.sanitize_string(node:inner_text()) - end) + return scraper_utils.scrape(html, selector, extract_node_text) end local function extract_section_functions(dl: string): { Function_Info.Function_Info } @@ -50,6 +52,12 @@ local function extract_section_functions(dl: string): { Function_Info.Function_I ) end +local function extract_section_signal(dl: string): { string } + local selector = "dt strong" + + return scraper_utils.scrape(dl, selector, extract_node_text) +end + local module = {} function module.get_doc_from_page(html: string): Module_Doc.Module_Doc @@ -80,7 +88,7 @@ function module.get_doc_from_page(html: string): Module_Doc.Module_Doc elseif section_name == "Object methods" then module_doc.methods = List(extract_section_functions(dl_html)) elseif section_name == "Signals" then - log:warn("Not implemented: Signals") + module_doc.signals = List(extract_section_signal(dl_html)) else error("Unknown section name: " .. section_name) end