Package: ruby-prawn / 1.0.0~rc1+dfsg1-3

0205_replace_BASEDIR_data_by_DATADIR_manual.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
Description: define Prawn::DATADIR as the name of the directory containing data (manual)
 Upstream hardcoded the relative path with respect to prawn/core.rb of the
 directory containing data.
 A new constant, Prawn::DATADIR is introduced to permit using another
 directory, and change its name just once.
 The code producing the manual is patched to make use of this new
 constant instead of the hardcoded path
Author: Cédric Boutillier <cedric.boutillier@gmail.com>
Last-Update: 2011-11-15
Bug: https://github.com/sandal/prawn/pull/299
Bug: https://github.com/sandal/prawn/pull/299
--- a/manual/manual/cover.rb
+++ b/manual/manual/cover.rb
@@ -9,7 +9,7 @@
 Prawn::Example.generate(filename) do
   move_down 200
 
-  image "#{Prawn::BASEDIR}/data/images/prawn.png",
+  image "#{Prawn::DATADIR}/images/prawn.png",
         :scale => 0.9,
         :at => [10, cursor]
         
--- a/manual/text/single_usage.rb
+++ b/manual/text/single_usage.rb
@@ -17,7 +17,7 @@
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
   # Using a TTF font file
-  font "#{Prawn::BASEDIR}/data/fonts/Chalkboard.ttf" do
+  font "#{Prawn::DATADIR}/fonts/Chalkboard.ttf" do
     text "Written with the Chalkboard TTF font."
   end
   move_down 20
@@ -26,7 +26,7 @@
   move_down 20
   
   # Using an DFONT font file
-  font "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont" do
+  font "#{Prawn::DATADIR}/fonts/Action Man.dfont" do
     text "Written with the Action Man DFONT font"
   end
   move_down 20
--- a/manual/text/utf8.rb
+++ b/manual/text/utf8.rb
@@ -21,7 +21,7 @@
   text "Let's try them with another font."
   move_down 20
   
-  font("#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf") do
+  font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf") do
     text "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει."
     text "There you go."
   end
--- a/manual/document_and_page_options/background.rb
+++ b/manual/document_and_page_options/background.rb
@@ -7,7 +7,7 @@
 require File.expand_path(File.join(File.dirname(__FILE__),
                                    %w[.. example_helper]))
 
-img = "#{Prawn::BASEDIR}/data/images/letterhead.jpg"
+img = "#{Prawn::DATADIR}/images/letterhead.jpg"
 
 Prawn::Document.generate("background.pdf",
                          :background => img,
--- a/manual/example_helper.rb
+++ b/manual/example_helper.rb
@@ -143,11 +143,11 @@
   
       text(extract_introduction_text(data), :inline_format => true)
 
-      kai_file = "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
+      kai_file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
       font_families["Kai"] = {
         :normal => { :file => kai_file, :font => "Kai" }
       }
-      dejavu_file = "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
+      dejavu_file = "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
       font_families["DejaVu"] = {
         :normal => { :file => dejavu_file, :font => "DejaVu" }
       }
--- a/manual/images/absolute_position.rb
+++ b/manual/images/absolute_position.rb
@@ -17,7 +17,7 @@
   y_position = cursor
   text "The image won't go below this line of text."
   
-  image "#{Prawn::BASEDIR}/data/images/fractal.jpg", :at => [200, y_position]
+  image "#{Prawn::DATADIR}/images/fractal.jpg", :at => [200, y_position]
   
   text "And this line of text will go just below the previous one."
 end
--- a/manual/images/fit.rb
+++ b/manual/images/fit.rb
@@ -15,7 +15,7 @@
   
   text "Using the fit option"
   bounding_box([0, cursor], :width => size, :height => size) do
-    image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :fit => [size, size]
+    image "#{Prawn::DATADIR}/images/pigs.jpg", :fit => [size, size]
     stroke_bounds
   end
 end
--- a/manual/images/horizontal.rb
+++ b/manual/images/horizontal.rb
@@ -16,10 +16,10 @@
     
     [:left, :center, :right].each do |position|
       text "Image aligned to the #{position}."
-      image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => position
+      image "#{Prawn::DATADIR}/images/stef.jpg", :position => position
     end
     
     text "The next image has a 50 point offset from the left boundary"
-    image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => 50
+    image "#{Prawn::DATADIR}/images/stef.jpg", :position => 50
   end
 end
--- a/manual/images/plain_image.rb
+++ b/manual/images/plain_image.rb
@@ -14,5 +14,5 @@
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
   text "The image will go right below this line of text."
-  image "#{Prawn::BASEDIR}/data/images/pigs.jpg"
+  image "#{Prawn::DATADIR}/images/pigs.jpg"
 end
--- a/manual/images/scale.rb
+++ b/manual/images/scale.rb
@@ -11,13 +11,13 @@
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
   text "Normal size"
-  image "#{Prawn::BASEDIR}/data/images/stef.jpg"
+  image "#{Prawn::DATADIR}/images/stef.jpg"
   move_down 10
   
   text "Scaled to 50%"
-  image "#{Prawn::BASEDIR}/data/images/stef.jpg", :scale => 0.5
+  image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 0.5
   move_down 10
   
   text "Scaled to 200%"
-  image "#{Prawn::BASEDIR}/data/images/stef.jpg", :scale => 2
+  image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 2
 end
--- a/manual/images/vertical.rb
+++ b/manual/images/vertical.rb
@@ -15,13 +15,13 @@
     
     [:top, :center, :bottom].each do |vposition|
       text "Image vertically aligned to the #{vposition}.", :valign => vposition
-      image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => 250,
+      image "#{Prawn::DATADIR}/images/stef.jpg", :position => 250,
                                                       :vposition => vposition
     end
     
     text_box "The next image has a 100 point offset from the top boundary",
              :at => [bounds.width - 110, bounds.top - 10], :width => 100
-    image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => :right,
+    image "#{Prawn::DATADIR}/images/stef.jpg", :position => :right,
                                                     :vposition => 100
   end
 end
--- a/manual/images/width_and_height.rb
+++ b/manual/images/width_and_height.rb
@@ -13,13 +13,13 @@
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
   text "Scale by setting only the width"
-  image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :width => 150
+  image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 150
   move_down 10
   
   text "Scale by setting only the height"
-  image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :height => 100
+  image "#{Prawn::DATADIR}/images/pigs.jpg", :height => 100
   move_down 10
   
   text "Stretch to fit the width and height provided"
-  image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :width => 500, :height => 100
+  image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 500, :height => 100
 end
--- a/manual/table/image_cells.rb
+++ b/manual/table/image_cells.rb
@@ -17,7 +17,7 @@
 
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
-  image = "#{Prawn::BASEDIR}/data/images/prawn.png"
+  image = "#{Prawn::DATADIR}/images/prawn.png"
 
   table [
     ["Standard image cell",   {:image => image}],
--- a/manual/templates/full_template.rb
+++ b/manual/templates/full_template.rb
@@ -11,7 +11,7 @@
 require File.expand_path(File.join(File.dirname(__FILE__),
                                    %w[.. example_helper]))
 
-filename = "#{Prawn::BASEDIR}/data/pdfs/multipage_template.pdf"
+filename = "#{Prawn::DATADIR}/pdfs/multipage_template.pdf"
 
 Prawn::Example.generate("full_template.pdf", :template => filename) do
   go_to_page(page_count)
--- a/manual/templates/page_template.rb
+++ b/manual/templates/page_template.rb
@@ -22,7 +22,7 @@
   url = "https://github.com/sandal/prawn/raw/master/data/pdfs/form.pdf"
   formatted_text [{:text => url, :link => url}]
   
-  filename = "#{Prawn::BASEDIR}/data/pdfs/form.pdf"
+  filename = "#{Prawn::DATADIR}/pdfs/form.pdf"
   start_new_page(:template => filename)
   
   start_new_page(:template => filename, :template_page => 2)
--- a/manual/text/fallback_fonts.rb
+++ b/manual/text/fallback_fonts.rb
@@ -9,11 +9,11 @@
 
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
-  file = "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
+  file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
   font_families["Kai"] = {
     :normal => { :file => file, :font => "Kai" }
   }
-  file = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
+  file = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
   font_families["Action Man"] = {
     :normal      => { :file => file, :font => "ActionMan" },
   }
--- a/manual/text/line_wrapping.rb
+++ b/manual/text/line_wrapping.rb
@@ -29,7 +29,7 @@
     "nearer your destination the more you're slip#{nbsp}sliding away."
   move_down 20
 
-  font("#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf", :size => 16) do
+  font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf", :size => 16) do
     long_text = "No word boundaries:\n更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。"
     text long_text
     move_down 20
--- a/manual/text/registering_families.rb
+++ b/manual/text/registering_families.rb
@@ -15,7 +15,7 @@
 Prawn::Example.generate(filename) do
   # Registering a single TTF font
   font_families.update("Chalkboard" => {
-    :normal => "#{Prawn::BASEDIR}/data/fonts/Chalkboard.ttf"
+    :normal => "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
   })
   
   font("Chalkboard") do
@@ -24,7 +24,7 @@
   move_down 20
   
   # Registering a DFONT package
-  font_path = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
+  font_path = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
   font_families.update("Action Man" => {
     :normal      => { :file => font_path, :font => "ActionMan" },
     :italic      => { :file => font_path, :font => "ActionMan-Italic" },
--- a/manual/text/right_to_left_text.rb
+++ b/manual/text/right_to_left_text.rb
@@ -16,7 +16,7 @@
   # set the direction document-wide
   self.text_direction = :rtl
 
-  font("#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf", :size => 16) do
+  font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf", :size => 16) do
     long_text = "写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小"
     text long_text
     move_down 20