bluedoc-sml 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bluedoc/sml/renderer.rb +14 -3
- data/lib/bluedoc/sml/rules/list.rb +1 -0
- data/lib/bluedoc/sml/utils.rb +8 -0
- data/lib/bluedoc/sml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 718c548205f36ea679cb8f4bebcc30dcffd866aa3a675d04cd3f6e96d88d820f
|
4
|
+
data.tar.gz: 386e5dd242af935307fc9ab42896dfc567598b1dc31a986049d41f67a0d1391b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec05e73f7f09af8fdfb15de922962c4bebbd0ea83a04ab43de76f866b51564ae0d0aa7706bf25d2ee5b3a6d67c4d4888eec3cac4049aacf203732ae17f73c55
|
7
|
+
data.tar.gz: ae0e430fd556bd20601cfc316f016f544b29b651fe63b9dfaf323405437b2606c164e6d26877373c15d7f9c50b4d283a49c2171425969a5c1b619db3c4c487c7
|
data/lib/bluedoc/sml/renderer.rb
CHANGED
@@ -39,6 +39,10 @@ module BlueDoc::SML
|
|
39
39
|
return node if node.is_a?(String)
|
40
40
|
|
41
41
|
children = self.class.get_children(node)
|
42
|
+
|
43
|
+
parent_is_list = self.class.tag_name(node) == "list"
|
44
|
+
parent_attrs = self.class.attributes(node)
|
45
|
+
|
42
46
|
children.each_with_index.map do |child, idx|
|
43
47
|
prev_node = idx > 0 ? children[idx - 1] : nil
|
44
48
|
next_node = idx < children.length ? children[idx + 1] : nil
|
@@ -46,10 +50,16 @@ module BlueDoc::SML
|
|
46
50
|
list = self.list
|
47
51
|
is_list = self.class.tag_name(child) == "list"
|
48
52
|
|
53
|
+
child_attrs = self.class.attributes(child)
|
54
|
+
|
49
55
|
if is_list
|
50
|
-
child_attrs = self.class.attributes(child)
|
51
56
|
nid = child_attrs[:nid]
|
52
57
|
|
58
|
+
# BUG: ignore invlid nested list
|
59
|
+
if parent_is_list
|
60
|
+
return ""
|
61
|
+
end
|
62
|
+
|
53
63
|
if list[nid]
|
54
64
|
list[nid] << child
|
55
65
|
else
|
@@ -57,9 +67,10 @@ module BlueDoc::SML
|
|
57
67
|
end
|
58
68
|
end
|
59
69
|
|
70
|
+
pre_node_attrs = self.class.attributes(prev_node)
|
60
71
|
if (!is_list && self.class.tag_name(prev_node) == "list") ||
|
61
|
-
(is_list && self.class.tag_name(prev_node) == "list" &&
|
62
|
-
nid =
|
72
|
+
(is_list && self.class.tag_name(prev_node) == "list" && child_attrs[:nid] != pre_node_attrs[:nid])
|
73
|
+
nid = pre_node_attrs[:nid]
|
63
74
|
list.delete(nid)
|
64
75
|
end
|
65
76
|
|
data/lib/bluedoc/sml/utils.rb
CHANGED
@@ -37,6 +37,14 @@ module BlueDoc::SML
|
|
37
37
|
attrs
|
38
38
|
end
|
39
39
|
|
40
|
+
def set_attribute(node, key, val)
|
41
|
+
return if node.blank?
|
42
|
+
return unless element?(node)
|
43
|
+
return unless has_attributes?(node)
|
44
|
+
|
45
|
+
node[1][key] = val
|
46
|
+
end
|
47
|
+
|
40
48
|
def has_attributes?(node)
|
41
49
|
return false unless element?(node)
|
42
50
|
attributes?(node[1])
|
data/lib/bluedoc/sml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluedoc-sml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|