Fix cyclic build dependency for 06-appearance.md.lua
Previously this code checked the generated documentation to decide if something is a class or a module. Now, it parses the source file and looks for the @classmod, @module and @submodule tags to make the same decision. Fixes: https://github.com/awesomeWM/awesome/issues/1255 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
61229500a2
commit
b8956090d9
|
@ -62,31 +62,30 @@ local function path_to_module(path)
|
||||||
error("Cannot figure out module for " .. tostring(path))
|
error("Cannot figure out module for " .. tostring(path))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function module_to_html(mod)
|
local function path_to_html(path)
|
||||||
mod = mod:gsub(".init", "")
|
local mod = path_to_module(path):gsub(".init", "")
|
||||||
|
local f = assert(io.open(path))
|
||||||
local f = io.open("doc/classes/".. mod ..".html","r")
|
while true do
|
||||||
|
local line = f:read()
|
||||||
if f~=nil then
|
if not line then break end
|
||||||
f:close()
|
if line:match("@classmod") then
|
||||||
return "../classes/".. mod ..".html"
|
f:close()
|
||||||
|
return "../classes/".. mod ..".html"
|
||||||
|
end
|
||||||
|
if line:match("@module") or line:match("@submodule") then
|
||||||
|
f:close()
|
||||||
|
return "../libraries/".. mod ..".html"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
f:close()
|
||||||
|
|
||||||
f = io.open("doc/libraries/".. mod ..".html","r")
|
error("Cannot figure out if module or class: " .. tostring(path))
|
||||||
|
|
||||||
if f~=nil then
|
|
||||||
f:close()
|
|
||||||
return "../libraries/".. mod ..".html"
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This can happen
|
|
||||||
return ""
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_link(file, element)
|
local function get_link(file, element)
|
||||||
return table.concat {
|
return table.concat {
|
||||||
"<a href='",
|
"<a href='",
|
||||||
module_to_html(path_to_module(file)),
|
path_to_html(file),
|
||||||
"#",
|
"#",
|
||||||
element,
|
element,
|
||||||
"'>",
|
"'>",
|
||||||
|
|
Loading…
Reference in New Issue