docs: Remove the somewhat unreadable graphs from web output
authorAndy Williams <andy@andywilliams.me>
Wed, 13 Dec 2017 10:06:16 +0000 (10:06 +0000)
committerAndy Williams <andy@andywilliams.me>
Wed, 13 Dec 2017 10:08:21 +0000 (10:08 +0000)
src/scripts/elua/apps/docgen/writer.lua
src/scripts/elua/apps/gendoc.lua

index 9042c84..92be2f1 100644 (file)
@@ -295,76 +295,6 @@ writers["dokuwiki"] = util.Object:clone {
         return self
     end,
 
-    write_graph = function(self, tbl)
-        if not M.has_feature("dot") then
-            return self
-        end
-        self:write_raw("<graphviz>\n")
-        self:write_raw("digraph ", tbl.type, " {\n")
-
-        for k, v in pairs(tbl.attrs or {}) do
-            self:write_raw("    ", k, " = \"", v, "\"\n")
-        end
-
-        local write_attrs = function(attrs)
-            if not attrs then
-                return
-            end
-            self:write_raw(" [")
-            local first = true
-            for k, v in pairs(attrs) do
-                if not first then
-                    self:write_raw(", ")
-                end
-                self:write_raw(k, " = \"", v, "\"")
-                first = false
-            end
-            self:write_raw("]")
-        end
-
-        if tbl.node then
-            self:write_nl()
-            self:write_raw("    node")
-            write_attrs(tbl.node)
-            self:write_nl()
-        end
-        if tbl.edge then
-            if not tbl.node then self:write_nl() end
-            self:write_raw("    edge")
-            write_attrs(tbl.edge)
-            self:write_nl()
-        end
-
-        self:write_nl()
-        for i, v in ipairs(tbl.nodes) do
-            local nname = v.name
-            v.name = nil
-            self:write_raw("    ", nname)
-            write_attrs(v)
-            self:write_nl()
-        end
-
-        self:write_nl()
-        for i, v in ipairs(tbl.connections) do
-            local from, to, sep, attrs = v[1], v[2], (v[3] or "->")
-            if type(from) == "table" then
-                self:write_raw("    {", table.concat(from, ", "), "}")
-            else
-                self:write_raw("    ", from)
-            end
-            self:write_raw(" ", sep, " ")
-            if type(to) == "table" then
-                self:write_raw("{", table.concat(to, ", "), "}")
-            else
-                self:write_raw(to)
-            end
-            write_attrs(v[4])
-            self:write_nl()
-        end
-
-        self:write_raw("}\n</graphviz>")
-    end,
-
     write_table = function(self, titles, tbl)
         if titles then
             self:write_raw("^ ", table.concat(titles, " ^ "), " ^\n")
index ee306bf..6de63b7 100644 (file)
@@ -615,62 +615,6 @@ local set_theme = function(tname)
     end
 end
 
-local class_to_node = function(cl, main)
-    local ret = {}
-
-    ret.label = cl:full_name_get()
-    ret.name = ret.label:lower():gsub("%.", "_")
-
-    local clr = cl:theme_str_get()
-
-    ret.style = current_theme.classes[clr].style
-    ret.color = current_theme.classes[clr][main and "primary_color" or "color"]
-    ret.fillcolor = current_theme.classes[clr][main and "primary_fill_color"
-                                                     or "fill_color"]
-    ret.fontcolor = current_theme.classes[clr][main and "primary_font_color"
-                                                     or "font_color"]
-
-    -- FIXME: need a dokuwiki graphviz plugin with proper URL support
-    -- the existing one only supports raw URLs (no dokuwikí namespaces)
-    --ret.URL = ":" .. global_opts.root_nspace .. ":"
-    --              .. table.concat(cl:nspaces_get(), ":")
-
-    return ret
-end
-
-local build_igraph_r
-build_igraph_r = function(cl, nbuf, ibuf)
-    local sn = cl:full_name_get():lower():gsub("%.", "_")
-    for i, acl in ipairs(cl:inherits_get()) do
-        nbuf[#nbuf + 1] = class_to_node(acl)
-        ibuf[#ibuf + 1] = { sn, (acl:full_name_get():lower():gsub("%.", "_")) }
-        build_igraph_r(acl, nbuf, ibuf)
-    end
-end
-
-local build_igraph = function(cl)
-    local graph = {
-        type = "hierarchy",
-        attrs = {
-            rankdir = current_theme.rank_dir,
-            size = current_theme.size,
-            bgcolor = current_theme.bg_color
-        },
-        node = current_theme.node,
-        edge = current_theme.edge
-    }
-
-    local nbuf = {}
-    local ibuf = {}
-    nbuf[#nbuf + 1] = class_to_node(cl, true)
-    build_igraph_r(cl, nbuf, ibuf)
-
-    graph.nodes = nbuf
-    graph.connections = ibuf
-
-    return graph
-end
-
 local find_parent_impl
 find_parent_impl = function(fulln, cl)
     for i, pcl in ipairs(cl:inherits_get()) do
@@ -1025,9 +969,6 @@ local build_class = function(cl)
     end
     f:write_nl()
 
-    f:write_folded("Inheritance graph", function()
-        f:write_graph(build_igraph(cl))
-    end)
     if writer.has_feature("dot") then
         f:write_nl(2)
     end
@@ -1634,7 +1575,6 @@ getopt.parse {
         { "n", "namespace", true, help = "Root namespace of the docs." },
         { nil, "graph-theme", true, help = "Optional graph theme." },
         { nil, "graph-theme-light", false, help = "Use light builtin graph theme." },
-        { nil, "disable-graphviz", false, help = "Disable graphviz usage." },
         { nil, "disable-notes", false, help = "Disable notes plugin usage." },
         { nil, "disable-folded", false, help = "Disable folded plugin usage." },
         { nil, "disable-title", false, help = "Disable title plugin usage." },
@@ -1693,7 +1633,6 @@ getopt.parse {
         local wfeatures = {
             notes = not opts["disable-notes"],
             folds = not opts["disable-folded"],
-            dot = not opts["disable-graphviz"],
             title = not opts["disable-title"]
         }
         writer.init(rootns, wfeatures)