doc: Build property indexes for more classes instead of only client.
These index will be used for the rules documentation.
This commit is contained in:
parent
3da2264df2
commit
c1d59fef24
|
@ -382,21 +382,25 @@ add_custom_command(
|
|||
${SOURCE_DIR}/docs/_parser.lua
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${BUILD_DIR}/docs/common/rules_index.ldoc
|
||||
foreach(RULE_TYPE client tag screen notification)
|
||||
add_custom_command(
|
||||
OUTPUT ${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
|
||||
COMMAND lua ${SOURCE_DIR}/docs/build_rules_index.lua
|
||||
${BUILD_DIR}/docs/common/rules_index.ldoc
|
||||
${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
|
||||
${RULE_TYPE}
|
||||
|
||||
# Cheap trick until the ldoc `configure_file` is ported to be a build
|
||||
# step rather than part of cmake.
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/docs/common/rules_index.ldoc
|
||||
${SOURCE_DIR}/docs/common/rules_index.ldoc
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy ${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
|
||||
${SOURCE_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
|
||||
|
||||
DEPENDS
|
||||
lgi-check-run
|
||||
${SOURCE_DIR}/docs/build_rules_index.lua
|
||||
${SOURCE_DIR}/docs/_parser.lua
|
||||
)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${BUILD_DIR}/awesomerc.lua ${BUILD_DIR}/docs/05-awesomerc.md
|
||||
|
@ -423,7 +427,10 @@ add_custom_target(generate_awesomerc DEPENDS
|
|||
${BUILD_DIR}/docs/06-appearance.md
|
||||
${SOURCE_DIR}/docs/05-awesomerc.md.lua
|
||||
${SOURCE_DIR}/docs/build_rules_index.lua
|
||||
${BUILD_DIR}/docs/common/rules_index.ldoc
|
||||
${BUILD_DIR}/docs/common/client_rules_index.ldoc
|
||||
${BUILD_DIR}/docs/common/tag_rules_index.ldoc
|
||||
${BUILD_DIR}/docs/common/screen_rules_index.ldoc
|
||||
${BUILD_DIR}/docs/common/notification_rules_index.ldoc
|
||||
${SOURCE_DIR}/docs/sample_theme.lua
|
||||
${SOURCE_DIR}/docs/sample_files.lua
|
||||
${SOURCE_DIR}/awesomerc.lua
|
||||
|
|
|
@ -131,47 +131,51 @@ local function parse_files(paths, property_name, matcher, name_matcher)
|
|||
|
||||
local buffer = ""
|
||||
|
||||
for line in f:lines() do
|
||||
if f then
|
||||
for line in f and f:lines() do
|
||||
|
||||
local var = line:gmatch(exp1)()
|
||||
local var = line:gmatch(exp1)()
|
||||
|
||||
-- There is no backward/forward pattern in lua
|
||||
if #line <= 1 then
|
||||
buffer = ""
|
||||
elseif #buffer and not var then
|
||||
buffer = buffer.."\n"..line
|
||||
elseif line:sub(1,3) == "---" or line:sub(1,3) == "/**" then
|
||||
buffer = line
|
||||
end
|
||||
-- There is no backward/forward pattern in lua
|
||||
if #line <= 1 then
|
||||
buffer = ""
|
||||
elseif #buffer and not var then
|
||||
buffer = buffer.."\n"..line
|
||||
elseif line:sub(1,3) == "---" or line:sub(1,3) == "/**" then
|
||||
buffer = line
|
||||
end
|
||||
|
||||
if var then
|
||||
-- Get the @param, @see and @usage
|
||||
local params = ""
|
||||
for line in f:lines() do
|
||||
if line:sub(1,2) ~= "--" and line:sub(1,2) ~= " *" then
|
||||
break
|
||||
else
|
||||
params = params.."\n"..line
|
||||
if var then
|
||||
-- Get the @param, @see and @usage
|
||||
local params = ""
|
||||
for line in f:lines() do
|
||||
if line:sub(1,2) ~= "--" and line:sub(1,2) ~= " *" then
|
||||
break
|
||||
else
|
||||
params = params.."\n"..line
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local name = var:gmatch(exp2)()
|
||||
if not name then
|
||||
print("WARNING:", var,
|
||||
"seems to be misformatted. Use `beautiful.namespace_name`"
|
||||
)
|
||||
else
|
||||
table.insert(ret, {
|
||||
file = file,
|
||||
name = name:gsub("_", "\\_"),
|
||||
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
||||
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
||||
mod = path_to_module(file),
|
||||
})
|
||||
end
|
||||
local name = var:gmatch(exp2)()
|
||||
if not name then
|
||||
print("WARNING:", var,
|
||||
"seems to be misformatted. Use `beautiful.namespace_name`"
|
||||
)
|
||||
else
|
||||
table.insert(ret, {
|
||||
file = file,
|
||||
name = name:gsub("_", "_"),
|
||||
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
||||
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
||||
mod = path_to_module(file),
|
||||
})
|
||||
end
|
||||
|
||||
buffer = ""
|
||||
buffer = ""
|
||||
end
|
||||
end
|
||||
|
||||
f:close()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
#! /usr/bin/lua
|
||||
local args = {...}
|
||||
local typename = args[2]
|
||||
local parser = require("docs._parser")
|
||||
|
||||
local files = {"./objects/client.c", "./lib/awful/client.lua"}
|
||||
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/client.html#"
|
||||
return "../core_components/"..typename..".html#"
|
||||
end
|
||||
|
||||
local clientruleproperty = parser.parse_files(files, "clientruleproperty", matcher, matcher2)
|
||||
|
|
Loading…
Reference in New Issue