forked from enlightenment/efl
docs: abstracted writing of folded sections
This commit is contained in:
parent
cb5ff3c60b
commit
fd54363a4d
|
@ -5,7 +5,7 @@ local dutil = require("docgen.util")
|
|||
|
||||
local M = {}
|
||||
|
||||
local root_nspace, use_notes
|
||||
local root_nspace, use_notes, use_folds
|
||||
|
||||
M.Writer = util.Object:clone {
|
||||
__ctor = function(self, path)
|
||||
|
@ -309,6 +309,16 @@ M.Writer = util.Object:clone {
|
|||
return self
|
||||
end,
|
||||
|
||||
write_folded = function(self, title, func)
|
||||
if use_folds then
|
||||
self:write_raw("++++ ", title, " |\n\n")
|
||||
end
|
||||
func(self)
|
||||
if use_folds then
|
||||
self:write_raw("\n\n++++")
|
||||
end
|
||||
end,
|
||||
|
||||
finish = function(self)
|
||||
self.file:close()
|
||||
end
|
||||
|
@ -333,9 +343,10 @@ M.Buffer = M.Writer:clone {
|
|||
end
|
||||
}
|
||||
|
||||
M.init = function(root_ns, notes)
|
||||
M.init = function(root_ns, notes, folds)
|
||||
root_nspace = root_ns
|
||||
use_notes = notes
|
||||
use_folds = folds
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -11,7 +11,7 @@ local keyref = require("docgen.keyref")
|
|||
local ser = require("docgen.serializers")
|
||||
local dtree = require("docgen.doctree")
|
||||
|
||||
local use_dot, use_folded
|
||||
local use_dot
|
||||
|
||||
-- eolian to various doc elements conversions
|
||||
|
||||
|
@ -744,13 +744,9 @@ local build_class = function(cl)
|
|||
keyref.add(cl:full_name_get():gsub("%.", "_"), "c")
|
||||
|
||||
if use_dot then
|
||||
if use_folded then
|
||||
f:write_raw("++++ Inheritance graph |\n\n")
|
||||
end
|
||||
f:write_graph(build_igraph(cl))
|
||||
if use_folded then
|
||||
f:write_raw("\n\n++++")
|
||||
end
|
||||
f:write_folded("Inheritance graph", function()
|
||||
f:write_graph(build_igraph(cl))
|
||||
end)
|
||||
f:write_nl(2)
|
||||
end
|
||||
|
||||
|
@ -1162,7 +1158,7 @@ getopt.parse {
|
|||
error("failed parsing eo files")
|
||||
end
|
||||
stats.init(not not opts["v"])
|
||||
writer.init(rootns, not opts["disable-notes"])
|
||||
writer.init(rootns, not opts["disable-notes"], not opts["disable-folded"])
|
||||
dutil.rm_root()
|
||||
dutil.mkdir_r(nil)
|
||||
build_ref()
|
||||
|
|
Loading…
Reference in New Issue