chore: rename `properties` -> `property`
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details

This commit is contained in:
Aire-One 2022-10-22 19:38:16 +02:00
parent 6a33fc449a
commit 94b6c0df8b
3 changed files with 17 additions and 16 deletions

View File

@ -2,18 +2,18 @@ local crawler = require "crawler"
local filesystem = require "filesystem" local filesystem = require "filesystem"
local inspect = require "inspect" local inspect = require "inspect"
local log = require "logger" local log = require "logger"
local properties = require "properties" local property = require "property"
local scraper = require "scraper" local scraper = require "scraper"
local generator = require "generator" local generator = require "generator"
log:info( log:info(
inspect { message = "Start extraction", base_url = properties.base_url } inspect { message = "Start extraction", base_url = property.base_url }
) )
local index = crawler.fetch(properties.base_url .. properties.index_uri) local index = crawler.fetch(property.base_url .. property.index_uri)
-- local modules = -- local modules =
-- scraper.get_modules_from_index(index, properties.ignored_modules) -- scraper.get_modules_from_index(index, property.ignored_modules)
local module_infos = scraper.module_info_list.get_modules_from_index(index) local module_infos = scraper.module_info_list.get_modules_from_index(index)
log:info(inspect { modules_found = #module_infos }) log:info(inspect { modules_found = #module_infos })
@ -21,13 +21,13 @@ log:info(inspect { modules_found = #module_infos })
-- for i = 1, 1 do -- #modules do -- for i = 1, 1 do -- #modules do
-- local m = modules[i] -- local m = modules[i]
-- log:info(inspect { try = m }) -- log:info(inspect { try = m })
-- local page = crawler.fetch(properties.base_url .. "/" .. m.uri) -- local page = crawler.fetch(property.base_url .. "/" .. m.uri)
-- local items = scraper.get_doc_from_page(page) -- local items = scraper.get_doc_from_page(page)
-- log:info(inspect { items }) -- log:info(inspect { items })
-- end -- end
local html = local html =
crawler.fetch(properties.base_url .. "/widgets/wibox.widget.textbox.html") crawler.fetch(property.base_url .. "/widgets/wibox.widget.textbox.html")
local module_doc = scraper.module_doc.get_doc_from_page(html) local module_doc = scraper.module_doc.get_doc_from_page(html)
-- log:info(inspect { module_doc = module_doc }) -- log:info(inspect { module_doc = module_doc })
@ -37,5 +37,5 @@ local module_doc = scraper.module_doc.get_doc_from_page(html)
local mod = "textbox" local mod = "textbox"
filesystem.file_writer.write( filesystem.file_writer.write(
generator.teal_type_definitions.generate_teal(mod, module_doc), generator.teal_type_definitions.generate_teal(mod, module_doc),
properties.out_directory .. "/" .. mod .. ".d.tl" property.out_directory .. "/" .. mod .. ".d.tl"
) )

View File

@ -1,4 +1,4 @@
local record Properties local record property
base_url: string base_url: string
index_uri: string index_uri: string
@ -11,9 +11,10 @@ local record Properties
ignored_modules: { string } ignored_modules: { string }
end end
local properties: Properties = { local property: property = {
-- base_url = "https://awesomewm.org/apidoc", -- base_url = "https://awesomewm.org/apidoc",
base_url = "file:///usr/share/doc/awesome/doc", -- base_url = "file:///usr/share/doc/awesome/doc",
base_url = "file:///home/aireone/documents/prog/awesome/build/doc",
index_uri = "/index.html", index_uri = "/index.html",
out_directory = "generated", out_directory = "generated",
ignored_modules = { ignored_modules = {
@ -48,7 +49,7 @@ local properties: Properties = {
"wibox.drawable", "wibox.drawable",
"wibox.hierarchy", "wibox.hierarchy",
"wibox.widget.base", "wibox.widget.base",
"xproperties", "xproperty",
-- Documentation -- Documentation
"Authors", "Authors",
@ -69,4 +70,4 @@ local properties: Properties = {
} }
} }
return properties return property

View File

@ -70,10 +70,10 @@ function module.get_doc_from_page(html: string): Module_Doc.Module_Doc
module_doc.constructors = List(extract_section_functions(dl_html)) module_doc.constructors = List(extract_section_functions(dl_html))
elseif section_name == "Static module functions" then elseif section_name == "Static module functions" then
module_doc.static_functions = List(extract_section_functions(dl_html)) module_doc.static_functions = List(extract_section_functions(dl_html))
elseif section_name == "Object properties" then elseif section_name == "Object property" then
print "Not implemented: Object properties" print "Not implemented: Object property"
elseif section_name == "Deprecated object properties" then elseif section_name == "Deprecated object property" then
print "Not implemented: Deprecated object properties" print "Not implemented: Deprecated object property"
elseif section_name == "Object methods" then elseif section_name == "Object methods" then
module_doc.methods = List(extract_section_functions(dl_html)) module_doc.methods = List(extract_section_functions(dl_html))
elseif section_name == "Signals" then elseif section_name == "Signals" then