awesome/docs/build_rules_index.lua
Emmanuel Lepage Vallee c1d59fef24 doc: Build property indexes for more classes instead of only client.
These index will be used for the rules documentation.
2020-02-15 20:33:21 -05:00

38 lines
1.1 KiB
Lua

#! /usr/bin/lua
local args = {...}
local typename = args[2]
local parser = require("docs._parser")
assert(typename)
local files = {
"./objects/"..typename..".c",
"./lib/awful/"..typename..".lua",
"./lib/naughty/"..typename..".lua"
}
local matcher, matcher2 = "(.*)", ".*"
-- The client function comes from 5 different files, but all of those are
-- merged into one documentation page (aka, awful.client doesn't have content
-- anymore). This override the path so the parser doesn't have to be aware of it
function parser.path_to_html()
return "../core_components/"..typename..".html#"
end
local clientruleproperty = parser.parse_files(files, "clientruleproperty", matcher, matcher2)
for _, prop in ipairs(parser.parse_files(files, "property", matcher, matcher2)) do
table.insert(clientruleproperty, prop)
end
-- Create the file
local filename = args[1]
local f = io.open(filename, "w")
f:write(parser.create_table(clientruleproperty, {"link", "desc"}, "-- "))
f:close()
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80