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
|
||||
)
|
||||
|
||||
foreach(RULE_TYPE client tag screen notification)
|
||||
add_custom_command(
|
||||
OUTPUT ${BUILD_DIR}/docs/common/rules_index.ldoc
|
||||
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,7 +131,8 @@ 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)()
|
||||
|
||||
|
@ -163,7 +164,7 @@ local function parse_files(paths, property_name, matcher, name_matcher)
|
|||
else
|
||||
table.insert(ret, {
|
||||
file = file,
|
||||
name = name:gsub("_", "\\_"),
|
||||
name = name:gsub("_", "_"),
|
||||
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
||||
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
||||
mod = path_to_module(file),
|
||||
|
@ -173,6 +174,9 @@ local function parse_files(paths, property_name, matcher, name_matcher)
|
|||
buffer = ""
|
||||
end
|
||||
end
|
||||
|
||||
f:close()
|
||||
end
|
||||
end
|
||||
|
||||
return ret
|
||||
|
|
|
@ -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