mindmapdoc 0.1.5 → 0.1.6
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mindmapdoc.rb +22 -8
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48fb6a5690a698712730434dd6f79af2b53436d4
|
4
|
+
data.tar.gz: b25a696b53ad6bc8d9078e7ff57ecf8daa8eb97f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ebc4c07a9db4b3a400311e8afe93f0a40514dd16352ef26e4e383a84412a2dff0c1eea24d3255a235890ec6d472b45a2b74462aea4bdce2962bf1362c6fbd53
|
7
|
+
data.tar.gz: e15a756bc2075ba3403d49384633d3a2e7fc4fe9137ea8a55c235106caad5d810e328e5cc94264a5cea6c18903bd593e2eb670e7cc190462cfd8fffd4343bfed
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mindmapdoc.rb
CHANGED
@@ -6,11 +6,12 @@ require 'rdiscount'
|
|
6
6
|
require 'mindmapviz'
|
7
7
|
|
8
8
|
|
9
|
+
|
9
10
|
class MindmapDoc
|
10
11
|
|
11
12
|
attr_accessor :root
|
12
13
|
|
13
|
-
def initialize(s=nil, root:
|
14
|
+
def initialize(s=nil, root: nil, debug: false)
|
14
15
|
|
15
16
|
@root, @tree, @txtdoc, @svg, @debug = root, '', '', '', debug
|
16
17
|
import(s) if s
|
@@ -42,22 +43,24 @@ class MindmapDoc
|
|
42
43
|
#
|
43
44
|
def transform(s)
|
44
45
|
|
45
|
-
a = s.split(/(
|
46
|
+
a = s.split(/(?=^<mindmap[^>]*>)/)
|
46
47
|
puts 'transform: a: ' + a.inspect if @debug
|
47
48
|
|
48
49
|
count = 0
|
49
50
|
|
50
51
|
a2 = a.map do |x|
|
51
52
|
|
52
|
-
if x =~ /^<mindmap
|
53
|
+
if x =~ /^<mindmap/ then
|
53
54
|
|
54
55
|
count += 1
|
55
56
|
|
56
|
-
mm, remaining = x[/<mindmap
|
57
|
+
mm, remaining = x[/<mindmap[^>]*>(.*)/m,1].split(/<\/mindmap>/,2)
|
57
58
|
raw_tree, raw_md = mm.split(/-{10,}/,2)
|
58
59
|
mm1, mm2 = [raw_tree, raw_md].map {|x| MindmapDoc.new x}
|
60
|
+
docwidth = x[/<mindmap +docwidth=['"]([^'"]+)/,1]
|
61
|
+
puts 'docwidth: ' + docwidth.inspect if @debug
|
59
62
|
|
60
|
-
mm_template(mm1.to_svg, mm2.to_doc, count)
|
63
|
+
mm_template(mm1.to_svg, mm2.to_doc, count, docwidth) + remaining
|
61
64
|
|
62
65
|
else
|
63
66
|
x
|
@@ -116,9 +119,10 @@ class MindmapDoc
|
|
116
119
|
|
117
120
|
# used by public method transform()
|
118
121
|
#
|
119
|
-
def mm_template(svg, doc, count)
|
122
|
+
def mm_template(svg, doc, count, docwidth='50%')
|
120
123
|
|
121
|
-
style =
|
124
|
+
style = "float: right; width: #{docwidth || '50%'}; \
|
125
|
+
overflow-y: auto; height: 70vh; "
|
122
126
|
|
123
127
|
"<div id='mindmap#{count}'>
|
124
128
|
#{svg}
|
@@ -154,7 +158,17 @@ class MindmapDoc
|
|
154
158
|
#
|
155
159
|
def parse_tree(s)
|
156
160
|
|
157
|
-
|
161
|
+
puts 'inside parse_tree' if @debug
|
162
|
+
|
163
|
+
lines = s.gsub(/\r/,'').strip.lines
|
164
|
+
|
165
|
+
@root = if lines.first[/^[^#\s]/] then
|
166
|
+
lines.shift.chomp
|
167
|
+
elsif @root.nil?
|
168
|
+
'root'
|
169
|
+
end
|
170
|
+
|
171
|
+
asrc = [@root + "\n"] + lines.map {|x| ' ' + x}
|
158
172
|
|
159
173
|
a2 = asrc.inject([]) do |r,x|
|
160
174
|
|
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.
|
4
|
+
version: 0.1.6
|
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-02-
|
34
|
+
date: 2018-02-17 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdiscount
|
metadata.gz.sig
CHANGED
Binary file
|