jekyll-graph 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66875092a5dcc753a34bb074f399ec0e5de3cbaa9a25fa154fc585420bce6007
4
- data.tar.gz: '0423681fcf78d2fc0487d318c02d52b8cfe9f93d4be79747bfa72b7a3ae00be5'
3
+ metadata.gz: 9c8e8d2c47a467d671a541f0383514514ce1dc661b547384badcf7ff127a7f48
4
+ data.tar.gz: b71d501a8c8b3eabcc7f5c54534d299bcb31b15459281ec57ee54a72275ddb07
5
5
  SHA512:
6
- metadata.gz: d2439f89e5287ab1c298e9e4e42563b43961debe93200b69c2cf9f2768bb70ce97c9084c58c34f14ad331e1f3f414d07b54f66688047ff8764cebccba846addb
7
- data.tar.gz: 4b9eec6d0e335d670714fb128736f2883d53d38d2c066acb3f2901fb3ba002d854276778c35ab18b4c707ae7ef74c34eaa66e47f667fb887c3c5127a7f29082e
6
+ metadata.gz: bc3bb48999037c60980546dbec3192ae9c857b11f73cc36d947370535f0a81e7420b2273af8bbd1ee24fb0fa637354f0dfca8658c5dcae521b78525c928cdf3c
7
+ data.tar.gz: a397d40e8f56f1968780bc0fcf8573471365746ff59a1ad6f4a2685e09dfb0a5756df1eaaf0141721a6caa9dec78ec91290926f3f7eed504319691656d5a22e7
data/README.md CHANGED
@@ -1,12 +1,15 @@
1
1
  # Jekyll-Graph
2
2
 
3
+ [![A WikiBonsai Project](https://img.shields.io/badge/%F0%9F%8E%8B-A%20WikiBonsai%20Project-brightgreen)](https://github.com/wikibonsai/wikibonsai)
4
+ [![Ruby Gem](https://img.shields.io/gem/v/jekyll-graph)](https://rubygems.org/gems/jekyll-graph)
5
+
3
6
  ⚠️ This is gem is under active development! ⚠️
4
7
 
5
8
  ⚠️ Expect breaking changes and surprises until otherwise noted (likely by v0.1.0 or v1.0.0). ⚠️
6
9
 
7
- Jekyll-Graph generates data and renders a graph that allows visitors to navigate a jekyll site by clicking nodes in the graph. Nodes are generated from the site's markdown files. Links for the tree graph are generated from [`jekyll-namespaces`](https://github.com/manunamz/jekyll-namespaces) and links for the net-web graph from [`jekyll-wikilinks`](https://github.com/manunamz/jekyll-wikilinks).
10
+ Jekyll-Graph generates data and renders a graph that allows visitors to navigate a jekyll site by clicking nodes in the graph. Nodes are generated from the site's markdown files. Links for the tree graph are generated from [`jekyll-semtree`](https://github.com/wikibonsai/jekyll-semtree) or [`jekyll-namespaces`](https://github.com/manunamz/jekyll-namespaces) and links for the net-web graph from [`jekyll-wikirefs`](https://github.com/wikibonsai/jekyll-wikirefs) [`jekyll-wikilinks`](https://github.com/manunamz/jekyll-wikilinks).
8
11
 
9
- This gem is part of the [jekyll-bonsai](https://jekyll-bonsai.netlify.app/) project. 🎋
12
+ 🏡 Build and maintain a treehouze to play in in your [WikiBonsai](https://github.com/wikibonsai/wikibonsai) digital garden.
10
13
 
11
14
  ## Installation
12
15
 
@@ -144,6 +147,8 @@ No configurations are strictly necessary for plugin defaults to work.
144
147
  Graph colors are determined by css variables which may be defined like so -- any valid css color works (hex, rgba, etc.):
145
148
 
146
149
  ```CSS
150
+ /* make sure color vars are attached to the root of the html document */
151
+ html {
147
152
  /* nodes */
148
153
  /* glow */
149
154
  --graph-node-current-glow: yellow;
@@ -159,6 +164,7 @@ Graph colors are determined by css variables which may be defined like so -- any
159
164
  --graph-particles-color: grey;
160
165
  /* label text */
161
166
  --graph-text-color: black;
167
+ }
162
168
  ```
163
169
 
164
170
  ## Data
data/jekyll-graph.gemspec CHANGED
@@ -34,7 +34,4 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  # For more information and examples about making a new gem, checkout our
36
36
  # guide at: https://bundler.io/guides/creating_gem.html
37
-
38
- spec.add_runtime_dependency "jekyll-namespaces", "~> 0.0.3"
39
- spec.add_runtime_dependency "jekyll-wikilinks", "~> 0.0.11"
40
37
  end
@@ -227,7 +227,7 @@ export default class JekyllGraph {
227
227
  // draw helpers
228
228
 
229
229
  shiftNodeHeight(node) {
230
- if (node.namespace !== 'root' && !this.shifted.includes(node)) {
230
+ if ((node.namespace !== 'root') && (node.namespace !== 'i.bonsai') && !this.shifted.includes(node)) {
231
231
  const padding = 5;
232
232
  let areSiblingsLeftEven = (this.numSiblingsLeft[node.parent] % 2) === 1;
233
233
  let altrntr = areSiblingsLeftEven ? 1 : -1;
@@ -3,7 +3,7 @@
3
3
  module Jekyll
4
4
  module Graph
5
5
 
6
- VERSION = "0.0.8"
6
+ VERSION = "0.0.10"
7
7
 
8
8
  end
9
9
  end
data/lib/jekyll-graph.rb CHANGED
@@ -37,7 +37,7 @@ module Jekyll
37
37
  return
38
38
  end
39
39
  if !$graph_conf.disabled_tree? && !site.respond_to?(:tree)
40
- Jekyll.logger.error("Jekyll-Graph: To generate the tree graph, please either add and enable the 'jekyll-namespaces' plugin or disable the tree in the jekyll-graph config")
40
+ Jekyll.logger.error("Jekyll-Graph: To generate the tree graph, please either add and enable the 'jekyll-semtree' or 'jekyll-namespaces' plugin, or disable the tree in the jekyll-graph config")
41
41
  return
42
42
  end
43
43
 
@@ -173,7 +173,7 @@ module Jekyll
173
173
  #
174
174
  @site.link_index.index[doc.url].missing.each do |missing_link_name|
175
175
  if net_web_nodes.none? { |node| node[:id] == missing_link_name }
176
- Jekyll.logger.warn("Jekyll-Graph: Net-Web node missing: #{missing_link_name}, in: #{doc.data['title']}")
176
+ Jekyll.logger.warn("Jekyll-Graph: Net-Web node missing: #{missing_link_name}, in: #{File.basename(doc.basename, File.extname(doc.basename))}")
177
177
  net_web_nodes << {
178
178
  id: missing_link_name, # an id is necessary for link targets
179
179
  url: '',
@@ -242,18 +242,24 @@ module Jekyll
242
242
  return net_web_nodes, net_web_links
243
243
  end
244
244
 
245
+ # used for both plugins:
246
+ # jekyll-semtree
247
+ # jekyll-namespace
245
248
  def generate_json_tree(node, json_parent="", tree_nodes=[], tree_links=[], level=0)
249
+ node = node.is_a?(String) ? @site.tree.nodes.detect { |n| n.text == node } : node
246
250
  #
247
251
  # missing nodes
248
252
  #
249
253
  if node.missing
250
- Jekyll.logger.warn("Jekyll-Graph: Document for tree node missing: ", node.namespace)
254
+ missing_text = node.namespace ? node.namespace : node.text
255
+ Jekyll.logger.warn("Jekyll-Graph: Tree node missing: ", missing_text)
251
256
 
252
- leaf = node.namespace.split('.').pop()
257
+ if node.namespace
258
+ leaf = node.namespace.split('.').pop()
259
+ end
253
260
  missing_node = {
254
- id: node.namespace,
255
- label: leaf.gsub('-', ' '),
256
- namespace: node.namespace,
261
+ id: node.namespace ? node.namespace : node.text,
262
+ label: node.namespace ? leaf.gsub('-', ' ') : node.text,
257
263
  url: "",
258
264
  level: level,
259
265
  lineage: {
@@ -262,12 +268,15 @@ module Jekyll
262
268
  },
263
269
  siblings: [],
264
270
  }
271
+ if node.namespace
272
+ missing_node['namespace'] = node.namespace
273
+ end
265
274
  # non-root handling
266
275
  if !json_parent.empty?
267
276
  missing_node[:parent] = json_parent[:id]
268
277
  tree_links << {
269
278
  source: json_parent[:id],
270
- target: node.namespace,
279
+ target: node.namespace ? node.namespace : node.text,
271
280
  }
272
281
  end
273
282
  tree_nodes << missing_node
@@ -279,7 +288,6 @@ module Jekyll
279
288
  existing_node = {
280
289
  id: node.url,
281
290
  label: node.title,
282
- namespace: node.namespace,
283
291
  url: relative_url(node.url),
284
292
  level: level,
285
293
  lineage: {
@@ -288,6 +296,9 @@ module Jekyll
288
296
  },
289
297
  siblings: [],
290
298
  }
299
+ if node.namespace
300
+ existing_node['namespace'] = node.namespace
301
+ end
291
302
  # non-root handling
292
303
  if !json_parent.empty?
293
304
  existing_node[:parent] = json_parent[:id]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - manunamz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2023-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -24,34 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.2.0
27
- - !ruby/object:Gem::Dependency
28
- name: jekyll-namespaces
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.0.3
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.0.3
41
- - !ruby/object:Gem::Dependency
42
- name: jekyll-wikilinks
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.0.11
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.0.11
55
27
  description:
56
28
  email:
57
29
  - manunamz@pm.me
@@ -100,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
72
  - !ruby/object:Gem::Version
101
73
  version: '0'
102
74
  requirements: []
103
- rubygems_version: 3.2.27
75
+ rubygems_version: 3.4.10
104
76
  signing_key:
105
77
  specification_version: 4
106
78
  summary: Add d3 graph generation to jekyll.