mindmapdoc 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mindmapdoc.rb +62 -10
- metadata +7 -7
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 95fa54e92cfb2c91189e5145f08c56562adc426b681a1a415d099e69138efdcc
|
4
|
+
data.tar.gz: a4cd212d1f3edf37fb8ea47f2e86a24641ae6c5daa3ddfb3a7dd56ebe8612b57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7602ff8949c8d091a36cf950121fded228038f45cb40b152a38dd8b08c9835cec4d34b8e80d60a8674752ce147630dc7c74379f711ebefdd50a73fcdd8494b76
|
7
|
+
data.tar.gz: 70609d82e78f026f70f76b6c4d4c5e9853f23deb0a193b3bd346fde9d24f5fa45927c5511a8187f0b4e1da230d6b7880fcda8ce25e26dee060436bec6ee69aa0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mindmapdoc.rb
CHANGED
@@ -21,7 +21,7 @@ class MindmapDoc
|
|
21
21
|
|
22
22
|
def import(raw_s)
|
23
23
|
|
24
|
-
s = raw_s.
|
24
|
+
s = raw_s.lstrip
|
25
25
|
|
26
26
|
if s =~ /^#+ / then
|
27
27
|
@txtdoc = s.gsub(/\r/,'')
|
@@ -30,6 +30,7 @@ class MindmapDoc
|
|
30
30
|
@tree, @txtdoc = parse_tree s
|
31
31
|
end
|
32
32
|
|
33
|
+
puts '@tree: ' + @tree.inspect if @debug
|
33
34
|
@svg = build_svg(@tree)
|
34
35
|
|
35
36
|
end
|
@@ -44,6 +45,7 @@ class MindmapDoc
|
|
44
45
|
#
|
45
46
|
def transform(s)
|
46
47
|
|
48
|
+
data = []
|
47
49
|
a = s.split(/(?=^<mindmap[^>]*>)/)
|
48
50
|
puts 'transform: a: ' + a.inspect if @debug
|
49
51
|
|
@@ -56,25 +58,73 @@ class MindmapDoc
|
|
56
58
|
count += 1
|
57
59
|
|
58
60
|
mm, remaining = x[/<mindmap[^>]*>(.*)/m,1].split(/<\/mindmap>/,2)
|
61
|
+
|
62
|
+
if @debug then
|
63
|
+
puts 'mm: ' + mm.inspect
|
64
|
+
puts 'remaining: ' + remaining.inspect
|
65
|
+
end
|
66
|
+
|
59
67
|
raw_tree, raw_md = mm.split(/-{10,}/,2)
|
60
|
-
|
68
|
+
puts 'raw_md: ' + raw_md.inspect
|
69
|
+
|
70
|
+
if @debug then
|
71
|
+
puts 'raw_tree: ' + raw_tree.inspect
|
72
|
+
puts 'raw_md: ' + raw_md.inspect
|
73
|
+
end
|
74
|
+
|
75
|
+
mm1 = MindmapDoc.new raw_tree
|
76
|
+
|
77
|
+
if raw_md then
|
78
|
+
mm2 = MindmapDoc.new raw_md
|
79
|
+
data << mm2.to_mmv(id: count)
|
80
|
+
end
|
81
|
+
|
61
82
|
docwidth = x[/<mindmap +docwidth=['"]([^'"]+)/,1]
|
62
|
-
puts 'docwidth: ' + docwidth.inspect if @debug
|
63
83
|
|
64
|
-
|
84
|
+
|
85
|
+
if @debug then
|
86
|
+
|
87
|
+
puts 'docwidth: ' + docwidth.inspect
|
88
|
+
puts 'mm1.to_svg: ' + mm1.to_svg.inspect
|
89
|
+
puts 'mm2.to_doc: ' + mm2.to_doc.inspect
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
mm_template("!s[](#mindmap#{count})\n\n", mm2.to_doc,
|
94
|
+
count, docwidth) + remaining
|
65
95
|
|
66
96
|
else
|
67
97
|
x
|
68
98
|
end
|
69
99
|
|
70
|
-
end
|
100
|
+
end
|
101
|
+
|
102
|
+
a2.join + "\n__DATA__\n\n" + data.join("\n")
|
71
103
|
|
72
|
-
end
|
104
|
+
end
|
73
105
|
|
74
106
|
def to_html()
|
75
107
|
@html
|
76
108
|
end
|
77
109
|
|
110
|
+
def to_mindmapviz(id: '')
|
111
|
+
|
112
|
+
lines = to_tree().lines.map do |raw_label|
|
113
|
+
|
114
|
+
label = raw_label.chomp
|
115
|
+
"%s # #%s" % [label, label.lstrip.downcase.gsub(' ', '-')]
|
116
|
+
end
|
117
|
+
|
118
|
+
"<?mindmapviz root='#{root}' fields='label, url' delimiter=' # ' " \
|
119
|
+
+ "id='mindmap#{id}'?>
|
120
|
+
|
121
|
+
#{lines.join("\n")}
|
122
|
+
"
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
alias to_mmv to_mindmapviz
|
127
|
+
|
78
128
|
def to_svg()
|
79
129
|
@svg
|
80
130
|
end
|
@@ -82,7 +132,7 @@ class MindmapDoc
|
|
82
132
|
def to_tree(rooted: false)
|
83
133
|
|
84
134
|
if rooted then
|
85
|
-
@
|
135
|
+
@tree
|
86
136
|
else
|
87
137
|
|
88
138
|
lines = @tree.lines
|
@@ -122,9 +172,11 @@ class MindmapDoc
|
|
122
172
|
#
|
123
173
|
def mm_template(svg, doc, count, docwidth='50%')
|
124
174
|
|
175
|
+
puts 'docwidth: ' + docwidth.inspect if @debug
|
176
|
+
|
125
177
|
style = "float: right; width: #{docwidth || '50%'}; \
|
126
178
|
overflow-y: auto; height: 70vh; "
|
127
|
-
|
179
|
+
puts 'style: ' + style.inspect if @debug
|
128
180
|
"<div id='mindmap#{count}'>
|
129
181
|
#{svg}
|
130
182
|
<div markdown='1' style='#{style}'>
|
@@ -146,8 +198,8 @@ overflow-y: auto; height: 70vh; "
|
|
146
198
|
|
147
199
|
lines = md.scan(/#[^\n]+\n/)\
|
148
200
|
.map {|x| (' ' * (x.scan(/#/).length - 1)) + x[/(?<=# ).*/]}
|
149
|
-
@root = lines.first if lines.first
|
150
|
-
|
201
|
+
@root = lines.first if lines.first
|
202
|
+
puts 'lines: ' + lines.inspect if @debug
|
151
203
|
[lines.join("\n"), s]
|
152
204
|
end
|
153
205
|
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
MVgPwk1JjHwj6LchFY/zTEamSovovbrRFMSbfw5kdbPk/wmOGRYaEwTk7wm8u0Zm
|
32
32
|
RRHYVIirxLY0zg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2018-
|
34
|
+
date: 2018-09-24 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: kramdown
|
@@ -39,20 +39,20 @@ dependencies:
|
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
42
|
+
version: '1.17'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
45
|
+
version: 1.17.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
52
|
+
version: '1.17'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
55
|
+
version: 1.17.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: mindmapviz
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.6
|
103
|
+
rubygems_version: 2.7.6
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Transforms a markdown document into a mindmap or a mindmap into a markdown
|
metadata.gz.sig
CHANGED
Binary file
|