summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-08-10 15:44:55 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-08-10 15:44:55 +0100
commitfd54363a4dedbd20d97f1f0ffe52ea20980c1f3c (patch)
tree95d74aac2eabec662c2bc48f9e5569b44731834b
parentcb5ff3c60b7aebcf5f110a88cd8ab51fdaa0a4b8 (diff)
downloadefl-fd54363a4dedbd20d97f1f0ffe52ea20980c1f3c.tar.gz
docs: abstracted writing of folded sections
-rw-r--r--src/scripts/elua/apps/docgen/writer.lua15
-rw-r--r--src/scripts/elua/apps/gendoc.lua14
2 files changed, 18 insertions, 11 deletions
diff --git a/src/scripts/elua/apps/docgen/writer.lua b/src/scripts/elua/apps/docgen/writer.lua
index ce80419c8e..06b6563a8f 100644
--- a/src/scripts/elua/apps/docgen/writer.lua
+++ b/src/scripts/elua/apps/docgen/writer.lua
@@ -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
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 1aab98a339..06ec97d70b 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -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()