Skip to content

Commit

Permalink
Added documentation for icons within tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessedoyle committed Feb 11, 2015
1 parent c09f08a commit cf5dea2
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
Gemfile.lock
/doc
.yardoc/
9 changes: 9 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--charset UTF-8
--main README.md
--title 'Prawn/Icon Documentation'
--no-private
-
COPYING
LICENSE
README.md
CHANGELOG.md
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ produces:

When using `inline_format: true`, you may supply `<icon>` 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.
Expand Down
2 changes: 1 addition & 1 deletion lib/prawn/icon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
# ]
Expand Down
24 changes: 13 additions & 11 deletions prawn-icon.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ['[email protected]']
spec.licenses = ['RUBY', 'GPL-2', 'GPL-3']
spec.authors = ['Jesse Doyle']
spec.email = ['[email protected]']
spec.licenses = ['RUBY', 'GPL-2', 'GPL-3']

spec.add_dependency('prawn', '>= 1.3.0', '< 3.0.0')

Expand Down

0 comments on commit cf5dea2

Please sign in to comment.