prawn-js 0.1 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/prawn/js.rb +7 -9
- metadata +6 -6
data/lib/prawn/js.rb
CHANGED
@@ -6,8 +6,6 @@
|
|
6
6
|
#
|
7
7
|
# This is free software. Please see the LICENSE file for details.
|
8
8
|
|
9
|
-
gem "prawn", ">= 0.5"
|
10
|
-
|
11
9
|
module Prawn
|
12
10
|
module JS
|
13
11
|
# The maximum number of children to fit into a single node in the JavaScript tree.
|
@@ -19,7 +17,7 @@ module Prawn
|
|
19
17
|
# will override earlier fragments.
|
20
18
|
#
|
21
19
|
def add_did_save_js(script)
|
22
|
-
aa[:DS] = ref(:S => :JavaScript, :JS => script)
|
20
|
+
aa[:DS] = ref!(:S => :JavaScript, :JS => script)
|
23
21
|
end
|
24
22
|
|
25
23
|
# add a Javascript fragment that will execute after the document is printed.
|
@@ -28,7 +26,7 @@ module Prawn
|
|
28
26
|
# will override earlier fragments.
|
29
27
|
#
|
30
28
|
def add_did_print_js(script)
|
31
|
-
aa[:DP] = ref(:S => :JavaScript, :JS => script)
|
29
|
+
aa[:DP] = ref!(:S => :JavaScript, :JS => script)
|
32
30
|
end
|
33
31
|
|
34
32
|
# add a Javascript fragment that will execute when the document is opened.
|
@@ -37,7 +35,7 @@ module Prawn
|
|
37
35
|
# multiple times will append the new fragment to the list.
|
38
36
|
#
|
39
37
|
def add_docopen_js(name, script)
|
40
|
-
obj = ref(:S => :JavaScript, :JS => script)
|
38
|
+
obj = ref!(:S => :JavaScript, :JS => script)
|
41
39
|
javascript.data.add(name, obj)
|
42
40
|
end
|
43
41
|
|
@@ -47,7 +45,7 @@ module Prawn
|
|
47
45
|
# will override earlier fragments.
|
48
46
|
#
|
49
47
|
def add_will_close_js(script)
|
50
|
-
aa[:WC] = ref(:S => :JavaScript, :JS => script)
|
48
|
+
aa[:WC] = ref!(:S => :JavaScript, :JS => script)
|
51
49
|
end
|
52
50
|
|
53
51
|
# add a Javascript fragment that will execute before the document is printed.
|
@@ -56,7 +54,7 @@ module Prawn
|
|
56
54
|
# will override earlier fragments.
|
57
55
|
#
|
58
56
|
def add_will_print_js(script)
|
59
|
-
aa[:WP] = ref(:S => :JavaScript, :JS => script)
|
57
|
+
aa[:WP] = ref!(:S => :JavaScript, :JS => script)
|
60
58
|
end
|
61
59
|
|
62
60
|
# add a Javascript fragment that will execute before the document is saved.
|
@@ -65,7 +63,7 @@ module Prawn
|
|
65
63
|
# will override earlier fragments.
|
66
64
|
#
|
67
65
|
def add_will_save_js(script)
|
68
|
-
aa[:WS] = ref(:S => :JavaScript, :JS => script)
|
66
|
+
aa[:WS] = ref!(:S => :JavaScript, :JS => script)
|
69
67
|
end
|
70
68
|
|
71
69
|
private
|
@@ -83,7 +81,7 @@ module Prawn
|
|
83
81
|
# See section 3.6.3 and table 3.28 in the PDF spec.
|
84
82
|
#
|
85
83
|
def javascript
|
86
|
-
names.data[:JavaScript] ||= ref(Prawn::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT))
|
84
|
+
names.data[:JavaScript] ||= ref!(Prawn::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT))
|
87
85
|
end
|
88
86
|
|
89
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Healy
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.6.1
|
24
24
|
version:
|
25
25
|
description: A small extension to prawn that simplifies embedding JavaScript in your PDF files
|
26
26
|
email: pat@freelancing-gods.com
|
@@ -31,11 +31,11 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
|
33
33
|
files:
|
34
|
-
- examples/
|
35
|
-
- examples/doc_close.rb
|
34
|
+
- examples/manual.rb
|
36
35
|
- examples/doc_save.rb
|
37
36
|
- examples/autoprint.rb
|
38
|
-
- examples/
|
37
|
+
- examples/doc_open.rb
|
38
|
+
- examples/doc_close.rb
|
39
39
|
- lib/prawn/js.rb
|
40
40
|
- README.markdown
|
41
41
|
- MIT-LICENSE
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements: []
|
67
67
|
|
68
68
|
rubyforge_project: prawn
|
69
|
-
rubygems_version: 1.3.
|
69
|
+
rubygems_version: 1.3.5
|
70
70
|
signing_key:
|
71
71
|
specification_version: 3
|
72
72
|
summary: A small extension to prawn that makes it possible to embed JavaScript fragment in your document that respond to events.
|