diff --git a/.gitignore b/.gitignore index 6e69fb1..dfd6065 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store Gemfile.lock +/doc +.yardoc/ diff --git a/.yardopts b/.yardopts new file mode 100644 index 0000000..0a15f55 --- /dev/null +++ b/.yardopts @@ -0,0 +1,9 @@ +--charset UTF-8 +--main README.md +--title 'Prawn/Icon Documentation' +--no-private +- +COPYING +LICENSE +README.md +CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4576b94 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,24 @@ +# 0.6.2 - February 10, 2015 + +- Added this CHANGELOG. +- Added the `table_icon` method to simplify icon use in conjuction with `Prawn::Table`. +- Added a `.yardopts` file for better documentation. +- Clean `.gemspec` to increase readability. + +# 0.6.1 - January 27, 2015 + +- Upgraded FontAwesome to `v4.3.0`. + +# 0.6.0 - January 20, 2015 + +- Single-quoted attributes are now supported when using `inline_format: true`. +- Prawn is now specified as a runtime dependency of `prawn/icon`. + +# 0.5.1 - November 2, 2014 + +- Bugfix for improperly cached font data. +- Added Codeclimate and Travis CI. + +# 0.5.0 - October 29, 2014 + +- Initial public release. \ No newline at end of file diff --git a/README.md b/README.md index de9f8aa..b9cd2ff 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,27 @@ produces: When using `inline_format: true`, you may supply `` tags with `color` and `size` attributes. +## Use with [Prawn::Table](https://github.com/prawnpdf/prawn-table) + +A `table_icon` method may be called when creating a table's data array to render icons within a table cell: + +```ruby +require 'prawn/icon' +require 'prawn/table' + +Prawn::Document.generate('table_icons.pdf') do |pdf| + +data = [ + # Explicit brackets must be used here + [pdf.table_icon('fa-birthday-cake'), 'Cake'], + ['is', 'Great!'] +] + +pdf.table(data) # => (2 x 2 table) +``` + +Note that the `table_icon` method does not support the `inline_format: true` option. + ## Specifying Icon Families Prawn::Icon uses the prefix of an icon key to determine which font family is used to render a particular icon. diff --git a/lib/prawn/icon.rb b/lib/prawn/icon.rb index 3896e5b..77892fb 100644 --- a/lib/prawn/icon.rb +++ b/lib/prawn/icon.rb @@ -153,7 +153,7 @@ def inline_icon(text, opts = {}) # require 'prawn/table' # # data = [ - # # Explicit brackets must be userd here + # # Explicit brackets must be used here # [pdf.table_icon('fa-arrows'), 'Cell 1'], # ['Cell 2', 'Cell 3'] # ] diff --git a/prawn-icon.gemspec b/prawn-icon.gemspec index c13559b..b14998b 100644 --- a/prawn-icon.gemspec +++ b/prawn-icon.gemspec @@ -2,23 +2,25 @@ basedir = File.expand_path(File.dirname(__FILE__)) require "#{basedir}/lib/prawn/icon/version" Gem::Specification.new do |spec| - spec.name = 'prawn-icon' - spec.version = Prawn::Icon::VERSION + spec.name = 'prawn-icon' + spec.version = Prawn::Icon::VERSION spec.platform = Gem::Platform::RUBY - spec.summary = 'Provides icon fonts for PrawnPDF' - spec.files = Dir.glob('{lib,spec,fonts,examples}/**/**/*') + - ['prawn-icon.gemspec', 'Gemfile', 'Rakefile', - 'COPYING', 'LICENSE', 'GPLv2', 'GPLv3'] - spec.require_path = 'lib' - spec.required_ruby_version = '>= 1.9.3' + spec.summary = 'Provides icon fonts for PrawnPDF' + spec.files = Dir.glob('{lib,spec,fonts,examples}/**/**/*') + + %w(prawn-icon.gemspec Gemfile Rakefile) + + %w(README.md CHANGELOG.md) + + %w(COPYING LICENSE GPLv2 GPLv3) + + spec.require_path = 'lib' + spec.required_ruby_version = '>= 1.9.3' spec.required_rubygems_version = '>= 1.3.6' spec.homepage = 'https://github.com/jessedoyle/prawn-icon/' spec.test_files = Dir['spec/*_spec.rb'] - spec.authors = ['Jesse Doyle'] - spec.email = ['jdoyle@ualberta.ca'] - spec.licenses = ['RUBY', 'GPL-2', 'GPL-3'] + spec.authors = ['Jesse Doyle'] + spec.email = ['jdoyle@ualberta.ca'] + spec.licenses = ['RUBY', 'GPL-2', 'GPL-3'] spec.add_dependency('prawn', '>= 1.3.0', '< 3.0.0')