prawn-layout 0.2.0.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
4
4
  require "rake/rdoctask"
5
5
  require "rake/gempackagetask"
6
6
 
7
- PRAWN_LAYOUT_VERSION = "0.2.0.1"
7
+ PRAWN_LAYOUT_VERSION = "0.2.1"
8
8
 
9
9
  task :default => [:test]
10
10
 
@@ -0,0 +1,6 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require "rubygems"
3
+ require "prawn"
4
+ require "prawn/layout"
5
+
6
+ Prawn.debug = true
@@ -1,9 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
4
- require "rubygems"
5
- require "prawn"
6
- require "prawn/layout"
3
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
7
4
 
8
5
  Prawn::Document.generate('simple_grid.pdf') do |p|
9
6
  p.define_grid(:columns => 5, :rows => 8, :gutter => 10)
@@ -8,10 +8,7 @@
8
8
  #
9
9
  # Future versions of Prawn may make this more convenient somehow.
10
10
  #
11
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
12
- require "rubygems"
13
- require "prawn"
14
- require "prawn/layout"
11
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
15
12
 
16
13
  Prawn::Document.generate("flow_with_headers_and_footers.pdf") do
17
14
 
@@ -10,10 +10,7 @@
10
10
  # location each time it is redrawn, regardless of the bounds
11
11
  # LazyBoundingBox#draw is in.
12
12
  #
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
14
- require "rubygems"
15
- require "prawn"
16
- require "prawn/layout"
13
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
17
14
 
18
15
  file = "lazy_bounding_boxes.pdf"
19
16
  Prawn::Document.generate(file, :skip_page_creation => true) do
@@ -7,10 +7,7 @@
7
7
  # Feature borrowed from Josh Knowle's pt at:
8
8
  # http://github.com/joshknowles/pt/tree/master
9
9
  #
10
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
11
- require "rubygems"
12
- require "prawn"
13
- require "prawn/layout"
10
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
14
11
 
15
12
  Prawn::Document.generate('padded_box.pdf') do
16
13
  stroke_bounds
@@ -5,11 +5,7 @@
5
5
  # building your own table implementation from scratch or heavily modify
6
6
  # the existing table system.
7
7
  #
8
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
9
-
10
- require "rubygems"
11
- require "prawn"
12
- require "prawn/layout"
8
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
13
9
 
14
10
  Prawn::Document.generate("cell.pdf") do
15
11
  cell = Prawn::Table::Cell.new(
@@ -2,11 +2,7 @@
2
2
  #
3
3
  # Demonstrates various table and cell features.
4
4
  #
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
6
-
7
- require "rubygems"
8
- require "prawn"
9
- require "prawn/layout"
5
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
10
6
 
11
7
  headers, body = nil, nil
12
8
 
@@ -4,11 +4,7 @@
4
4
  # Although this does not show all of the options available to table, the most
5
5
  # common are used here. See fancy_table.rb for a more comprehensive example.
6
6
  #
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
8
-
9
- require "rubygems"
10
- require "prawn"
11
- require "prawn/layout"
7
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
12
8
 
13
9
  Prawn::Document.generate("table.pdf") do
14
10
  font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
@@ -3,15 +3,11 @@
3
3
  # Demonstrates the many controls over alignment and positioning in Prawn
4
4
  # tables.
5
5
  #
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
-
8
- require "rubygems"
9
- require "prawn"
10
- require "prawn/layout"
6
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
11
7
 
12
8
  Prawn::Document.generate "table_header_align.pdf" do
13
9
  table [ ['01/01/2008', 'John Doe', '4.2', '125.00', '525.00'],
14
- ['01/12/2008', 'Jane Doe', '3.2', '75.50', '241.60'] ] * 20,
10
+ ['01/12/2008', 'Jane Doe', '3.2', { :text => '75.5', :align => :center }, '241.60'] ] * 20,
15
11
  :position => :center,
16
12
  :headers => ['Date', 'Employee', 'Hours', 'Rate', 'Total'],
17
13
  :column_widths => { 0 => 75, 1 => 100, 2 => 50, 3 => 50, 4 => 50},
@@ -3,11 +3,7 @@
3
3
  # Demonstrates how to set the table border color with the :border_color
4
4
  # attribute.
5
5
  #
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
-
8
- require "rubygems"
9
- require "prawn"
10
- require "prawn/layout"
6
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
11
7
 
12
8
  Prawn::Document.generate "table_border_color.pdf" do
13
9
  table [ ['01/01/2008', 'John Doe', '4.2', '125.00', '525.00'],
@@ -2,17 +2,13 @@
2
2
  #
3
3
  # Demonstrates the use of the :col_span option when using Document#table
4
4
  #
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
6
-
7
- require "rubygems"
8
- require "prawn"
9
- require "prawn/layout"
5
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
10
6
 
11
7
  Prawn::Document.generate "table_colspan.pdf" do
12
8
  data = [ ['01/01/2008', 'John Doe', '4.2', '125.00', '525.00'],
13
9
  ['01/12/2008', 'Jane Doe', '3.2', '75.50', '241.60'] ] * 5
14
10
 
15
- data << [{:text => 'Total', :colspan => 2}, '37.0', '1002.5', '3833']
11
+ data << [{:text => 'Total', :colspan => 2, :align => :center}, '37.0', '1002.5', '3833']
16
12
 
17
13
  table data,
18
14
  :position => :center,
@@ -3,11 +3,7 @@
3
3
  # Demonstrates explicitly setting the :header_color rather than inferring
4
4
  # it from :row_colors in Document#table
5
5
  #
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
-
8
- require "rubygems"
9
- require "prawn"
10
- require "prawn/layout"
6
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
11
7
 
12
8
  Prawn::Document.generate "table_header_color.pdf" do
13
9
  table [ ['01/01/2008', 'John Doe', '4.2', '125.00', '525.00'],
@@ -2,11 +2,7 @@
2
2
  #
3
3
  # Demonstrates the :underline_header border style for Document#table.
4
4
  #
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
6
-
7
- require "rubygems"
8
- require "prawn"
9
- require "prawn/layout"
5
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
10
6
 
11
7
  Prawn::Document.generate "table_header_underline.pdf" do
12
8
  table [ ['01/01/2008', 'John Doe', '4.2', '125.00', '525.00'],
@@ -4,11 +4,7 @@
4
4
  # Although this does not show all of the options available to table, the most
5
5
  # common are used here. See fancy_table.rb for a more comprehensive example.
6
6
  #
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
8
-
9
- require "rubygems"
10
- require "prawn"
11
- require "prawn/layout"
7
+ require "#{File.dirname(__FILE__)}/../example_helper.rb"
12
8
 
13
9
  Prawn::Document.generate("table_widths.pdf") do
14
10
 
@@ -16,6 +16,6 @@ module Prawn
16
16
  end
17
17
 
18
18
  module Layout
19
- VERSION = "0.2.0.1"
19
+ VERSION = "0.2.1"
20
20
  end
21
21
  end
@@ -283,16 +283,22 @@ module Prawn
283
283
  @column_widths[col_index]
284
284
  end
285
285
 
286
- cell_options = {:document => @document,
286
+ cell_options = {
287
+ :document => @document,
287
288
  :text => text,
288
289
  :width => width,
289
290
  :horizontal_padding => C(:horizontal_padding),
290
291
  :vertical_padding => C(:vertical_padding),
291
292
  :border_width => C(:border_width),
292
293
  :border_style => :sides,
293
- :align => align}
294
- cell_options[:font_style] = e[:font_style] if e.is_a?(Hash) && e.has_key?(:font_style)
295
- cell_options[:font_size] = e[:font_size] if e.is_a?(Hash) && e.has_key?(:font_size)
294
+ :align => align
295
+ }
296
+
297
+ if e.is_a?(Hash)
298
+ opts = e.dup
299
+ opts.delete(:colspan)
300
+ cell_options.update(opts)
301
+ end
296
302
 
297
303
  c << Prawn::Table::Cell.new(cell_options)
298
304
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-15 00:00:00 -04:00
12
+ date: 2009-09-22 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,6 +22,7 @@ extensions: []
22
22
  extra_rdoc_files: []
23
23
 
24
24
  files:
25
+ - examples/example_helper.rb
25
26
  - examples/grid/simple_grid.rb
26
27
  - examples/page_layout/flowing_text_with_header_and_footer.rb
27
28
  - examples/page_layout/lazy_bounding_boxes.rb