Make the program try multiple modules #35
|
@ -18,7 +18,13 @@ end
|
|||
|
||||
local __Module_Doc: metatable<Module_Doc> = {
|
||||
__call = function(_: Module_Doc): Module_Doc
|
||||
return {}
|
||||
return {
|
||||
constructors = List(),
|
||||
methods = List(),
|
||||
properties = List(),
|
||||
static_functions = List(),
|
||||
signals = List(),
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
@ -9,16 +9,16 @@ local tmpl = [[
|
|||
-- Auto generated file (Do not manually edit this file!)
|
||||
|
||||
local record $(module.record_name)
|
||||
# if #module.signals then
|
||||
# if #module.signals ~= 0 then
|
||||
$(snippets.indent(snippets.render_enum("Signal", module.signals)))
|
||||
|
||||
# end -- /signals
|
||||
# if #module.methods then
|
||||
# if #module.methods ~= 0 then
|
||||
-- Object methods
|
||||
$(snippets.indent(snippets.render_record_functions(module.methods)))
|
||||
|
||||
# end -- /methods
|
||||
# if #module.properties then
|
||||
# if #module.properties ~= 0 then
|
||||
-- Object properties
|
||||
$(snippets.indent(snippets.render_record_properties(module.properties)))
|
||||
# end -- /properties
|
||||
|
|
|
@ -24,15 +24,35 @@ log:info("Finished Module List scrapping, found " .. #module_infos .. " modules"
|
|||
-- log:info(inspect { items })
|
||||
-- end
|
||||
|
||||
local html =
|
||||
crawler.fetch(property.base_url .. "/widgets/wibox.widget.textbox.html")
|
||||
local module_doc = scraper.module_doc.get_doc_from_page(html, "wibox.widget.textbox")
|
||||
-- log:info(inspect { module_doc = module_doc })
|
||||
local function do_one_file(url: string, module_name: string, output: string)
|
||||
local html = crawler.fetch(url)
|
||||
local module_doc = scraper.module_doc.get_doc_from_page(html, module_name)
|
||||
filesystem.file_writer.write(
|
||||
generator.teal_type_definitions.generate_teal(module_doc),
|
||||
output
|
||||
)
|
||||
end
|
||||
|
||||
-- -- local items = scraper.get_doc_from_page(page)
|
||||
-- -- log:info(inspect { items })
|
||||
|
||||
filesystem.file_writer.write(
|
||||
generator.teal_type_definitions.generate_teal(module_doc),
|
||||
do_one_file(
|
||||
property.base_url .. "/widgets/wibox.widget.textbox.html",
|
||||
"wibox.widget.textbox",
|
||||
property.out_directory .. "/textbox.d.tl"
|
||||
)
|
||||
|
||||
do_one_file(
|
||||
property.base_url .. "/popups_and_bars/wibox.html",
|
||||
"wibox",
|
||||
property.out_directory .. "/wibox.d.tl"
|
||||
)
|
||||
|
||||
do_one_file(
|
||||
property.base_url .. "/widget_layouts/wibox.layout.fixed.html",
|
||||
"wibox.layout.fixed",
|
||||
property.out_directory .. "/fixed.d.tl"
|
||||
)
|
||||
|
||||
do_one_file(
|
||||
property.base_url .. "/core_components/client.html",
|
||||
"client",
|
||||
property.out_directory .. "/client.d.tl"
|
||||
)
|
||||
|
|
|
@ -165,7 +165,7 @@ function module.get_doc_from_page(html: string, module_name: string): Module_Doc
|
|||
elseif section_name == "Signals" then
|
||||
module_doc.signals = List(extract_section_signal(dl_html))
|
||||
else
|
||||
error("Unknown section name: " .. section_name)
|
||||
log:warn("Unknown section name: " .. section_name)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue