summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-07-28 14:18:58 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-07-28 14:19:12 +0100
commit63a3da0c0fa2e4a05cd214ccb39c703be137ab5d (patch)
tree9f02950baa09278104f4e9be3ab78b3818c74b69
parent26ebd20db84bcb4197f50397aedae4da3ab2d36a (diff)
docs: support for writing edge styles for individual connections
-rw-r--r--src/scripts/elua/apps/docgen/writer.lua24
-rw-r--r--src/scripts/elua/apps/gendoc.lua6
2 files changed, 22 insertions, 8 deletions
diff --git a/src/scripts/elua/apps/docgen/writer.lua b/src/scripts/elua/apps/docgen/writer.lua
index 3ba6e39..14e8bae 100644
--- a/src/scripts/elua/apps/docgen/writer.lua
+++ b/src/scripts/elua/apps/docgen/writer.lua
@@ -132,8 +132,11 @@ M.Writer = util.Object:clone {
132 self:write_raw(" ", k, " = \"", v, "\"\n") 132 self:write_raw(" ", k, " = \"", v, "\"\n")
133 end 133 end
134 134
135 local write_node = function(nname, attrs) 135 local write_attrs = function(attrs)
136 self:write_raw(" ", nname, " [") 136 if not v then
137 return
138 end
139 self:write_raw(" [")
137 local first = true 140 local first = true
138 for k, v in pairs(attrs) do 141 for k, v in pairs(attrs) do
139 if not first then 142 if not first then
@@ -142,28 +145,34 @@ M.Writer = util.Object:clone {
142 self:write_raw(k, " = \"", v, "\"") 145 self:write_raw(k, " = \"", v, "\"")
143 first = false 146 first = false
144 end 147 end
145 self:write_raw("]\n") 148 self:write_raw("]")
146 end 149 end
147 150
148 if tbl.node then 151 if tbl.node then
149 self:write_nl() 152 self:write_nl()
150 write_node("node", tbl.node) 153 self:write_raw(" node")
154 write_attrs(tbl.node)
155 self:write_nl()
151 end 156 end
152 if tbl.edge then 157 if tbl.edge then
153 if not tbl.node then self:write_nl() end 158 if not tbl.node then self:write_nl() end
154 write_node("edge", tbl.edge) 159 self:write_raw(" edge")
160 write_attrs(tbl.edge)
161 self:write_nl()
155 end 162 end
156 163
157 self:write_nl() 164 self:write_nl()
158 for i, v in ipairs(tbl.nodes) do 165 for i, v in ipairs(tbl.nodes) do
159 local nname = v.name 166 local nname = v.name
160 v.name = nil 167 v.name = nil
161 write_node(nname, v) 168 self:write_raw(" ", nname)
169 write_attrs(v)
170 self:write_nl()
162 end 171 end
163 172
164 self:write_nl() 173 self:write_nl()
165 for i, v in ipairs(tbl.connections) do 174 for i, v in ipairs(tbl.connections) do
166 local from, to, sep = v[1], v[2], (v[3] or "->") 175 local from, to, sep, attrs = v[1], v[2], (v[3] or "->")
167 if type(from) == "table" then 176 if type(from) == "table" then
168 self:write_raw(" {", table.concat(from, ", "), "}") 177 self:write_raw(" {", table.concat(from, ", "), "}")
169 else 178 else
@@ -175,6 +184,7 @@ M.Writer = util.Object:clone {
175 else 184 else
176 self:write_raw(to) 185 self:write_raw(to)
177 end 186 end
187 write_attrs(v[4])
178 self:write_nl() 188 self:write_nl()
179 end 189 end
180 190
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 6d45598..417ddf5 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -551,6 +551,9 @@ local default_theme = {
551 node = { 551 node = {
552 shape = "box" 552 shape = "box"
553 }, 553 },
554 edge = {
555 color = "black"
556 },
554 bg_color = "transparent" 557 bg_color = "transparent"
555} 558}
556 559
@@ -604,7 +607,8 @@ local build_igraph = function(cl)
604 size = "6", 607 size = "6",
605 bgcolor = default_theme.bg_color 608 bgcolor = default_theme.bg_color
606 }, 609 },
607 node = default_theme.node 610 node = default_theme.node,
611 edge = default_theme.edge
608 } 612 }
609 613
610 local nbuf = {} 614 local nbuf = {}