octopress-ink 1.0.0.rc.56 → 1.0.0.rc.57

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2cd9fc670733acf85a2404920d6007bef790fc6
4
- data.tar.gz: f1b1aa10dc93141d6a1d33015c9d489795bf3e6f
3
+ metadata.gz: 51af822022c99cfea1c9f14ffa3b32188ab4235b
4
+ data.tar.gz: 1cc82f18bbd1ec90cc13979297801833cb0f6880
5
5
  SHA512:
6
- metadata.gz: 1eed8707847bc8d7905fa504d057eafbf8e2da7e35e77500ec24610d3e22a1483a12cfb292407948b5f9bbff46448c1dd16c444f926a1ae47b52b2688525e5db
7
- data.tar.gz: 89ecd6438d235a217b22372422a0e6e137986067ec0334f6b6415e6756557cdd211e8afe33ab8b146c73e39597479282bb1e2a4cc3ea0729a2f6916983a8cd6d
6
+ metadata.gz: 64972ef01166bfde776d24a5364a4c0a3e4556cf238bc089f4bfec540494e23fad6113fbffad977b18682f0f618a2e7be6b5f3ce3c10efa21fdd64266a0b26f0
7
+ data.tar.gz: 78dcbe0ed983b969d682f394106d8fab3fbdafe5eb9193bc97686317d840d28601ada861a704b2e515de14119f16a1d10252f58c34aeb1af4b5f98adab248d60
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.0.0 RC57 - 2015-03-27
4
+ - Fix: Now asset pipeline is properly reset during jekyll watch.
5
+ - Minor: Added caching to speed up category and tag liquid tags.
6
+
3
7
  ### 1.0.0 RC56 - 2015-03-22
4
8
  - Fix: Tag links and lists weren't being ouput
5
9
  - Fix: Tags and categories would throw errors if tags were used but plugin
@@ -10,10 +10,10 @@ If you were going to install the [octopress-codefence](https://github.com/octopr
10
10
 
11
11
  #### Using Bundler
12
12
 
13
- If you are using [Bundler](http://bundler.io), simply add it to your Gemfile in the `:octopress` group and run `bundle`. Octopress will automatically load the plugin when you build your site.
13
+ If you are using [Bundler](http://bundler.io), simply add it to your Gemfile in the `:jekyll_plugins` group and run `bundle`. Octopress will automatically load the plugin when you build your site.
14
14
 
15
15
  ```ruby
16
- group :octopress do
16
+ group :jekyll_plugins do
17
17
  gem 'octopress-codefence'
18
18
  end
19
19
  ```
@@ -10,12 +10,17 @@ module Octopress
10
10
 
11
11
  class << self
12
12
  attr_reader :pages, :categories, :tags, :feeds
13
+ attr_accessor :tag_links, :category_links, :tag_list, :category_list
13
14
 
14
15
  def reset
15
- @pages = {}
16
- @categories = {}
17
- @tags = {}
18
- @feeds = {}
16
+ @pages = {}
17
+ @categories = {}
18
+ @tags = {}
19
+ @feeds = {}
20
+ @tag_links = {}
21
+ @tag_list = {}
22
+ @category_links = {}
23
+ @category_list = {}
19
24
  end
20
25
 
21
26
  def page(lang, type, key)
@@ -1,10 +1,21 @@
1
1
  module Octopress
2
2
  module Ink
3
3
  module PluginAssetPipeline
4
+ extend self
5
+
6
+ def reset
7
+ @sass_converter = nil
8
+ @combined_stylesheets = nil
9
+ @stylesheets = nil
10
+ @javascripts = nil
11
+ @uglify_settings = nil
12
+ @combined_js = ''
13
+ @combined_stylesheets = nil
14
+ end
4
15
 
5
16
  # Compile CSS to take advantage of Sass's compression settings
6
17
  #
7
- def self.compile_css(content)
18
+ def compile_css(content)
8
19
  configs = sass_converter.sass_configs
9
20
  configs[:syntax] = :scss
10
21
  configs[:style] ||= :compressed if Ink.configuration['asset_pipeline']['compress_css']
@@ -12,13 +23,13 @@ module Octopress
12
23
  Sass.compile(content, configs)
13
24
  end
14
25
 
15
- def self.compile_sass(sass)
26
+ def compile_sass(sass)
16
27
  Sass.compile(sass.render, sass_configs(sass))
17
28
  end
18
29
 
19
30
  # Gets default Sass configuration hash from Jekyll
20
31
  #
21
- def self.sass_configs(sass)
32
+ def sass_configs(sass)
22
33
  configs = sass_converter.sass_configs
23
34
 
24
35
  configs[:syntax] = sass.ext.sub(/^\./,'').to_sym
@@ -32,20 +43,17 @@ module Octopress
32
43
 
33
44
  # Access Jekyll's built in Sass converter
34
45
  #
35
- def self.sass_converter
36
- if @sass_converter
37
- @sass_converter
38
- else
39
- Octopress.site.converters.each do |c|
40
- @sass_converter = c if c.kind_of?(Jekyll::Converters::Sass)
46
+ def sass_converter
47
+ @sass_converter ||= begin
48
+ Octopress.site.converters.find do |c|
49
+ c.kind_of?(Jekyll::Converters::Sass)
41
50
  end
42
- @sass_converter
43
51
  end
44
52
  end
45
53
 
46
54
  # Return a link tag, for all plugins' stylesheets
47
55
  #
48
- def self.combined_stylesheet_tag
56
+ def combined_stylesheet_tag
49
57
  tags = ''
50
58
  combine_stylesheets.keys.each do |media|
51
59
  tags.concat "<link href='#{Filters.expand_url(combined_stylesheet_path(media))}' media='#{media}' rel='stylesheet' type='text/css'>"
@@ -53,7 +61,7 @@ module Octopress
53
61
  tags
54
62
  end
55
63
 
56
- def self.combined_javascript_tag
64
+ def combined_javascript_tag
57
65
  unless @combined_js == ''
58
66
  "<script src='#{Filters.expand_url(combined_javascript_path)}'></script>"
59
67
  end
@@ -66,10 +74,8 @@ module Octopress
66
74
  #
67
75
  # output: { 'screen' => 'body { background... }' }
68
76
  #
69
- def self.combine_stylesheets
70
- if @combined_stylesheets
71
- @combined_stylesheets
72
- else
77
+ def combine_stylesheets
78
+ @combined_stylesheets ||= begin
73
79
  combined = {}
74
80
 
75
81
  stylesheets.clone.each do |media,files|
@@ -81,12 +87,11 @@ module Octopress
81
87
  end
82
88
  end
83
89
 
84
- @combined_stylesheets = combined
90
+ combined
85
91
  end
86
92
  end
87
93
 
88
- def self.write_combined_stylesheet
89
- @combined_stylesheets = nil
94
+ def write_combined_stylesheet
90
95
  css = combine_stylesheets
91
96
  css.keys.each do |media|
92
97
  contents = compile_css(css[media])
@@ -94,11 +99,11 @@ module Octopress
94
99
  end
95
100
  end
96
101
 
97
- def self.combined_stylesheet_path(media)
102
+ def combined_stylesheet_path(media)
98
103
  File.join('stylesheets', "#{media}-#{stylesheet_fingerprint(media)}.css")
99
104
  end
100
105
 
101
- def self.stylesheet_fingerprint(media)
106
+ def stylesheet_fingerprint(media)
102
107
  @stylesheet_fingerprint ||= {}
103
108
  @stylesheet_fingerprint[media] ||=
104
109
  fingerprint(stylesheets[media].clone.map(&:path))
@@ -110,10 +115,8 @@ module Octopress
110
115
  #
111
116
  # output: { 'screen' => [Octopress::Ink::Assets::Stylesheet, ..]
112
117
  #
113
- def self.stylesheets
114
- if @stylesheets
115
- @stylesheets
116
- else
118
+ def stylesheets
119
+ @stylesheets ||= begin
117
120
  files = {}
118
121
  Plugins.plugins.clone.each do |plugin|
119
122
  plugin.stylesheets.each do |file|
@@ -121,27 +124,25 @@ module Octopress
121
124
  files[file.media] << file
122
125
  end
123
126
  end
124
- @stylesheets = files
127
+ files
125
128
  end
126
129
  end
127
130
 
128
- def self.javascripts
131
+ def javascripts
129
132
  @javascripts ||=
130
133
  Plugins.plugins.clone.map(&:javascripts).flatten
131
134
  end
132
135
 
133
- def self.javascript_fingerprint
136
+ def javascript_fingerprint
134
137
  @javascript_fingerprint ||=
135
138
  fingerprint(javascripts.clone.map(&:path))
136
139
  end
137
140
 
138
- def self.combined_javascript_path
141
+ def combined_javascript_path
139
142
  File.join('javascripts', "all-#{javascript_fingerprint}.js")
140
143
  end
141
144
 
142
- def self.write_combined_javascript
143
- @combined_js = ''
144
-
145
+ def write_combined_javascript
145
146
  if Ink.configuration['asset_pipeline']['combine_js']
146
147
  javascripts.each do |file|
147
148
 
@@ -170,15 +171,15 @@ module Octopress
170
171
  end
171
172
  end
172
173
 
173
- def self.compress_js?(file)
174
+ def compress_js?(file)
174
175
  Ink.configuration['asset_pipeline']['compress_js'] && !file.path.end_with?('.min.js')
175
176
  end
176
177
 
177
- def self.write_files(source, dest)
178
+ def write_files(source, dest)
178
179
  Plugins.static_files << StaticFileContent.new(source, dest)
179
180
  end
180
181
 
181
- def self.fingerprint(paths)
182
+ def fingerprint(paths)
182
183
  return '' if ENV['JEKYLL_ENV'] == 'test'
183
184
  paths = [paths] unless paths.is_a? Array
184
185
  Digest::MD5.hexdigest(paths.clone.map! { |path| "#{File.mtime(path).to_i}" }.join)
@@ -1,8 +1,8 @@
1
1
  module Octopress
2
2
  module Ink
3
3
  module Plugins
4
- extend self
5
4
  attr_reader :registered
5
+ extend self
6
6
 
7
7
  @registered = false
8
8
  @plugins = []
@@ -43,16 +43,19 @@ module Octopress
43
43
  end
44
44
 
45
45
  def reset
46
- @static_files = []
47
46
  @registered = false
48
- @css_tags = []
49
- @js_tags = []
50
- Bootstrap.reset
51
47
  end
52
48
 
53
49
  def register
54
50
  unless @registered
55
51
  @registered = true
52
+ @static_files = []
53
+ @css_tags = []
54
+ @js_tags = []
55
+ Bootstrap.reset
56
+ PluginAssetPipeline.reset
57
+
58
+ puts 'registering'
56
59
  plugins.each(&:register)
57
60
  end
58
61
  end
@@ -15,9 +15,23 @@ module Octopress
15
15
 
16
16
  # Check to see if post loop is active, otherwise default to current page
17
17
  page = context['post'] || context['page']
18
+
19
+ tags = Bootstrap.send(@tag)[page['url']]
20
+
21
+ if tags.nil?
22
+ if tags = item_tags(page)
23
+ # Cache tags to speed up multiple references for the same post
24
+ Bootstrap.send(@tag)[page['url']] = tags
25
+ end
26
+ end
27
+
28
+ tags
29
+ end
30
+
31
+ def item_tags(page)
18
32
  items = page[item_name_plural]
19
33
 
20
- return '' if items.nil? || items.empty?
34
+ return nil if items.nil? || items.empty?
21
35
 
22
36
  items = items.sort.map { |i| item_link(page, i) }.compact.map do |link|
23
37
  if item_list?
@@ -27,7 +41,7 @@ module Octopress
27
41
  link
28
42
  end
29
43
 
30
- return '' if items.empty?
44
+ return nil if items.empty?
31
45
 
32
46
  if item_list?
33
47
  %Q{<ul class="#{item_name}-list">#{items.join}</ul>}
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Ink
3
- VERSION = "1.0.0.rc.56"
3
+ VERSION = "1.0.0.rc.57"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-ink
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc.56
4
+ version: 1.0.0.rc.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-22 00:00:00.000000000 Z
11
+ date: 2015-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll