diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-08-15 14:14:33 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-08-15 14:14:33 +0100 |
commit | 3e92d648089aca0f6c12e9021efb8d76da695b2f (patch) | |
tree | bb5f4df57dda421e9a8e5174c1d078a5fa0952bf /src | |
parent | bd944a377bce45698288d1799ff09cb218e4eb7f (diff) | |
download | efl-3e92d648089aca0f6c12e9021efb8d76da695b2f.tar.gz |
docs: generic namespace generator in Node
Diffstat (limited to 'src')
-rw-r--r-- | src/scripts/elua/apps/docgen/doctree.lua | 33 | ||||
-rw-r--r-- | src/scripts/elua/apps/docgen/mappings.lua | 13 | ||||
-rw-r--r-- | src/scripts/elua/apps/gendoc.lua | 10 |
3 files changed, 26 insertions, 30 deletions
diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua index e54113987b..8bab6cce1d 100644 --- a/src/scripts/elua/apps/docgen/doctree.lua +++ b/src/scripts/elua/apps/docgen/doctree.lua @@ -9,13 +9,31 @@ local writer local M = {} -local Node = util.Object:clone { +M.Node = util.Object:clone { scope = { PUBLIC = eolian.object_scope.PUBLIC, PRIVATE = eolian.object_scope.PRIVATE, PROTECTED = eolian.object_scope.PROTECTED - } + }, + + nspaces_get = function(self, subn, root) + local tbl = self:namespaces_get() + -- temporary workaround + if type(tbl) ~= "table" then + tbl = tbl:to_array() + end + for i = 1, #tbl do + tbl[i] = tbl[i]:lower() + end + table.insert(tbl, 1, subn) + tbl[#tbl + 1] = self:name_get():lower() + if root then + tbl[#tbl + 1] = true + end + return tbl + end } +local Node = M.Node local gen_doc_refd = function(str) if not writer then @@ -212,16 +230,7 @@ M.Class = Node:clone { end, nspaces_get = function(self, root) - local tbl = self:namespaces_get() - for i = 1, #tbl do - tbl[i] = tbl[i]:lower() - end - table.insert(tbl, 1, self:type_str_get()) - tbl[#tbl + 1] = self:name_get():lower() - if root then - tbl[#tbl + 1] = true - end - return tbl + return M.Node.nspaces_get(self, self:type_str_get(), root) end, -- static getters diff --git a/src/scripts/elua/apps/docgen/mappings.lua b/src/scripts/elua/apps/docgen/mappings.lua index 8266d6dc16..00f2c44c34 100644 --- a/src/scripts/elua/apps/docgen/mappings.lua +++ b/src/scripts/elua/apps/docgen/mappings.lua @@ -38,19 +38,6 @@ local decl_to_nspace = function(decl) end end -M.gen_nsp_eo = function(eobj, subn, root) - local tbl = eobj:namespaces_get():to_array() - for i = 1, #tbl do - tbl[i] = tbl[i]:lower() - end - table.insert(tbl, 1, subn) - tbl[#tbl + 1] = eobj:name_get():lower() - if root then - tbl[#tbl + 1] = true - end - return tbl -end - M.gen_nsp_ref = function(str, root) local decl = eolian.declaration_get_by_name(str) if decl then diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua index 84858d6106..dd3ccc2f80 100644 --- a/src/scripts/elua/apps/gendoc.lua +++ b/src/scripts/elua/apps/gendoc.lua @@ -315,7 +315,7 @@ local build_reftable = function(f, title, ctitle, ctype, t, iscl) for i, v in ipairs(t) do nt[#nt + 1] = { writer.Buffer():write_link( - iscl and v:nspaces_get() or eomap.gen_nsp_eo(v, ctype, true), + iscl and v:nspaces_get() or dtree.Node.nspaces_get(v, ctype, true), v:full_name_get() ):finish(), (iscl and v:doc_get() or dtree.Doc(v:documentation_get())):brief_get() @@ -760,7 +760,7 @@ local write_tsigs = function(f, tp) end local build_alias = function(tp) - local f = writer.Writer(eomap.gen_nsp_eo(tp, "alias")) + local f = writer.Writer(dtree.Node.nspaces_get(tp, "alias")) stats.check_alias(tp) write_tsigs(f, tp) @@ -773,7 +773,7 @@ local build_alias = function(tp) end local build_struct = function(tp) - local f = writer.Writer(eomap.gen_nsp_eo(tp, "struct")) + local f = writer.Writer(dtree.Node.nspaces_get(tp, "struct")) stats.check_struct(tp) write_tsigs(f, tp) @@ -798,7 +798,7 @@ local build_struct = function(tp) end local build_enum = function(tp) - local f = writer.Writer(eomap.gen_nsp_eo(tp, "enum")) + local f = writer.Writer(dtree.Node.nspaces_get(tp, "enum")) stats.check_enum(tp) write_tsigs(f, tp) @@ -823,7 +823,7 @@ local build_enum = function(tp) end local build_variable = function(v, constant) - local f = writer.Writer(eomap.gen_nsp_eo(v, constant and "constant" or "global")) + local f = writer.Writer(dtree.Node.nspaces_get(v, constant and "constant" or "global")) if constant then stats.check_constant(v) else |