artex 2.1.1 → 2.1.2

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
1
  v2.1.0
2
2
 
3
- Forked from RTeX 2.1.0.
3
+ Forked from RTeX 2.1.0.
4
+
5
+ v 2.1.2
6
+ Make Locals posible for Partials-rendering
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) << "/lib/artex/version"
5
5
 
6
6
  Echoe.new 'artex' do |p|
7
7
  p.version = ArTeX::Version::STRING
8
- p.author = ['Bruce Williams', 'Wiebe Cazemier', 'Julian Fischer']
8
+ p.author = ['Bruce Williams', 'Wiebe Cazemier', 'Julian Fischer', 'Matthias Folz']
9
9
  p.email = 'artex@avarteq.de'
10
10
  p.project = 'artex'
11
11
  p.summary = "LaTeX preprocessor for PDF generation; Rails plugin"
@@ -2,28 +2,27 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{artex}
5
- s.version = "2.1.1"
5
+ s.version = "2.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Bruce Williams, Wiebe Cazemier, Julian Fischer"]
9
- s.date = %q{2010-04-19}
8
+ s.authors = ["Bruce Williams, Wiebe Cazemier, Julian Fischer, Matthias Folz"]
9
+ s.date = %q{2011-03-15}
10
10
  s.description = %q{LaTeX preprocessor for PDF generation; Rails plugin}
11
11
  s.email = %q{artex@avarteq.de}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/artex.rb", "lib/artex/document.rb", "lib/artex/escaping.rb", "lib/artex/framework/merb.rb", "lib/artex/framework/rails.rb", "lib/artex/pdf.rb", "lib/artex/tempdir.rb", "lib/artex/version.rb"]
13
- s.files = ["CHANGELOG", "Manifest", "README.rdoc", "Rakefile", "artex.gemspec", "init.rb", "lib/artex.rb", "lib/artex/document.rb", "lib/artex/escaping.rb", "lib/artex/framework/merb.rb", "lib/artex/framework/rails.rb", "lib/artex/pdf.rb", "lib/artex/tempdir.rb", "lib/artex/version.rb", "rails/init.rb", "test/document_test.rb", "test/filter_test.rb", "test/fixtures/first.tex", "test/fixtures/first.tex.erb", "test/fixtures/fragment.tex.erb", "test/fixtures/text.textile", "test/tempdir_test.rb", "test/test_helper.rb", "vendor/instiki/LICENSE", "vendor/instiki/redcloth_for_tex.rb"]
13
+ s.files = ["CHANGELOG", "Manifest", "README.rdoc", "Rakefile", "artex.gemspec", "init.rb", "lib/artex.rb", "lib/artex/document.rb", "lib/artex/escaping.rb", "lib/artex/framework/merb.rb", "lib/artex/framework/rails.rb", "lib/artex/pdf.rb", "lib/artex/tempdir.rb", "lib/artex/version.rb", "rails/init.rb", "test/document_test.rb", "test/filter_test.rb", "test/fixtures/first.tex", "test/fixtures/first.tex.erb", "test/fixtures/fragment.tex.erb", "test/fixtures/text.textile", "test/tempdir_test.rb", "test/test_helper.rb", "vendor/instiki/LICENSE", "vendor/instiki/redcloth_for_tex.rb", "test/pdf_test.rb"]
14
14
  s.homepage = %q{http://github.com/avarteq/artex}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Artex", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{artex}
18
- s.rubygems_version = %q{1.3.5}
18
+ s.rubygems_version = %q{1.6.0}
19
19
  s.summary = %q{LaTeX preprocessor for PDF generation; Rails plugin}
20
- s.test_files = ["test/document_test.rb", "test/filter_test.rb", "test/tempdir_test.rb", "test/test_helper.rb"]
20
+ s.test_files = ["test/tempdir_test.rb", "test/test_helper.rb", "test/pdf_test.rb", "test/document_test.rb", "test/filter_test.rb"]
21
21
 
22
22
  if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
23
  s.specification_version = 3
25
24
 
26
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
26
  s.add_development_dependency(%q<Shoulda>, [">= 0"])
28
27
  s.add_development_dependency(%q<echoe>, [">= 0"])
29
28
  else
@@ -18,6 +18,8 @@ module ArTeX
18
18
  # z.B. 'bills/form/billing_position/_billing_position.pdf.rtex'
19
19
  template_name = get_template_name_from_partial_name(options[:partial])
20
20
 
21
+ handle_locals(options)
22
+
21
23
  if is_collection?(options) then
22
24
  content = render_collection(options[:collection], binding, template_name)
23
25
  else
@@ -52,6 +54,16 @@ module ArTeX
52
54
  template_name
53
55
  end
54
56
 
57
+ # creates the posibility of locals renderign
58
+ def handle_locals(options = {})
59
+ return unless options[:locals]
60
+ options[:locals].each do |name, value|
61
+ l = lambda { return value }
62
+ self.class.send(:define_method, name.to_sym, l )
63
+
64
+ end
65
+ end
66
+
55
67
  def render_to_latex(binding, path)
56
68
  template_path = get_template_path(path)
57
69
  template = File.read(template_path)
@@ -78,4 +90,4 @@ module ArTeX
78
90
  return ArTeX::Document.escape(*args)
79
91
  end
80
92
  end
81
- end
93
+ end
@@ -65,7 +65,7 @@ module ArTeX
65
65
 
66
66
  MAJOR = 2
67
67
  MINOR = 1
68
- TINY = 1
68
+ TINY = 2
69
69
 
70
70
  # The current version as a Version instance
71
71
  CURRENT = new(MAJOR, MINOR, TINY)
@@ -74,4 +74,4 @@ module ArTeX
74
74
 
75
75
  end
76
76
 
77
- end
77
+ end
@@ -46,7 +46,7 @@ class DocumentTest < Test::Unit::TestCase
46
46
  @author = 'Foo'
47
47
  assert_equal '%PDF', document(:first).to_pdf(binding)[0, 4]
48
48
  end
49
-
49
+
50
50
  should "generate TeX source and return as a string with debug option" do
51
51
  @author = 'Foo'
52
52
  assert_not_equal '%PDF', document(:first, :tex => true).to_pdf(binding)[0, 4]
@@ -83,4 +83,4 @@ class DocumentTest < Test::Unit::TestCase
83
83
 
84
84
  end
85
85
 
86
- end
86
+ end
@@ -0,0 +1,31 @@
1
+ require File.dirname(__FILE__) << '/test_helper'
2
+
3
+
4
+ class PdfTest < Test::Unit::TestCase
5
+
6
+ context "Creating a temporary directory" do
7
+
8
+ setup do
9
+ @options = {
10
+ :locals => {
11
+ :number => 234,
12
+ :string => "hello",
13
+ :hash => {:dog => :cat},
14
+ :array => ["marshmallow", "candy"]
15
+ }
16
+ }
17
+ end
18
+
19
+ should "define locals" do
20
+ pdf = ArTeX::PDF.new
21
+ pdf.handle_locals(@options)
22
+
23
+ assert_equal 234, pdf.number
24
+ assert_equal "hello", pdf.string
25
+ assert_equal 1, pdf.hash.count
26
+ assert_equal 2, pdf.array.count
27
+ end
28
+
29
+ end
30
+
31
+ end
metadata CHANGED
@@ -1,37 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ hash: 15
5
+ prerelease:
6
+ segments:
7
+ - 2
8
+ - 1
9
+ - 2
10
+ version: 2.1.2
5
11
  platform: ruby
6
12
  authors:
7
- - Bruce Williams, Wiebe Cazemier, Julian Fischer
13
+ - Bruce Williams, Wiebe Cazemier, Julian Fischer, Matthias Folz
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-04-19 00:00:00 +02:00
18
+ date: 2011-03-15 00:00:00 +01:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: Shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :development
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: echoe
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
41
  - - ">="
32
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
33
46
  version: "0"
34
- version:
47
+ type: :development
48
+ version_requirements: *id002
35
49
  description: LaTeX preprocessor for PDF generation; Rails plugin
36
50
  email: artex@avarteq.de
37
51
  executables: []
@@ -75,6 +89,7 @@ files:
75
89
  - test/test_helper.rb
76
90
  - vendor/instiki/LICENSE
77
91
  - vendor/instiki/redcloth_for_tex.rb
92
+ - test/pdf_test.rb
78
93
  has_rdoc: true
79
94
  homepage: http://github.com/avarteq/artex
80
95
  licenses: []
@@ -90,26 +105,33 @@ rdoc_options:
90
105
  require_paths:
91
106
  - lib
92
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
93
109
  requirements:
94
110
  - - ">="
95
111
  - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
96
115
  version: "0"
97
- version:
98
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
99
118
  requirements:
100
119
  - - ">="
101
120
  - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
102
124
  version: "0"
103
- version:
104
125
  requirements: []
105
126
 
106
127
  rubyforge_project: artex
107
- rubygems_version: 1.3.5
128
+ rubygems_version: 1.6.0
108
129
  signing_key:
109
130
  specification_version: 3
110
131
  summary: LaTeX preprocessor for PDF generation; Rails plugin
111
132
  test_files:
112
- - test/document_test.rb
113
- - test/filter_test.rb
114
133
  - test/tempdir_test.rb
115
134
  - test/test_helper.rb
135
+ - test/pdf_test.rb
136
+ - test/document_test.rb
137
+ - test/filter_test.rb