diff --git a/config/config.go b/config/config.go
index 80c82746..d9112774 100644
--- a/config/config.go
+++ b/config/config.go
@@ -55,6 +55,7 @@ type Config struct {
DocPath string `yaml:"docPath"`
DescPath string `yaml:"descPath"`
Graph *Graph `yaml:"graph,omitempty"`
+ HideRealNodes bool `yaml:"hideRealNodes"`
Diagrams []*Diagram `yaml:"diagrams"`
Nodes []*Node `yaml:"nodes"`
Relations []*Relation `yaml:"relations"`
diff --git a/config/yaml.go b/config/yaml.go
index 9d5bdcd4..bccf51b5 100644
--- a/config/yaml.go
+++ b/config/yaml.go
@@ -11,15 +11,16 @@ import (
func (d *Config) UnmarshalYAML(data []byte) error {
raw := struct {
- Name string `yaml:"name"`
- Desc string `yaml:"desc,omitempty"`
- DocPath string `yaml:"docPath"`
- DescPath string `yaml:"descPath"`
- Graph *Graph `yaml:"graph,omitempty"`
- Diagrams []*Diagram `yaml:"diagrams"`
- Nodes []*Node `yaml:"nodes"`
- Networks []interface{} `yaml:"networks"`
- Relations []interface{} `yaml:"relations"`
+ Name string `yaml:"name"`
+ Desc string `yaml:"desc,omitempty"`
+ DocPath string `yaml:"docPath"`
+ DescPath string `yaml:"descPath"`
+ Graph *Graph `yaml:"graph,omitempty"`
+ HideRealNodes bool `yaml:"hideRealNodes"`
+ Diagrams []*Diagram `yaml:"diagrams"`
+ Nodes []*Node `yaml:"nodes"`
+ Networks []interface{} `yaml:"networks"`
+ Relations []interface{} `yaml:"relations"`
}{}
if err := yaml.Unmarshal(data, &raw); err != nil {
@@ -30,6 +31,7 @@ func (d *Config) UnmarshalYAML(data []byte) error {
d.DocPath = raw.DocPath
d.DescPath = raw.DescPath
d.Graph = raw.Graph
+ d.HideRealNodes = raw.HideRealNodes
d.Diagrams = raw.Diagrams
d.Nodes = raw.Nodes
diff --git a/output/dot/dot.go b/output/dot/dot.go
index 3da5451f..319f22e8 100644
--- a/output/dot/dot.go
+++ b/output/dot/dot.go
@@ -42,6 +42,7 @@ func (d *Dot) OutputDiagram(wr io.Writer, diag *config.Diagram) error {
"GlobalComponents": d.config.GlobalComponents(),
"Edges": config.MergeEdges(nEdges),
"HideUnlinked": false,
+ "HideRealNodes": d.config.HideRealNodes,
}); err != nil {
return err
}
@@ -277,6 +278,7 @@ func (d *Dot) OutputRelation(wr io.Writer, rel *config.Relation) error {
"GlobalComponents": globalComponents,
"Edges": edges,
"HideUnlinked": true,
+ "HideRealNodes": d.config.HideRealNodes,
}); err != nil {
return err
}
diff --git a/output/dot/templates/diagram.dot.tmpl b/output/dot/templates/diagram.dot.tmpl
index 22793c25..781698ee 100644
--- a/output/dot/templates/diagram.dot.tmpl
+++ b/output/dot/templates/diagram.dot.tmpl
@@ -11,7 +11,7 @@ digraph ndiag {
{{ range $n := .cluster.Nodes }}
subgraph "cluster_{{ $n | id }}" {
- label = "{{ $n.Name | unesc }} ({{ len $n.RealNodes }})";
+ label = "{{ $n.Name | unesc }}{{ if not $.hideRealNodes }} ({{ len $n.RealNodes }}){{ end }}";
style = "solid,bold,filled";
color = "#333333"
fillcolor = "#FFFFFF"
@@ -35,18 +35,18 @@ digraph ndiag {
{{ end }}
{{ range $c := .cluster.Children }}
- {{ template "cluster" (dict "cluster" $c "edges" $.edges "hideUnlinked" $.hideUnlinked) }}
+ {{ template "cluster" (dict "cluster" $c "edges" $.edges "hideUnlinked" $.hideUnlinked "hideRealNodes" $.hideRealNodes) }}
{{ end }}
}
{{ end }}
{{ range $c := .Clusters }}
- {{ template "cluster" (dict "cluster" $c "edges" $.Edges "hideUnlinked" $.HideUnlinked) }}
+ {{ template "cluster" (dict "cluster" $c "edges" $.Edges "hideUnlinked" $.HideUnlinked "hideRealNodes" $.HideRealNodes) }}
{{ end }}
{{ range $n := .RemainNodes }}
subgraph "cluster_{{ $n.Name }}" {
- label = "{{ $n | fullname }} ({{ len $n.RealNodes }})";
+ label = "{{ $n | fullname }}{{ if not $.HideRealNodes }} ({{ len $n.RealNodes }}){{ end }}";
style = "solid,bold";
{{ range $co := $n.Components }}
{{ if or (not $.HideUnlinked) (is_linked $co $.Edges) }}
diff --git a/output/dot/templates/node.dot.tmpl b/output/dot/templates/node.dot.tmpl
index ca97d449..b59e490a 100644
--- a/output/dot/templates/node.dot.tmpl
+++ b/output/dot/templates/node.dot.tmpl
@@ -11,7 +11,7 @@ digraph ndiag {
{{ range $n := .cluster.Nodes }}
subgraph "cluster_{{ $n | id }}" {
- label = "{{ $n.Name | unesc }} ({{ len $n.RealNodes }})";
+ label = "{{ $n.Name | unesc }}{{ if not $.hideRealNodes }} ({{ len $n.RealNodes }}){{ end }}";
style = "solid,bold,filled";
color = "#333333"
fillcolor = "#FFFFFF"
@@ -35,18 +35,18 @@ digraph ndiag {
{{ end }}
{{ range $c := .cluster.Children }}
- {{ template "cluster" (dict "cluster" $c "edges" $.edges) }}
+ {{ template "cluster" (dict "cluster" $c "edges" $.edges "hideRealNodes" $.hideRealNodes) }}
{{ end }}
}
{{ end }}
{{ range $c := .Clusters }}
- {{ template "cluster" (dict "cluster" $c "edges" $.Edges) }}
+ {{ template "cluster" (dict "cluster" $c "edges" $.Edges "hideRealNodes" $.HideRealNodes) }}
{{ end }}
{{ range $n := .RemainNodes }}
subgraph "cluster_{{ $n.Name }}" {
- label = "{{ $n | fullname }} ({{ len $n.RealNodes }})";
+ label = "{{ $n | fullname }}{{ if not $.HideRealNodes }} ({{ len $n.RealNodes }}){{ end }}";
style = "solid,bold";
{{ if eq $.MainNodeId ($n | id) }}
{{ else }}
diff --git a/output/md/md.go b/output/md/md.go
index 20a39bf7..30617ab9 100644
--- a/output/md/md.go
+++ b/output/md/md.go
@@ -45,12 +45,12 @@ func (m *Md) OutputDiagram(wr io.Writer, d *config.Diagram) error {
tmpl := template.Must(template.New(d.Name).Funcs(output.FuncMap).Parse(ts))
tmplData := map[string]interface{}{
- "Diagram": d,
- "Format": m.config.Format(),
- "DescPath": relPath,
- "Layers": layers,
- "Nodes": m.config.Nodes,
- "Tags": m.config.Tags(),
+ "Diagram": d,
+ "Format": m.config.Format(),
+ "DescPath": relPath,
+ "Layers": layers,
+ "Nodes": m.config.Nodes,
+ "Tags": m.config.Tags(),
}
if err := tmpl.Execute(wr, tmplData); err != nil {
return err
@@ -76,10 +76,10 @@ func (m *Md) OutputLayer(wr io.Writer, l *config.Layer) error {
tmpl := template.Must(template.New(l.Name).Funcs(output.FuncMap).Parse(ts))
tmplData := map[string]interface{}{
- "Layer": l,
- "Format": m.config.Format(),
- "DescPath": relPath,
- "Clusters": clusters,
+ "Layer": l,
+ "Format": m.config.Format(),
+ "DescPath": relPath,
+ "Clusters": clusters,
}
if err := tmpl.Execute(wr, tmplData); err != nil {
return err
@@ -118,12 +118,13 @@ func (m *Md) OutputNode(wr io.Writer, n *config.Node) error {
tmpl := template.Must(template.New(n.Id()).Funcs(output.FuncMap).Parse(ts))
tmplData := map[string]interface{}{
- "Node": n,
- "Format": m.config.Format(),
- "DescPath": relPath,
- "Components": n.Components,
- "RealNodes": n.RealNodes,
- "Tags": tags,
+ "Node": n,
+ "Format": m.config.Format(),
+ "DescPath": relPath,
+ "Components": n.Components,
+ "RealNodes": n.RealNodes,
+ "Tags": tags,
+ "HideRealNodes": m.config.HideRealNodes,
}
if err := tmpl.Execute(wr, tmplData); err != nil {
return err
@@ -144,9 +145,9 @@ func (m *Md) OutputTag(wr io.Writer, t *config.Tag) error {
tmpl := template.Must(template.New(t.Id()).Funcs(output.FuncMap).Parse(ts))
tmplData := map[string]interface{}{
- "Tag": t,
- "Format": m.config.Format(),
- "DescPath": relPath,
+ "Tag": t,
+ "Format": m.config.Format(),
+ "DescPath": relPath,
}
if err := tmpl.Execute(wr, tmplData); err != nil {
@@ -169,9 +170,9 @@ func (m *Md) OutputRelation(wr io.Writer, rel *config.Relation) error {
tmpl := template.Must(template.New(rel.Id()).Funcs(output.FuncMap).Parse(ts))
tmplData := map[string]interface{}{
- "Relation": rel,
- "Format": m.config.Format(),
- "DescPath": relPath,
+ "Relation": rel,
+ "Format": m.config.Format(),
+ "DescPath": relPath,
}
if err := tmpl.Execute(wr, tmplData); err != nil {
@@ -194,14 +195,14 @@ func (m *Md) OutputIndex(wr io.Writer) error {
tmpl := template.Must(template.New("index").Funcs(output.FuncMap).Parse(ts))
tmplData := map[string]interface{}{
- "Config": m.config,
- "Diagram": m.config.PrimaryDiagram(),
- "Format": m.config.Format(),
- "DescPath": relPath,
- "Diagrams": m.config.Diagrams,
- "Layers": m.config.Layers(),
- "Nodes": m.config.Nodes,
- "Tags": m.config.Tags(),
+ "Config": m.config,
+ "Diagram": m.config.PrimaryDiagram(),
+ "Format": m.config.Format(),
+ "DescPath": relPath,
+ "Diagrams": m.config.Diagrams,
+ "Layers": m.config.Layers(),
+ "Nodes": m.config.Nodes,
+ "Tags": m.config.Tags(),
}
if err := tmpl.Execute(wr, tmplData); err != nil {
return err
diff --git a/output/md/templates/diagram.md.tmpl b/output/md/templates/diagram.md.tmpl
index c7cb8b1b..e2b7b1fd 100644
--- a/output/md/templates/diagram.md.tmpl
+++ b/output/md/templates/diagram.md.tmpl
@@ -21,7 +21,7 @@
| Name (node count) | Description |
| --- | --- |
{{- range $i, $n := .Nodes }}
-| [{{ $n | fullname }}]({{ mdpath "node" ($n | id) }}) ({{ len $n.RealNodes }}) | {{ if ne $n.Desc "" }}{{ $n.Desc | summary }}{{ else }}:pencil2:{{ end }} |
+| [{{ $n | fullname }}]({{ mdpath "node" ($n | id) }}){{ if not $.HideRealNodes }} ({{ len $n.RealNodes }}){{ end }} | {{ if ne $n.Desc "" }}{{ $n.Desc | summary }}{{ else }}:pencil2:{{ end }} |
{{- end }}
## Tag groups
diff --git a/output/md/templates/index.md.tmpl b/output/md/templates/index.md.tmpl
index 5bd9dd39..3c3770b4 100644
--- a/output/md/templates/index.md.tmpl
+++ b/output/md/templates/index.md.tmpl
@@ -25,7 +25,7 @@
| Name (node count) | Description |
| --- | --- |
{{- range $i, $n := .Nodes }}
-| [{{ $n | fullname }}]({{ mdpath "node" ($n | id) }}) ({{ len $n.RealNodes }}) | {{ if ne $n.Desc "" }}{{ $n.Desc | summary }}{{ else }}:pencil2:{{ end }} |
+| [{{ $n | fullname }}]({{ mdpath "node" ($n | id) }}){{ if not $.HideRealNodes }} ({{ len $n.RealNodes }}){{ end }} | {{ if ne $n.Desc "" }}{{ $n.Desc | summary }}{{ else }}:pencil2:{{ end }} |
{{- end }}
## Tag groups
diff --git a/output/md/templates/layer.md.tmpl b/output/md/templates/layer.md.tmpl
index 5fe8cd0f..91c8b6a9 100644
--- a/output/md/templates/layer.md.tmpl
+++ b/output/md/templates/layer.md.tmpl
@@ -31,7 +31,7 @@
| Name (node count) | Description |
| --- | --- |
{{- range $i, $n := $c.Nodes }}
-| [{{ $n | fullname }}]({{ mdpath "node" ($n | id) }}) ({{ len $n.RealNodes }}) | {{ if ne $n.Desc "" }}{{ $n.Desc | summary }}{{ else }}:pencil2:{{ end }} |
+| [{{ $n | fullname }}]({{ mdpath "node" ($n | id) }}){{ if not $.HideRealNodes }} ({{ len $n.RealNodes }}){{ end }} | {{ if ne $n.Desc "" }}{{ $n.Desc | summary }}{{ else }}:pencil2:{{ end }} |
{{- end }}
{{- end}}
diff --git a/output/md/templates/node.md.tmpl b/output/md/templates/node.md.tmpl
index 75b563f7..082d8dd2 100644
--- a/output/md/templates/node.md.tmpl
+++ b/output/md/templates/node.md.tmpl
@@ -22,10 +22,12 @@
{{- range $i, $t := .Tags }}
| [{{ $t | fullname }}]({{ mdpath "tag" ($t | id) }}) | {{ if ne $t.Desc "" }}{{ $t.Desc | summary }}{{ else }}:pencil2:{{ end }} |
{{- end }}
+{{- if not .HideRealNodes }}
## Real nodes
{{ range $i, $rn := .RealNodes }}
- {{ $rn | fullname }}
{{- end }}
+{{- end }}
---