mindmapdoc 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 888e10fb37ea910866c7a53ee53dc7ef47adc35d
4
- data.tar.gz: 0217632f2c5fb6af79a3a76396f05e05f9f2d77c
3
+ metadata.gz: 774fe27f847f82e8e7d9b5abf181f88ad2c0dfac
4
+ data.tar.gz: c1b955d1f3e4a54f70b9ef2328ec5b8d76183d15
5
5
  SHA512:
6
- metadata.gz: af147ee78bd0bea1adc01c7104ce908db9393a71a6945be54e8228bb7abcbf8cfa84afe36c0c5061fb25774d691216bd934c031f7b01c54b7f6ad4abca919efa
7
- data.tar.gz: dfdf15930f4fb11a11d17f8140814000d8c81ff13b0c9a0bf3fc177970e9627b929e75d121a8885be1f18e85d5ac2f391972a204a4d79e032ae2857cc5db5503
6
+ metadata.gz: '053418b8a87c96c156bb63d84780d8a16b8484459f33bb2619bcbb2809259017e0a04ae88c9a23f6cae3b1add4ef21723e77ff61f037ce2b16750ab557e613f0'
7
+ data.tar.gz: 989ffc936f53945935ca7ddc2ff145184c144981165b09d91cbe8d4ea2301ba2f36a53a4e3a03c5f3dfd5f5c548e01d51c9599eb42c920a1f3845cff1f50c0ca
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mindmapdoc.rb CHANGED
@@ -29,20 +29,34 @@ class MindmapDoc
29
29
  @svg = build_svg(@tree)
30
30
 
31
31
  end
32
+
33
+ def load(s='mindmap.md')
34
+ buffer = File.read(s)
35
+ import(buffer)
36
+ end
32
37
 
33
38
  def to_svg()
34
39
  @svg
35
- end
40
+ end
36
41
 
37
42
  def to_tree()
38
- @tree
43
+ lines = @tree.lines
44
+ lines.shift
45
+ lines.map! {|x| x[2..-1]}.join
39
46
  end
47
+
48
+ alias to_s to_tree
40
49
 
41
50
  def to_md()
42
51
  @txtdoc
43
52
  end
44
53
 
45
54
  alias to_doc to_md
55
+
56
+ def save(s='mindmap.md')
57
+ File.write s, @txtdoc
58
+ 'mindmap written to file'
59
+ end
46
60
 
47
61
  private
48
62
 
@@ -66,16 +80,10 @@ class MindmapDoc
66
80
  "#{ x[/\d/]} id='#{id}'>#{x[/(?<=\>).*/]}"
67
81
  end
68
82
 
69
- linex = md.scan(/#[^\n]+\n/).map {|x| (' ' * (x.scan(/#/).length - 1)) + x[/(?<=# ).*/]}
70
- #log.info 'mindmap: linex: ' + linex.inspect
71
- @root = linex.shift
72
- linex.map! {|x| x[2..-1]}
73
- #log.info 'mindmap: root: ' + @root.inspect
74
- txt = linex.join("\n")
75
-
76
- #log.info 'mindmap: txt: ' + txt.inspect
83
+ lines = md.scan(/#[^\n]+\n/).map {|x| (' ' * (x.scan(/#/).length - 1)) + x[/(?<=# ).*/]}
84
+ @root = lines.first
77
85
 
78
- [txt, s]
86
+ [lines.join("\n"), s]
79
87
  end
80
88
 
81
89
 
@@ -83,7 +91,7 @@ class MindmapDoc
83
91
  #
84
92
  def parse_tree(s)
85
93
 
86
- asrc = [@root] + s.gsub(/\r/,'').strip.lines.map {|x| ' ' + x}
94
+ asrc = [@root + "\n"] + s.gsub(/\r/,'').strip.lines.map {|x| ' ' + x}
87
95
 
88
96
  a2 = asrc.inject([]) do |r,x|
89
97
 
@@ -95,7 +103,6 @@ class MindmapDoc
95
103
 
96
104
  end
97
105
 
98
- #log.info 'mindmap: a2' + a2.inspect
99
106
  a = @txtdoc.split(/.*(?=\n#)/).map(&:strip)
100
107
 
101
108
  a3 = []
@@ -103,15 +110,13 @@ class MindmapDoc
103
110
  a2.each do |x|
104
111
 
105
112
  r = a.grep /#{x}/
106
- #log.info 'mindmap: ' + r.inspect
107
113
  r2 = r.any? ? r.first : x
108
114
  a3 << "\n" + r2.strip.sub(/\w/) {|x| x.upcase} + "\n"
109
115
 
110
116
  end
111
- #log.info 'mindmap: a3:' + a3.inspect
112
117
 
113
118
  [asrc.join, a3.join]
114
119
 
115
120
  end
116
121
 
117
- end
122
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mindmapdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -103,5 +103,6 @@ rubyforge_project:
103
103
  rubygems_version: 2.6.13
104
104
  signing_key:
105
105
  specification_version: 4
106
- summary: mindmapdoc
106
+ summary: Transforms a markdown document into a mindmap or a mindmap into a markdown
107
+ document
107
108
  test_files: []
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �����*ЙZn��im�� �����:G�D��wf ���oq,�
1
+ ;P���*��C��������!�,�"+G�ij�Ƽ�'�_�Mj~HX|\ġ����JL��?@�o%c��ĥ� "���$96��
2
+ �