flowchartviz 0.1.4 → 0.1.5
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.tar.gz.sig +0 -0
- data/lib/flowchartviz.rb +36 -4
- metadata +1 -1
- metadata.gz.sig +1 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2353e8d44c2a29a3e14c4eca24161487767ed020
|
4
|
+
data.tar.gz: 0d043aff373c8f3bfd2ba3d97dcfc1b51cd41ccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf786337451167b5a576b9690d0884bdd4f948c30908cbb47fe44b7954dddc3808d8d4ba2429a0292cdcaee7d7e5c2d228798bb3fa51acfc77fcae39d512bd20
|
7
|
+
data.tar.gz: 0af17fb2d849546a256463f04d71c37ca7d1e943bf0f44d840eb544cfa269a24cb4139a5b661d020aef356d114d34d4ab94a96f08d88cf78470f98660c1a82d2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/flowchartviz.rb
CHANGED
@@ -10,14 +10,38 @@ class Flowchartviz
|
|
10
10
|
|
11
11
|
attr_reader :raw_doc, :pxg
|
12
12
|
|
13
|
-
def initialize(s,truthlabels: %i(yes no), style: default_stylesheet()
|
13
|
+
def initialize(s,truthlabels: %i(yes no), style: default_stylesheet(),
|
14
|
+
delimiter: ' # ')
|
14
15
|
|
15
16
|
@true, @false = truthlabels
|
16
17
|
|
18
|
+
if s =~ /<?flowchartviz / then
|
19
|
+
|
20
|
+
raw_fc = s.clone
|
21
|
+
s2 = raw_fc.slice!(/<\?flowchartviz [^>]*\?>/)
|
22
|
+
|
23
|
+
if s2 then
|
24
|
+
|
25
|
+
attributes = %w(delimiter id).inject({}) do |r, keyword|
|
26
|
+
found = s2[/(?<=#{keyword}=['"])[^'"]+/]
|
27
|
+
found ? r.merge(keyword.to_sym => found) : r
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
h = {delimiter: delimiter }.merge attributes || {}
|
33
|
+
s = raw_fc
|
34
|
+
|
35
|
+
delimiter = h[:delimiter]
|
36
|
+
|
37
|
+
end
|
38
|
+
|
17
39
|
plaintext = scan(LineTree.new(s).to_a).flatten.compact.join("\n")
|
40
|
+
|
41
|
+
schema = 'items[direction]/item[label, url, connection, shape]'
|
18
42
|
|
19
43
|
@raw_doc=<<EOF
|
20
|
-
<?polyrex schema='
|
44
|
+
<?polyrex schema='#{schema}' delimiter='#{delimiter}'?>
|
21
45
|
direction: TB
|
22
46
|
#{plaintext}
|
23
47
|
EOF
|
@@ -56,12 +80,15 @@ EOF
|
|
56
80
|
k = 0
|
57
81
|
|
58
82
|
a.map.with_index do |x,j|
|
83
|
+
|
84
|
+
end_fields = ''
|
59
85
|
|
60
86
|
case x[0]
|
61
87
|
when /^if */
|
62
88
|
k+=1
|
63
89
|
b = true
|
64
|
-
x[0].gsub!(/(?:^if | then$)/,'')
|
90
|
+
x[0].gsub!(/(?:^if | then$)/,'')
|
91
|
+
end_fields = ' # # diamond'
|
65
92
|
when /^else */
|
66
93
|
x[0] = nil
|
67
94
|
k -= 1
|
@@ -70,10 +97,15 @@ EOF
|
|
70
97
|
x[0] = nil
|
71
98
|
else
|
72
99
|
k = 1
|
73
|
-
|
100
|
+
end_fields = ' # ' + (b ? @true : @false).to_s unless b.nil?
|
74
101
|
b = nil
|
75
102
|
end
|
76
103
|
|
104
|
+
if x[0] then
|
105
|
+
x[0] << ' # ' unless x[0] =~ /#/ or end_fields.empty?
|
106
|
+
x[0] << end_fields
|
107
|
+
end
|
108
|
+
|
77
109
|
scan x[1..-1],j+k, b if x.length > 1
|
78
110
|
x[0].prepend ' ' * (j + i) if x[0]
|
79
111
|
x
|
metadata
CHANGED
metadata.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
Q
|
2
|
-
5�:�{u
|
3
|
-
��\F���m�6����=�*F���������l�Ƽ�, ��S�GF�ZY!+��W7*�e���S=� �n[4��^����4�L�dE7>��7�%��?(}qi[�
|
1
|
+
9Խ�Q?xB�L4��#M̨G$��� o�{<YK�ên=��r\U�z/;A2J��qUÖw "�N5Pp9�{��L`���Q�Q��6���"�o�c�Fg���^!�ps\d^���"�p��̾crE���[F%�R�T�T�66j�<Ne��
|