prawn-format 0.2.1 → 0.2.2
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.
- data/examples/basic-formatting.rb +1 -3
- data/examples/document.rb +1 -3
- data/examples/flowing.rb +1 -3
- data/examples/style-classes.rb +1 -3
- data/examples/syntax-highlighting.rb +1 -3
- data/examples/tags.rb +1 -2
- data/lib/prawn/format.rb +10 -24
- data/lib/prawn/format/instructions/text.rb +1 -1
- data/lib/prawn/format/version.rb +1 -1
- data/prawn-format.gemspec +3 -3
- data/spec/spec_helper.rb +4 -2
- metadata +3 -3
data/examples/document.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#coding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
require "prawn"
|
5
|
-
require "prawn/format"
|
3
|
+
require "#{File.dirname(__FILE__)}/example_helper.rb"
|
6
4
|
|
7
5
|
Prawn::Document.generate("document.pdf") do
|
8
6
|
tags :h1 => { :font_size => "2em", :font_weight => :bold },
|
data/examples/flowing.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#coding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
require 'prawn'
|
5
|
-
require 'prawn/format'
|
3
|
+
require "#{File.dirname(__FILE__)}/example_helper"
|
6
4
|
|
7
5
|
dice = "#{Prawn::BASEDIR}/data/images/dice.png"
|
8
6
|
Prawn::Document.generate "flowing.pdf" do
|
data/examples/style-classes.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#coding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
require 'prawn'
|
5
|
-
require 'prawn/format'
|
3
|
+
require "#{File.dirname(__FILE__)}/example_helper"
|
6
4
|
|
7
5
|
Prawn::Document.generate "style-classes.pdf" do
|
8
6
|
styles :quote => { :font_style => :italic },
|
data/examples/tags.rb
CHANGED
data/lib/prawn/format.rb
CHANGED
@@ -5,42 +5,29 @@ require 'prawn/format/text_object'
|
|
5
5
|
|
6
6
|
module Prawn
|
7
7
|
module Format
|
8
|
-
def self.included(mod)
|
9
|
-
mod.send :alias_method, :text_without_formatting, :text
|
10
|
-
mod.send :alias_method, :text, :text_with_formatting
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
mod.send :alias_method, :height_of_without_formatting, :height_of
|
16
|
-
mod.send :alias_method, :height_of, :height_of_with_formatting
|
17
|
-
end
|
18
|
-
|
19
|
-
# Overloaded version of #text. Call via #text, rather than #text_with_formatting
|
20
|
-
# (see above, where it aliased to #text).
|
21
|
-
def text_with_formatting(text, options={}) #:nodoc:
|
9
|
+
# Overloaded version of #text.
|
10
|
+
def text(text, options={}) #:nodoc:
|
22
11
|
if unformatted?(text, options)
|
23
|
-
|
12
|
+
super
|
24
13
|
else
|
25
14
|
format(text, options)
|
26
15
|
end
|
27
16
|
end
|
28
17
|
|
29
|
-
# Overloaded version of #height_of.
|
30
|
-
|
31
|
-
def height_of_with_formatting(string, line_width, size=font_size, options={}) #:nodoc:
|
18
|
+
# Overloaded version of #height_of.
|
19
|
+
def height(string, line_width, size=font_size, options={}) #:nodoc:
|
32
20
|
if unformatted?(string, options)
|
33
|
-
|
21
|
+
super(string, line_width, size)
|
34
22
|
else
|
35
23
|
formatted_height(string, line_width, size, options)
|
36
24
|
end
|
37
25
|
end
|
38
26
|
|
39
|
-
# Overloaded version of #width_of.
|
40
|
-
|
41
|
-
def width_of_with_formatting(string, options={}) #:nodoc:
|
27
|
+
# Overloaded version of #width_of.
|
28
|
+
def width(string, options={}) #:nodoc:
|
42
29
|
if unformatted?(string, options)
|
43
|
-
|
30
|
+
super
|
44
31
|
else
|
45
32
|
formatted_width(string, options)
|
46
33
|
end
|
@@ -225,5 +212,4 @@ module Prawn
|
|
225
212
|
end
|
226
213
|
end
|
227
214
|
|
228
|
-
|
229
|
-
Prawn::Document.send(:include, Prawn::Format)
|
215
|
+
Prawn::Document.extensions << Prawn::Format
|
@@ -14,7 +14,7 @@ module Prawn
|
|
14
14
|
@text = text
|
15
15
|
@break = options.key?(:break) ? options[:break] : text.index(/[-\xE2\x80\x94\s]/)
|
16
16
|
@discardable = options.key?(:discardable) ? options[:discardable] : text.index(/\s/)
|
17
|
-
state.font.normalize_encoding(@text) if options.fetch(:normalize, true)
|
17
|
+
@text = state.font.normalize_encoding(@text) if options.fetch(:normalize, true)
|
18
18
|
end
|
19
19
|
|
20
20
|
def dup
|
data/lib/prawn/format/version.rb
CHANGED
data/prawn-format.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{prawn-format}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.2"
|
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-
|
9
|
+
s.date = %q{2009-11-10}
|
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"]
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
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
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.5}
|
19
19
|
s.summary = %q{an extension of Prawn that allows inline formatting}
|
20
20
|
s.test_files = ["spec/layout_builder_spec.rb", "spec/lexer_spec.rb", "spec/parser_spec.rb"]
|
21
21
|
|
data/spec/spec_helper.rb
CHANGED
@@ -5,10 +5,12 @@ puts "Prawn-Format specs: Running on Ruby Version: #{RUBY_VERSION}"
|
|
5
5
|
require "rubygems"
|
6
6
|
require "test/spec"
|
7
7
|
require "mocha"
|
8
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'vendor', 'prawn-core', 'lib')
|
9
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
10
8
|
|
9
|
+
$LOAD_PATH.unshift( ENV["PRAWN_CORE_LIB"] ||
|
10
|
+
File.join(File.dirname(__FILE__), *%w[.. vendor prawn-core lib]) )
|
11
11
|
require "prawn/core"
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
12
14
|
require "prawn/format"
|
13
15
|
|
14
16
|
Prawn.debug = true
|
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.
|
4
|
+
version: 0.2.2
|
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-
|
12
|
+
date: 2009-11-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements: []
|
120
120
|
|
121
121
|
rubyforge_project: prawn
|
122
|
-
rubygems_version: 1.3.
|
122
|
+
rubygems_version: 1.3.5
|
123
123
|
signing_key:
|
124
124
|
specification_version: 3
|
125
125
|
summary: an extension of Prawn that allows inline formatting
|