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
|
${SOURCE_DIR}/docs/_parser.lua
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
foreach(RULE_TYPE client tag screen notification)
|
||||||
OUTPUT ${BUILD_DIR}/docs/common/rules_index.ldoc
|
add_custom_command(
|
||||||
|
OUTPUT ${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
|
||||||
COMMAND lua ${SOURCE_DIR}/docs/build_rules_index.lua
|
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
|
# Cheap trick until the ldoc `configure_file` is ported to be a build
|
||||||
# step rather than part of cmake.
|
# step rather than part of cmake.
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/docs/common/rules_index.ldoc
|
COMMAND ${CMAKE_COMMAND} -E
|
||||||
${SOURCE_DIR}/docs/common/rules_index.ldoc
|
copy ${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
|
||||||
|
${SOURCE_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
|
||||||
|
|
||||||
DEPENDS
|
DEPENDS
|
||||||
lgi-check-run
|
lgi-check-run
|
||||||
${SOURCE_DIR}/docs/build_rules_index.lua
|
${SOURCE_DIR}/docs/build_rules_index.lua
|
||||||
${SOURCE_DIR}/docs/_parser.lua
|
${SOURCE_DIR}/docs/_parser.lua
|
||||||
)
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${BUILD_DIR}/awesomerc.lua ${BUILD_DIR}/docs/05-awesomerc.md
|
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
|
${BUILD_DIR}/docs/06-appearance.md
|
||||||
${SOURCE_DIR}/docs/05-awesomerc.md.lua
|
${SOURCE_DIR}/docs/05-awesomerc.md.lua
|
||||||
${SOURCE_DIR}/docs/build_rules_index.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_theme.lua
|
||||||
${SOURCE_DIR}/docs/sample_files.lua
|
${SOURCE_DIR}/docs/sample_files.lua
|
||||||
${SOURCE_DIR}/awesomerc.lua
|
${SOURCE_DIR}/awesomerc.lua
|
||||||
|
|
|
@ -131,47 +131,51 @@ local function parse_files(paths, property_name, matcher, name_matcher)
|
||||||
|
|
||||||
local buffer = ""
|
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
|
-- There is no backward/forward pattern in lua
|
||||||
if #line <= 1 then
|
if #line <= 1 then
|
||||||
buffer = ""
|
buffer = ""
|
||||||
elseif #buffer and not var then
|
elseif #buffer and not var then
|
||||||
buffer = buffer.."\n"..line
|
buffer = buffer.."\n"..line
|
||||||
elseif line:sub(1,3) == "---" or line:sub(1,3) == "/**" then
|
elseif line:sub(1,3) == "---" or line:sub(1,3) == "/**" then
|
||||||
buffer = line
|
buffer = line
|
||||||
end
|
end
|
||||||
|
|
||||||
if var then
|
if var then
|
||||||
-- Get the @param, @see and @usage
|
-- Get the @param, @see and @usage
|
||||||
local params = ""
|
local params = ""
|
||||||
for line in f:lines() do
|
for line in f:lines() do
|
||||||
if line:sub(1,2) ~= "--" and line:sub(1,2) ~= " *" then
|
if line:sub(1,2) ~= "--" and line:sub(1,2) ~= " *" then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
params = params.."\n"..line
|
params = params.."\n"..line
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local name = var:gmatch(exp2)()
|
local name = var:gmatch(exp2)()
|
||||||
if not name then
|
if not name then
|
||||||
print("WARNING:", var,
|
print("WARNING:", var,
|
||||||
"seems to be misformatted. Use `beautiful.namespace_name`"
|
"seems to be misformatted. Use `beautiful.namespace_name`"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
table.insert(ret, {
|
table.insert(ret, {
|
||||||
file = file,
|
file = file,
|
||||||
name = name:gsub("_", "\\_"),
|
name = name:gsub("_", "_"),
|
||||||
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
||||||
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
||||||
mod = path_to_module(file),
|
mod = path_to_module(file),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
buffer = ""
|
buffer = ""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
f:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
#! /usr/bin/lua
|
#! /usr/bin/lua
|
||||||
local args = {...}
|
local args = {...}
|
||||||
|
local typename = args[2]
|
||||||
local parser = require("docs._parser")
|
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 = "(.*)", ".*"
|
local matcher, matcher2 = "(.*)", ".*"
|
||||||
|
|
||||||
-- The client function comes from 5 different files, but all of those are
|
-- 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
|
-- 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
|
-- anymore). This override the path so the parser doesn't have to be aware of it
|
||||||
function parser.path_to_html()
|
function parser.path_to_html()
|
||||||
return "../core_components/client.html#"
|
return "../core_components/"..typename..".html#"
|
||||||
end
|
end
|
||||||
|
|
||||||
local clientruleproperty = parser.parse_files(files, "clientruleproperty", matcher, matcher2)
|
local clientruleproperty = parser.parse_files(files, "clientruleproperty", matcher, matcher2)
|
||||||
|
|
Loading…
Reference in New Issue