webfontloader 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v1.5.2 (January 3, 2014)
2
+ * Add Copyright, License and Version to the compiled output file(s)
3
+ * Fix small bug in Google Font module that rejected font variations with dashes
4
+
1
5
  v1.5.1 (October 15, 2013)
2
6
  * Dispatch wf-loading event synchronously instead of waiting for asynchronous modules
3
7
  * Update README explaining how to use custom fonts without a stylesheet
data/Rakefile CHANGED
@@ -89,7 +89,7 @@ file "target/webfont.js", [:modules] => SourceJs + ["target"] do |t, args|
89
89
  modules = args[:modules].split ' '
90
90
 
91
91
  output_marker = "%output%"
92
- output_wrapper = @modules.js_output_wrapper(output_marker)
92
+ output_wrapper = @modules.js_output_wrapper(output_marker, version)
93
93
 
94
94
  args = [
95
95
  ["-jar", JsCompilerJar],
@@ -120,13 +120,13 @@ end
120
120
  desc "Creates debug version into target/webfont.js"
121
121
  task :debug, [:modules] => "target/webfont_debug.js"
122
122
 
123
- file "target/webfont_debug.js", [:modules] => SourceJs + ["target"] do |t|
123
+ file "target/webfont_debug.js", [:modules] => SourceJs + ["target"] do |t, args|
124
124
  args.with_defaults(:modules => 'custom google typekit monotype fontdeck')
125
125
 
126
126
  modules = args[:modules].split ' '
127
127
 
128
128
  output_marker = "%output%"
129
- output_wrapper = @modules.js_output_wrapper(output_marker)
129
+ output_wrapper = @modules.js_output_wrapper(output_marker, version)
130
130
 
131
131
  args = [
132
132
  ["-jar", JsCompilerJar],
data/lib/webfontloader.rb CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
3
3
  require 'webfontloader/modules'
4
4
 
5
5
  module WebFontLoader
6
- VERSION = '1.5.1'
6
+ VERSION = '1.5.2'
7
7
 
8
8
  ProjectRoot = File.expand_path(File.dirname(__FILE__) + "/..")
9
9
 
@@ -27,8 +27,8 @@ module WebFontLoader
27
27
  end
28
28
  end
29
29
 
30
- def js_output_wrapper(source)
31
- File.read(File.join(js_src, "closure.js")).sub("{{source}}", source)
30
+ def js_output_wrapper(source, version)
31
+ File.read(File.join(js_src, "closure.js")).sub("{{source}}", source).sub("{{version}}", version)
32
32
  end
33
33
 
34
34
  protected
@@ -66,6 +66,22 @@ describe('modules.google.FontApiParser', function () {
66
66
  });
67
67
  });
68
68
 
69
+ describe('variations with dashes', function () {
70
+ var parser = null;
71
+
72
+ beforeEach(function () {
73
+ parser = new FontApiParser(['Nobile:semi-bold']);
74
+ parser.parse();
75
+ });
76
+
77
+ it('should parse the variation correctly', function () {
78
+ var fonts = parser.getFonts();
79
+
80
+ expect(fonts.length).toEqual(1);
81
+ expect(fonts[0]).toEqual(new Font('Nobile', 'n6'));
82
+ });
83
+ });
84
+
69
85
  describe('nonsense', function () {
70
86
  var parser = null;
71
87
 
data/src/closure.js CHANGED
@@ -1,3 +1,2 @@
1
- ;(function(window,document,undefined){
2
- {{source}}
3
- })(this,document);
1
+ /* Web Font Loader v{{version}} - (c) Adobe Systems, Google. License: Apache 2.0 */
2
+ ;(function(window,document,undefined){{{source}}})(this,document);
@@ -103,7 +103,7 @@ goog.scope(function () {
103
103
  };
104
104
 
105
105
  FontApiParser.prototype.generateFontVariationDescription_ = function(variation) {
106
- if (!variation.match(/^[\w]+$/)) {
106
+ if (!variation.match(/^[\w-]+$/)) {
107
107
  return '';
108
108
  }
109
109
  var normalizedVariation = variation.toLowerCase();
@@ -51,7 +51,7 @@ goog.scope(function () {
51
51
 
52
52
  FontApiUrlBuilder.prototype.build = function() {
53
53
  if (this.fontFamilies_.length == 0) {
54
- throw new Error('No fonts to load !');
54
+ throw new Error('No fonts to load!');
55
55
  }
56
56
  if (this.apiUrl_.indexOf("kit=") != -1) {
57
57
  return this.apiUrl_;
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'webfontloader'
16
- s.version = '1.5.1'
17
- s.date = '2013-10-15'
16
+ s.version = '1.5.2'
17
+ s.date = '2014-01-03'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
20
20
  ## as you like.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webfontloader
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 1
10
- version: 1.5.1
9
+ - 2
10
+ version: 1.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Carver
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-10-15 00:00:00 Z
19
+ date: 2014-01-03 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rake