Class: Giblish::DotDigraphAdoc

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/indexbuilders/dotdigraphadoc.rb

Overview

Provides a graphviz-formatted digraph of the provided node<->id ref map.

See graphviz.gitlab.io/doc/conv_info/lang.html for one definition of the language.

A short example:

graphviz,target=“docdeps”,format=“svg”,svg-type=“inline”

.… digraph document_deps

bgcolor="#33333310"
node [shape=note,
      fillcolor="#ebf26680",
      style="filled,solid"
    ]

rankdir=“LR”

“D-3”[label=“D-3n Doc 3”, URL=“file3.html” ] “D-2”[label=“D-2n Doc 2”, URL=“my/file2.html” ] “D-1”[label=“D-1n Doc 1”, URL=“my/subdir/file1.html” ] “D-1” -> { “D-2” “D-3” “D-2” -> { “D-1”} “D-3” } .…

Instance Method Summary collapse

Constructor Details

#initialize(info_2_ids:, target: "gibgraph", format: "svg", opts: {"svg-type" => "inline"}) ⇒ DotDigraphAdoc

info_2_ids

A => [doc id refs] hash.

The following properties are expected from the ConversionInfo:

title

String

doc_id

String

dst_rel_path

String - the relative path from a the repo top to a doc in the dst tree

target
format
opts

additional options => “value”. Currently supported:

cachedir

the directory to use for storing files produced during diagram generation.

svg-type

how to embed svg images



47
48
49
50
51
52
53
54
55
# File 'lib/giblish/indexbuilders/dotdigraphadoc.rb', line 47

def initialize(info_2_ids:, target: "gibgraph", format: "svg", opts: {"svg-type" => "inline"})
  @info_2_ids = info_2_ids
  @target = target
  @format = format
  @opts = opts

  @noid_docs = {}
  @next_id = 0
end

Instance Method Details

#sourceObject



57
58
59
60
61
62
63
64
# File 'lib/giblish/indexbuilders/dotdigraphadoc.rb', line 57

def source
  <<~DOC_STR
    #{graph_header}
    #{generate_labels}
    #{generate_deps}
    #{graph_footer}
  DOC_STR
end