rtex 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rtex/escaping.rb +1 -1
- data/lib/rtex/framework/rails.rb +7 -1
- data/lib/rtex/version.rb +1 -1
- data/rtex.gemspec +3 -3
- data/test/document_test.rb +16 -4
- metadata +2 -2
data/lib/rtex/escaping.rb
CHANGED
data/lib/rtex/framework/rails.rb
CHANGED
@@ -25,6 +25,12 @@ module RTeX
|
|
25
25
|
if defined?(@view)
|
26
26
|
@view.template_format = :pdf
|
27
27
|
end
|
28
|
+
# Tag for RTeX
|
29
|
+
# TODO: Move options into TemplateHandler from Controller
|
30
|
+
# (need to handle send_file)
|
31
|
+
def @view.rendered_with_rtex
|
32
|
+
true
|
33
|
+
end
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
@@ -35,7 +41,7 @@ module RTeX
|
|
35
41
|
|
36
42
|
def render_with_rtex(options=nil, *args, &block)
|
37
43
|
result = render_without_rtex(options, *args, &block)
|
38
|
-
if result.is_a?(String) && @template.
|
44
|
+
if result.is_a?(String) && @template.respond_to?(:rendered_with_rtex)
|
39
45
|
options ||= {}
|
40
46
|
::RTeX::Document.new(result, options.merge(:processed => true)).to_pdf do |filename|
|
41
47
|
serve_file = Tempfile.new('rtex-pdf')
|
data/lib/rtex/version.rb
CHANGED
data/rtex.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Rtex-2.0.
|
2
|
+
# Gem::Specification for Rtex-2.0.4
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
--- !ruby/object:Gem::Specification
|
6
6
|
name: rtex
|
7
7
|
version: !ruby/object:Gem::Version
|
8
|
-
version: 2.0.
|
8
|
+
version: 2.0.4
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Bruce Williams, Wiebe Cazemier
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
|
15
|
-
date: 2008-
|
15
|
+
date: 2008-09-20 00:00:00 -06:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
data/test/document_test.rb
CHANGED
@@ -11,11 +11,23 @@ class DocumentTest < Test::Unit::TestCase
|
|
11
11
|
should "have a to_pdf method" do
|
12
12
|
assert document(:first).respond_to?(:to_pdf)
|
13
13
|
end
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
|
15
|
+
context "when escaping" do
|
16
|
+
setup do
|
17
|
+
@obj = Object.new
|
18
|
+
def @obj.to_s
|
19
|
+
'\~'
|
20
|
+
end
|
21
|
+
@escaped = '\textbackslash{}\textasciitilde{}'
|
22
|
+
end
|
23
|
+
should "escape character" do
|
24
|
+
assert_equal @escaped, RTeX::Document.escape(@obj.to_s)
|
25
|
+
end
|
26
|
+
should "convert argument to string before attempting escape" do
|
27
|
+
assert_equal @escaped, RTeX::Document.escape(@obj)
|
28
|
+
end
|
17
29
|
end
|
18
|
-
|
30
|
+
|
19
31
|
should "use a to_pdf block to move a file to a relative path" do
|
20
32
|
begin
|
21
33
|
path = File.expand_path(File.dirname(__FILE__) << '/tmp/this_is_relative_to_pwd.pdf')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruce Williams, Wiebe Cazemier
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-20 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|