prawn-format 0.2.2 → 0.2.3

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.
@@ -5,7 +5,7 @@ require "#{File.dirname(__FILE__)}/example_helper.rb"
5
5
  JAPANESE = "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
6
6
 
7
7
  Prawn::Document.generate "basic-formatting.pdf" do
8
- text "<a name='top'/>Thanks to the Prawn-Format library, <a href='prawn'>Prawn</a> now supports <i>inline formatting</i>. What this means in practical terms is that you can embed XML tags in your text calls, turning bits like <code>&lt;b&gt;bold&lt;/b&gt;</code> into <b>bold</b>."
8
+ text "<a name='top'/>Thanks to the Prawn-Format library, <a href='#prawn'>Prawn</a> now supports <i>inline formatting</i>. What this means in practical terms is that you can embed XML tags in your text calls, turning bits like <code>&lt;b&gt;bold&lt;/b&gt;</code> into <b>bold</b>."
9
9
 
10
10
  move_text_position font_size
11
11
 
@@ -19,11 +19,11 @@ Prawn::Document.generate "basic-formatting.pdf" do
19
19
 
20
20
  start_new_page
21
21
 
22
- text "<a name='prawn'/><font color='#f70'><strong>Prawn</strong></font> is a PDF generation library for <a href='ruby'>Ruby</a>. Its emphasis is on speed, but also provides a very easy-to-use API, and boasts such advanced features as <em>True-Type font embedding</em>, <em>font subsetting</em>, <em>image support</em>, and many text layout functions."
22
+ text "<a name='prawn'/><font color='#f70'><strong>Prawn</strong></font> is a PDF generation library for <a href='#ruby'>Ruby</a>. Its emphasis is on speed, but also provides a very easy-to-use API, and boasts such advanced features as <em>True-Type font embedding</em>, <em>font subsetting</em>, <em>image support</em>, and many text layout functions."
23
23
 
24
24
  move_text_position font_size
25
25
 
26
- text "<a href='top'>Return to top of document</a>"
26
+ text "<a href='#top'>Return to top of document</a>"
27
27
 
28
28
  start_new_page
29
29
 
@@ -31,5 +31,5 @@ Prawn::Document.generate "basic-formatting.pdf" do
31
31
 
32
32
  move_text_position font_size
33
33
 
34
- text "<a href='top'>Return to top of document</a>"
34
+ text "<a href='#top'>Return to top of document</a>"
35
35
  end
@@ -16,7 +16,7 @@ module Prawn
16
16
  end
17
17
 
18
18
  # Overloaded version of #height_of.
19
- def height(string, line_width, size=font_size, options={}) #:nodoc:
19
+ def height_of(string, line_width, size=font_size, options={}) #:nodoc:
20
20
  if unformatted?(string, options)
21
21
  super(string, line_width, size)
22
22
  else
@@ -25,7 +25,7 @@ module Prawn
25
25
  end
26
26
 
27
27
  # Overloaded version of #width_of.
28
- def width(string, options={}) #:nodoc:
28
+ def width_of(string, options={}) #:nodoc:
29
29
  if unformatted?(string, options)
30
30
  super
31
31
  else
@@ -1,5 +1,5 @@
1
1
  module Prawn
2
2
  module Format
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
@@ -2,22 +2,22 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{prawn-format}
5
- s.version = "0.2.2"
5
+ s.version = "0.2.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jamis Buck"]
9
- s.date = %q{2009-11-10}
9
+ s.date = %q{2009-11-17}
10
10
  s.description = %q{an extension of Prawn that allows inline formatting}
11
11
  s.email = %q{jamis@jamisbuck.org}
12
12
  s.extra_rdoc_files = ["lib/prawn/format/effects/link.rb", "lib/prawn/format/effects/underline.rb", "lib/prawn/format/instructions/base.rb", "lib/prawn/format/instructions/tag_close.rb", "lib/prawn/format/instructions/tag_open.rb", "lib/prawn/format/instructions/text.rb", "lib/prawn/format/layout_builder.rb", "lib/prawn/format/lexer.rb", "lib/prawn/format/line.rb", "lib/prawn/format/parser.rb", "lib/prawn/format/state.rb", "lib/prawn/format/text_object.rb", "lib/prawn/format/version.rb", "lib/prawn/format.rb"]
13
- s.files = ["examples/basic-formatting.rb", "examples/christmas-carol.txt", "examples/document.rb", "examples/flowing.rb", "examples/style-classes.rb", "examples/syntax-highlighting.rb", "examples/tags.rb", "lib/prawn/format/effects/link.rb", "lib/prawn/format/effects/underline.rb", "lib/prawn/format/instructions/base.rb", "lib/prawn/format/instructions/tag_close.rb", "lib/prawn/format/instructions/tag_open.rb", "lib/prawn/format/instructions/text.rb", "lib/prawn/format/layout_builder.rb", "lib/prawn/format/lexer.rb", "lib/prawn/format/line.rb", "lib/prawn/format/parser.rb", "lib/prawn/format/state.rb", "lib/prawn/format/text_object.rb", "lib/prawn/format/version.rb", "lib/prawn/format.rb", "manual/html.rb", "manual/include/basics.rb", "manual/include/breaks.rb", "manual/include/custom-tags.rb", "manual/include/custom-tags2.rb", "manual/include/indent.rb", "manual/include/options.rb", "manual/include/style-classes.rb", "manual/manual.txt", "manual/pdf.rb", "Rakefile", "spec/layout_builder_spec.rb", "spec/lexer_spec.rb", "spec/parser_spec.rb", "spec/spec_helper.rb", "Manifest", "prawn-format.gemspec"]
13
+ s.files = ["examples/basic-formatting.rb", "examples/christmas-carol.txt", "examples/document.rb", "examples/flowing.rb", "examples/style-classes.rb", "examples/syntax-highlighting.rb", "examples/tags.rb", "lib/prawn/format/effects/link.rb", "lib/prawn/format/effects/underline.rb", "lib/prawn/format/instructions/base.rb", "lib/prawn/format/instructions/tag_close.rb", "lib/prawn/format/instructions/tag_open.rb", "lib/prawn/format/instructions/text.rb", "lib/prawn/format/layout_builder.rb", "lib/prawn/format/lexer.rb", "lib/prawn/format/line.rb", "lib/prawn/format/parser.rb", "lib/prawn/format/state.rb", "lib/prawn/format/text_object.rb", "lib/prawn/format/version.rb", "lib/prawn/format.rb", "manual/html.rb", "manual/include/basics.rb", "manual/include/breaks.rb", "manual/include/custom-tags.rb", "manual/include/custom-tags2.rb", "manual/include/indent.rb", "manual/include/options.rb", "manual/include/style-classes.rb", "manual/manual.txt", "manual/pdf.rb", "Rakefile", "spec/layout_builder_spec.rb", "spec/lexer_spec.rb", "spec/parser_spec.rb", "spec/spec_helper.rb", "Manifest", "prawn-format.gemspec", "spec/extensions_spec.rb"]
14
14
  s.homepage = %q{http://rubyforge.org/projects/prawn}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Prawn-format"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{prawn}
18
18
  s.rubygems_version = %q{1.3.5}
19
19
  s.summary = %q{an extension of Prawn that allows inline formatting}
20
- s.test_files = ["spec/layout_builder_spec.rb", "spec/lexer_spec.rb", "spec/parser_spec.rb"]
20
+ s.test_files = ["spec/extensions_spec.rb", "spec/layout_builder_spec.rb", "spec/lexer_spec.rb", "spec/parser_spec.rb"]
21
21
 
22
22
  if s.respond_to? :specification_version then
23
23
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -0,0 +1,17 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
2
+
3
+ describe "when extending the prawn-core methods" do
4
+
5
+ before(:each) { create_pdf }
6
+
7
+ it "should retain proper functioning of width_of()" do
8
+ assert_equal 28.008, @pdf.width_of("<b>hello</b>")
9
+ assert_equal 25.344, @pdf.width_of("<b></b>hello")
10
+ end
11
+
12
+ it "should retain proper functioning of height_of()" do
13
+ assert_equal @pdf.font.height*3,
14
+ @pdf.height_of("hi<br/><br/>there", @pdf.bounds.width)
15
+ end
16
+
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-10 00:00:00 -05:00
12
+ date: 2009-11-17 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -124,6 +124,7 @@ signing_key:
124
124
  specification_version: 3
125
125
  summary: an extension of Prawn that allows inline formatting
126
126
  test_files:
127
+ - spec/extensions_spec.rb
127
128
  - spec/layout_builder_spec.rb
128
129
  - spec/lexer_spec.rb
129
130
  - spec/parser_spec.rb