odf-report 0.4.0 → 0.4.1

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.
@@ -5,12 +5,8 @@ module ODFReport
5
5
  def find_image_name_matches(content)
6
6
 
7
7
  @images.each_pair do |image_name, path|
8
- #Search for the image placeholder path
9
- image_rgx = Regexp.new("draw:name=\"#{image_name}\".*?>.*<draw:image.*?xlink:href=\"([^\s]*)\" .*?\/>.*</draw:frame>", Regexp::MULTILINE)
10
- content_match = content.match(image_rgx)
11
-
12
- if content_match
13
- placeholder_path = content_match[1]
8
+ if node = content.xpath("//draw:frame[@draw:name='#{image_name}']/draw:image").first
9
+ placeholder_path = node.attribute('href').value
14
10
  @image_names_replacements[path] = File.basename(placeholder_path)
15
11
  end
16
12
  end
@@ -34,4 +30,4 @@ module ODFReport
34
30
 
35
31
  end
36
32
 
37
- end
33
+ end
@@ -59,10 +59,10 @@ class Report
59
59
  replace_sections!(doc)
60
60
  replace_tables!(doc)
61
61
 
62
+ find_image_name_matches(doc)
63
+
62
64
  end
63
65
 
64
- #TO_DO: make image use Nokogiri
65
- find_image_name_matches(txt)
66
66
  end
67
67
 
68
68
  end
@@ -50,7 +50,7 @@ class Table
50
50
  end
51
51
 
52
52
  @template_rows.each_with_index do |r, i|
53
- r.remove if (get_start_node..template_lenght) === i
53
+ r.remove if (get_start_node..template_length) === i
54
54
  end
55
55
 
56
56
  end # replace
@@ -77,7 +77,7 @@ private
77
77
  @row_cursor = get_start_node
78
78
  end
79
79
 
80
- def template_lenght
80
+ def template_length
81
81
  @tl ||= @template_rows.size
82
82
  end
83
83
 
@@ -93,4 +93,4 @@ private
93
93
 
94
94
  end
95
95
 
96
- end
96
+ end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{odf-report}
5
- s.version = "0.4.0"
5
+ s.version = "0.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sandro Duarte"]
9
- s.date = %q{2011-09-23}
9
+ s.date = %q{2011-10-03}
10
10
  s.description = %q{Generates ODF files, given a template (.odt) and data, replacing tags}
11
11
  s.email = %q{sandrods@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/odf-report.rb", "README.textile"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odf-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-23 00:00:00.000000000Z
12
+ date: 2011-10-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubyzip
16
- requirement: &2152736240 !ruby/object:Gem::Requirement
16
+ requirement: &2152768780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: 0.9.4
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2152736240
27
+ version_requirements: *2152768780
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: nokogiri
30
- requirement: &2152735160 !ruby/object:Gem::Requirement
30
+ requirement: &2152767820 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -38,7 +38,7 @@ dependencies:
38
38
  version: 1.5.0
39
39
  type: :runtime
40
40
  prerelease: false
41
- version_requirements: *2152735160
41
+ version_requirements: *2152767820
42
42
  description: Generates ODF files, given a template (.odt) and data, replacing tags
43
43
  email: sandrods@gmail.com
44
44
  executables: []