openxml_docx_templater 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec5500c1eb171b62b497c06eedd2763c93d69b9f
4
- data.tar.gz: d4e2068d21c64e4957c138e1f1efd44958e7b9a2
3
+ metadata.gz: cfe1d4c33886dbb55766f0f298cbb0ee3343c719
4
+ data.tar.gz: 1e07055b775a6be7ad235a23e8456213f862edd9
5
5
  SHA512:
6
- metadata.gz: 42c329680563c90e49ebd633b18d4bcb2a456bc331fc7d3cc5ac1548d84f8ef7c9f04f47340d5efe454be1fbd6bf1507d7db095d15ef6f39b0644a9dd1340154
7
- data.tar.gz: c349e628d27377d7c6ea80d5b634cd238a8eea08e8e66b399eeb4f1b21e5ff1133358e624095be87b5401d6394e3173cedf72b0ce88ec8639fa478003366a5ce
6
+ metadata.gz: a15bdf27ab3324eb543dc3e2cff30879a2a4021f0bc86c3a62c60ef9c5ee38457e55cf2781f344a0c3a1df63fe56e50f3dbc3b9b51383aa8497fd9cdc889025e
7
+ data.tar.gz: b89f52d940165e8597958fd81d332d42bcf013482d2fc7167ebc24d598948b7e13c39e2154f9c545d31b1e2115d131f3a4146d7f5c24e005d6465838f15bd03e
@@ -22,28 +22,10 @@ module OpenxmlDocxTemplater
22
22
  def convert template
23
23
  src = "_buf = '';"
24
24
  buffer = []
25
- buffer_next = []
26
25
 
27
26
  template.each_node do |node, type|
28
- if !buffer_next.empty?
29
- if is_matching_pair?(buffer.last, node)
30
- buffer.pop
31
- next
32
- elsif is_nonpair_tag? node
33
- next
34
- else
35
- buffer << buffer_next
36
- buffer.flatten!
37
- buffer_next = []
38
- end
39
- end
40
-
41
- if type == NodeType::CONTROL
42
- buffer_next = process_instruction(node)
43
- else
44
- buffer << process_instruction(node)
45
- buffer.flatten!
46
- end
27
+ buffer << process_instruction(node)
28
+ buffer.flatten!
47
29
  end
48
30
 
49
31
  buffer.each { |line| src << line.to_buf }
@@ -51,7 +33,6 @@ module OpenxmlDocxTemplater
51
33
  end
52
34
 
53
35
  def process_instruction text
54
- #text = text.strip
55
36
  pos = 0
56
37
  src = []
57
38
 
@@ -75,16 +56,5 @@ module OpenxmlDocxTemplater
75
56
  src << Line.text(rest) unless rest.nil? or rest.empty?
76
57
  src
77
58
  end
78
-
79
- def is_nonpair_tag? tag
80
- tag =~ /<.+?\/>/
81
- end
82
-
83
- def is_matching_pair? open, close
84
- open = open.to_s.strip
85
- close = close.to_s.strip
86
-
87
- close == "</#{open[1, close.length - 3]}>"
88
- end
89
59
  end
90
60
  end
@@ -1,3 +1,3 @@
1
1
  module OpenxmlDocxTemplater
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openxml_docx_templater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Ageev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.4.5.1
121
+ rubygems_version: 2.5.1
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Simple creation .docx files by templates