Browse Source

Set a non-symbol default for text embeds

Fixes #73, but in #74 we'll get it right.
dev
Andy Meneely 11 years ago
parent
commit
ae1a7bd084
  1. 3
      CHANGELOG.md
  2. 10
      lib/squib/api/text_embed.rb

3
CHANGELOG.md

@ -11,6 +11,7 @@ Features:
* Upgraded roo (Excel parsing) to 2.0.0. Nothing major for Squib users, just keeping up with the times. * Upgraded roo (Excel parsing) to 2.0.0. Nothing major for Squib users, just keeping up with the times.
Bugs: Bugs:
* Text embed svg and png commands default to integer so the README example works (#73).
* Fixed global text hinting (#63) * Fixed global text hinting (#63)
* Fixed a broken promise about fill_color in `showcase` (#71) * Fixed a broken promise about fill_color in `showcase` (#71)
@ -23,7 +24,7 @@ Chores:
* Added `rake sanity` as a visual regression test to ensure the samples don't break * Added `rake sanity` as a visual regression test to ensure the samples don't break
* Lots of automated test refactoring * Lots of automated test refactoring
Thanks to [pickfifteen](https://github.com/pickfifteen) for the bug report! Thanks to [pickfifteen](https://github.com/pickfifteen), and [Brian Cronin](http://www.boardgamegeek.com/user/MurphyIdiot) for the bug reports!
## v0.5.1 / 2015-04-13 ## v0.5.1 / 2015-04-13

10
lib/squib/api/text_embed.rb

@ -17,8 +17,8 @@ module Squib
# @option opts id [String] (nil) if set, then only render the SVG element with the given id. Prefix '#' is optional. Note: the x-y coordinates are still relative to the SVG document's page. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts id [String] (nil) if set, then only render the SVG element with the given id. Prefix '#' is optional. Note: the x-y coordinates are still relative to the SVG document's page. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
# @option opts force_id [Boolean] (false) if set, then this svg will not be rendered at all if the id is empty or nil. If not set, the entire SVG is rendered. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts force_id [Boolean] (false) if set, then this svg will not be rendered at all if the id is empty or nil. If not set, the entire SVG is rendered. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
# @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
# @option opts width [Integer, :native] (:native) the width of the image rendered. # @option opts width [Integer] (32) the width of the image rendered.
# @option opts height [Integer, :native] the height the height of the image rendered. # @option opts height [Integer] (32) the height the height of the image rendered.
# @option opts dx [Integer] (0) "delta x", or adjust the icon horizontally by x pixels # @option opts dx [Integer] (0) "delta x", or adjust the icon horizontally by x pixels
# @option opts dy [Integer] (0) "delta y", or adjust the icon vertically by y pixels # @option opts dy [Integer] (0) "delta y", or adjust the icon vertically by y pixels
# @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
@ -26,6 +26,7 @@ module Squib
# @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
# @api public # @api public
def svg(opts) def svg(opts)
opts = { width: 32, height: 32 }.merge(opts)
opts = Squib::SYSTEM_DEFAULTS.merge(opts) opts = Squib::SYSTEM_DEFAULTS.merge(opts)
# TODO: add input validation here. We need the key for example. # TODO: add input validation here. We need the key for example.
rule = {type: :svg}.merge(opts) rule = {type: :svg}.merge(opts)
@ -41,8 +42,8 @@ module Squib
# @option opts key [String] ('*') the string to replace with the graphic. Can be multiple letters, e.g. ':tool:' # @option opts key [String] ('*') the string to replace with the graphic. Can be multiple letters, e.g. ':tool:'
# @option opts file [String] ('') file(s) to read in. If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts file [String] ('') file(s) to read in. If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
# @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
# @option opts width [Integer, :native] (:native) the width of the image rendered # @option opts width [Fixnum] (32) the width of the image rendered
# @option opts height [Integer, :native] the height the height of the image rendered # @option opts height [Fixnum] (32) the height of the image rendered
# @option opts dx [Integer] (0) "delta x", or adjust the icon horizontally by x pixels # @option opts dx [Integer] (0) "delta x", or adjust the icon horizontally by x pixels
# @option opts dy [Integer] (0) "delta y", or adjust the icon vertically by y pixels # @option opts dy [Integer] (0) "delta y", or adjust the icon vertically by y pixels
# @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
@ -50,6 +51,7 @@ module Squib
# @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion} # @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
# @api public # @api public
def png(opts) def png(opts)
opts = { width: 32, height: 32 }.merge(opts)
opts = Squib::SYSTEM_DEFAULTS.merge(opts) opts = Squib::SYSTEM_DEFAULTS.merge(opts)
# TODO: add input validation here. We need the key for example. # TODO: add input validation here. We need the key for example.
rule = {type: :png}.merge(opts) rule = {type: :png}.merge(opts)

Loading…
Cancel
Save