octopress-ink 1.0.0.alpha.24 → 1.0.0.alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/octopress-ink/assets/asset.rb +19 -19
  3. data/lib/octopress-ink/assets/config.rb +6 -6
  4. data/lib/octopress-ink/assets/javascript.rb +1 -1
  5. data/lib/octopress-ink/assets/layout.rb +4 -4
  6. data/lib/octopress-ink/assets/root.rb +3 -3
  7. data/lib/octopress-ink/assets/sass.rb +13 -13
  8. data/lib/octopress-ink/assets/stylesheet.rb +1 -1
  9. data/lib/octopress-ink/filters.rb +115 -0
  10. data/lib/octopress-ink/generators/plugin_assets.rb +4 -2
  11. data/lib/octopress-ink/helpers/conditional.rb +1 -1
  12. data/lib/octopress-ink/helpers/content_for.rb +1 -1
  13. data/lib/octopress-ink/helpers/path.rb +2 -2
  14. data/lib/octopress-ink/helpers/titlecase.rb +36 -0
  15. data/lib/octopress-ink/helpers/var.rb +63 -3
  16. data/lib/octopress-ink/jekyll/hooks.rb +3 -0
  17. data/lib/octopress-ink/plugin.rb +15 -15
  18. data/lib/octopress-ink/plugins/stylesheets.rb +11 -9
  19. data/lib/octopress-ink/plugins.rb +78 -67
  20. data/lib/octopress-ink/tags/assign.rb +1 -1
  21. data/lib/octopress-ink/tags/include.rb +13 -3
  22. data/lib/octopress-ink/tags/javascript.rb +1 -5
  23. data/lib/octopress-ink/tags/line_comment.rb +7 -0
  24. data/lib/octopress-ink/tags/render.rb +12 -3
  25. data/lib/octopress-ink/tags/return.rb +1 -1
  26. data/lib/octopress-ink/tags/stylesheet.rb +1 -5
  27. data/lib/octopress-ink/tags/wrap.rb +3 -3
  28. data/lib/octopress-ink/tags/yield.rb +14 -3
  29. data/lib/octopress-ink/tags.rb +1 -0
  30. data/lib/octopress-ink/version.rb +1 -1
  31. data/lib/octopress-ink.rb +5 -0
  32. data/test/expected/test_tags/assign.html +1 -0
  33. data/test/expected/test_tags/content_for.html +4 -1
  34. data/test/expected/test_tags/include.html +4 -0
  35. data/test/expected/test_tags/render.html +4 -0
  36. data/test/expected/test_tags/wrap.html +7 -0
  37. data/test/site/test_tags/assign.html +1 -0
  38. data/test/site/test_tags/content_for.html +4 -1
  39. data/test/site/test_tags/include.html +4 -0
  40. data/test/site/test_tags/render.html +4 -0
  41. data/test/site/test_tags/wrap.html +7 -0
  42. data/test/source/test_tags/assign.html +1 -0
  43. data/test/source/test_tags/content_for.html +19 -4
  44. data/test/source/test_tags/include.html +4 -0
  45. data/test/source/test_tags/render.html +4 -0
  46. data/test/source/test_tags/return.html +1 -1
  47. data/test/source/test_tags/wrap.html +7 -0
  48. data/test/test.rb +2 -1
  49. metadata +5 -22
  50. data/test/expected/test_tags/footer.html +0 -3
  51. data/test/expected/test_tags/head.html +0 -4
  52. data/test/expected/test_tags/scripts.html +0 -4
  53. data/test/site/test_tags/footer.html +0 -3
  54. data/test/site/test_tags/head.html +0 -4
  55. data/test/site/test_tags/scripts.html +0 -4
  56. data/test/source/_layouts/content_for.html +0 -3
  57. data/test/source/test_tags/footer.html +0 -6
  58. data/test/source/test_tags/head.html +0 -10
  59. data/test/source/test_tags/scripts.html +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1792939440a17c3b7b73592e7f18f14de673923c
4
- data.tar.gz: 6a03bc173a8b9ea4f5fbc0c0048a9d1dc07a4da3
3
+ metadata.gz: de4dedafd926d2d6222ffd41be255ff2c003e0eb
4
+ data.tar.gz: c9fa39b81fd8226df9d1184596760e1c232f719b
5
5
  SHA512:
6
- metadata.gz: 5bce98043f48a2242540a61b76b5cc8bd5ab8e4527dd451841935887a6153a8513f2ee008e8c79a26eb7dba784eae9a8eecc163b86674b92332fd3b59c4e5af0
7
- data.tar.gz: b1fadbfd01da61504f1d29b37e9461b95a631ce27c576146ce0f342b88aec98b21bb02ea4eb57c4cbed5a62edd0d47413228e1591e1d8f45c1726b0e74b0a7fc
6
+ metadata.gz: cce34cf01f0ba29e84a53839d8e4ad8d44d44b3ca2528c942f5c06dfa58405e0207c9f9f8d068d50f3fc168255d07bb225ffa3e9168ff0ca51592e3f1f5018b3
7
+ data.tar.gz: 2e46aed362277f732cc98ef8bded455359cda4527a6a9c6312c80cd83aa3e302d5e9d89b04bcafe8378f28eff7cc4c25502e19ff76c2a336f3a234d84d14f965
@@ -16,12 +16,12 @@ module Octopress
16
16
  @file
17
17
  end
18
18
 
19
- def path(site)
19
+ def path
20
20
  if @found_file and !@no_cache
21
21
  @found_file
22
22
  else
23
23
  files = []
24
- files << user_path(site)
24
+ files << user_path
25
25
  files << plugin_path unless @plugin.type == 'local_plugin'
26
26
  files = files.flatten.reject { |f| !exists? f }
27
27
 
@@ -32,17 +32,17 @@ module Octopress
32
32
  end
33
33
  end
34
34
 
35
- def file(file, site)
35
+ def file(file)
36
36
  @file = file
37
- path(site)
37
+ path
38
38
  end
39
39
 
40
40
  def destination
41
41
  File.join(@dir, @file)
42
42
  end
43
43
 
44
- def copy(site)
45
- site.static_files << StaticFile.new(path(site), destination)
44
+ def copy
45
+ Plugins.site.static_files << StaticFile.new(path, destination)
46
46
  end
47
47
 
48
48
  def plugin_dir
@@ -53,23 +53,23 @@ module Octopress
53
53
  File.join plugin_dir, @file
54
54
  end
55
55
 
56
- def user_dir(site)
57
- File.join site.source, Plugins.custom_dir(site.config), @dir
56
+ def user_dir
57
+ File.join Plugins.site.source, Plugins.custom_dir, @dir
58
58
  end
59
59
 
60
- def local_plugin_path(site)
61
- File.join site.source, @dir, @file
60
+ def local_plugin_path
61
+ File.join Plugins.site.source, @dir, @file
62
62
  end
63
63
 
64
- def user_override_path(site)
65
- File.join user_dir(site), @file
64
+ def user_override_path
65
+ File.join user_dir, @file
66
66
  end
67
67
 
68
- def user_path(site)
68
+ def user_path
69
69
  if @plugin.type == 'local_plugin'
70
- local_plugin_path(site)
70
+ local_plugin_path
71
71
  else
72
- user_override_path(site)
72
+ user_override_path
73
73
  end
74
74
  end
75
75
 
@@ -82,10 +82,10 @@ module Octopress
82
82
  # Remove files from Jekyll's static_files array so it doesn't end up in the
83
83
  # compiled site directory.
84
84
  #
85
- def remove_jekyll_asset(site)
86
- site.static_files.clone.each do |sf|
87
- if sf.kind_of?(Jekyll::StaticFile) && sf.path == path(site).to_s
88
- site.static_files.delete(sf)
85
+ def remove_jekyll_asset
86
+ Plugins.site.static_files.clone.each do |sf|
87
+ if sf.kind_of?(Jekyll::StaticFile) && sf.path == path.to_s
88
+ Plugins.site.static_files.delete(sf)
89
89
  end
90
90
  end
91
91
  end
@@ -11,15 +11,15 @@ module Octopress
11
11
  @file = path
12
12
  end
13
13
 
14
- def user_dir(site)
15
- File.join site['source'], Plugins.custom_dir(site), @dir
14
+ def user_dir
15
+ File.join Plugins.site.source, Plugins.custom_dir, @dir
16
16
  end
17
17
 
18
- def local_plugin_path(site)
19
- File.join site['source'], @dir, @file
18
+ def local_plugin_path
19
+ File.join Plugins.site.source, @dir, @file
20
20
  end
21
21
 
22
- def read(site)
22
+ def read
23
23
  config = {}
24
24
  if @plugin.type != 'local_plugin'
25
25
  default = plugin_path
@@ -27,7 +27,7 @@ module Octopress
27
27
  config = YAML.safe_load(File.open(default))
28
28
  end
29
29
  end
30
- override = user_path(site)
30
+ override = user_path
31
31
  if exists? override
32
32
  config = config.deep_merge YAML.safe_load(File.open(override))
33
33
  end
@@ -2,7 +2,7 @@ module Octopress
2
2
  module Assets
3
3
  class Javascript < Asset
4
4
  def tag
5
- "<script src='/#{File.join(@dir, @file)}'></script>"
5
+ "<script src='#{Filters.expand_url(File.join(@dir, @file))}'></script>"
6
6
  end
7
7
  end
8
8
  end
@@ -2,18 +2,18 @@ module Octopress
2
2
  module Assets
3
3
  class Layout < Asset
4
4
 
5
- def register(site)
5
+ def register
6
6
  name = "#{@plugin.namespace}:#{@file}"
7
7
  name = name.split(".")[0..-2].join(".")
8
8
 
9
- file = user_path(site)
10
- dir = user_dir(site)
9
+ file = user_path
10
+ dir = user_dir
11
11
  if !exists?(file)
12
12
  file = plugin_path
13
13
  dir = plugin_dir
14
14
  end
15
15
 
16
- site.layouts[name] = Jekyll::Layout.new(site, dir, @file)
16
+ Plugins.site.layouts[name] = Jekyll::Layout.new(Plugins.site, dir, @file)
17
17
  end
18
18
  end
19
19
  end
@@ -16,9 +16,9 @@ module Octopress
16
16
  file_check
17
17
  end
18
18
 
19
- def copy(site)
20
- unless exists? local_plugin_path(site)
21
- site.static_files << StaticFile.new(plugin_path, destination)
19
+ def copy
20
+ unless exists? local_plugin_path
21
+ Plugins.site.static_files << StaticFile.new(plugin_path, destination)
22
22
  end
23
23
  end
24
24
 
@@ -13,39 +13,39 @@ module Octopress
13
13
  end
14
14
 
15
15
  def tag
16
- "<link href='/#{File.join(@dir, @file)}' media='#{media}' rel='stylesheet' type='text/css'>"
16
+ "<link href='#{Filters.expand_url(File.join(@dir, @file))}' media='#{media}' rel='stylesheet' type='text/css'>"
17
17
  end
18
18
 
19
19
  # TODO: choose user path before local path.
20
- def user_load_path(site)
21
- File.join(site.source, Plugins.custom_dir(site.config), @dir, File.dirname(@file)).sub /\/\.$/, ''
20
+ def user_load_path
21
+ File.join(Plugins.site.source, Plugins.custom_dir, @dir, File.dirname(@file)).sub /\/\.$/, ''
22
22
  end
23
23
 
24
24
  def theme_load_path
25
25
  File.expand_path(File.join(@root, @type))
26
26
  end
27
27
 
28
- def compile(site)
28
+ def compile
29
29
  unless @compiled
30
- options = Plugins.sass_options(site)
30
+ options = Plugins.sass_options
31
31
  if @plugin.type == 'local_plugin'
32
- @compiled = Plugins.compile_sass_file(path(site).to_s, options)
32
+ @compiled = Plugins.compile_sass_file(path.to_s, options)
33
33
  else
34
34
  # If the plugin isn't a local plugin, add source paths to allow overrieds on @imports.
35
35
  #
36
- options[:load_paths] = [user_load_path(site), theme_load_path]
37
- @compiled = Plugins.compile_sass(path(site).read, options)
36
+ options[:load_paths] = [user_load_path, theme_load_path]
37
+ @compiled = Plugins.compile_sass(path.read, options)
38
38
  end
39
39
  end
40
40
  @compiled
41
41
  end
42
42
 
43
- def user_override_path(site)
43
+ def user_override_path
44
44
  # Allow Sass overrides to use either syntax
45
45
  if @file =~ /s[ac]ss$/
46
- [File.join(user_dir(site), @file), File.join(user_dir(site), alt_syntax_file)]
46
+ [File.join(user_dir, @file), File.join(user_dir, alt_syntax_file)]
47
47
  else
48
- File.join user_dir(site), @file
48
+ File.join user_dir, @file
49
49
  end
50
50
  end
51
51
 
@@ -53,8 +53,8 @@ module Octopress
53
53
  File.join(@dir, @file.sub(/s.ss/, 'css'))
54
54
  end
55
55
 
56
- def copy(site)
57
- site.static_files << StaticFileContent.new(compile(site), destination)
56
+ def copy
57
+ Plugins.site.static_files << StaticFileContent.new(compile, destination)
58
58
  end
59
59
  end
60
60
  end
@@ -25,7 +25,7 @@ module Octopress
25
25
  end
26
26
 
27
27
  def tag
28
- "<link href='/#{File.join(@dir, @file)}' media='#{media}' rel='stylesheet' type='text/css'>"
28
+ "<link href='#{Filters.expand_url(File.join(@dir, @file))}' media='#{media}' rel='stylesheet' type='text/css'>"
29
29
  end
30
30
  end
31
31
  end
@@ -0,0 +1,115 @@
1
+ module Octopress
2
+ module Filters
3
+
4
+
5
+ # Returns the site's config root or '/' if the config isn't set
6
+ #
7
+ def root
8
+ root_url = Plugins.site.config['root']
9
+ root_url.nil? ? '/' : File.join('/', root_url)
10
+ end
11
+
12
+ # Prepends input with a url fragment
13
+ #
14
+ # input - An absolute url, e.g. /images/awesome.gif
15
+ # url - The fragment to prepend the input, e.g. /blog
16
+ #
17
+ # Returns the modified url, e.g /blog
18
+ #
19
+ def expand_url(input, url=nil)
20
+ url ||= root
21
+ if input =~ /^#{url}/
22
+ input
23
+ else
24
+ File.join(url, input)
25
+ end
26
+ end
27
+
28
+ # Prepend all absolute urls with a url fragment
29
+ #
30
+ # input - The content of a page or post
31
+ # url - The fragment to prepend absolute urls
32
+ #
33
+ # Returns input with modified urls
34
+ #
35
+ def expand_urls(input, url=nil)
36
+ url ||= root
37
+ input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\"'>]*)/ do
38
+ $1 + expand_url($3, url)
39
+ end
40
+ end
41
+
42
+ # Prepend all urls with the full site url
43
+ #
44
+ # input - The content of a page or post
45
+ #
46
+ # Returns input with all urls expanded to include the full site url
47
+ # e.g. /images/awesome.gif => http://example.com/images/awesome.gif
48
+ #
49
+ def full_urls(input)
50
+ url = Plugins.site.config['url']
51
+ if url.nil?
52
+ expand_urls(input)
53
+ else
54
+ File.join url, expand_urls(input)
55
+ end
56
+ end
57
+
58
+ # Prepend a url with the full site url
59
+ #
60
+ # input - a url
61
+ #
62
+ # Returns input with all urls expanded to include the full site url
63
+ # e.g. /images/awesome.gif => http://example.com/images/awesome.gif
64
+ #
65
+ def full_url(input)
66
+ url = Plugins.site.config['url']
67
+ if url.nil?
68
+ expand_url(input)
69
+ else
70
+ File.join url, expand_url(input)
71
+ end
72
+ end
73
+
74
+ # Truncate a string at the <!--more--> marker
75
+ # input - The content of a post or page
76
+ #
77
+ # Returns only the content preceeding the marker
78
+ #
79
+ def excerpt(input)
80
+ if input.index(/<!--\s*more\s*-->/i)
81
+ input.split(/<!--\s*more\s*-->/i)[0]
82
+ else
83
+ input
84
+ end
85
+ end
86
+
87
+ # Checks for excerpt markers (helpful for template conditionals)
88
+ #
89
+ # input - The content of a page or post
90
+ #
91
+ # Returns true/false if the excerpt marker is found
92
+ #
93
+ def has_excerpt(input)
94
+ input =~ /<!--\s*more\s*-->/i ? true : false
95
+ end
96
+
97
+ # Returns a title cased string based on John Gruber's title case http://daringfireball.net/2008/08/title_case_update
98
+ def titlecase(input)
99
+ input.titlecase
100
+ end
101
+
102
+ # Formats a string for use as a css classname, removing illegal characters
103
+ def classify(input)
104
+ input.gsub(/ /,'-').gsub(/[^\w-]/,'').downcase
105
+ end
106
+
107
+ # Replaces newlines with space characters
108
+ def join_space(input)
109
+ input.gsub(/^\s+/,'').gsub(/\s+/, ' ')
110
+ end
111
+
112
+ module_function :root, :expand_url, :expand_urls, :full_url, :full_urls, :excerpt, :titlecase, :classify
113
+ public :expand_url, :expand_urls, :full_url, :full_urls, :excerpt, :titlecase, :classify
114
+ end
115
+ end
@@ -1,8 +1,10 @@
1
1
  module Octopress
2
2
  class PluginAssets < Jekyll::Generator
3
3
  def generate(site)
4
- Plugins.register_layouts(site)
5
- Plugins.add_static_files(site)
4
+ Plugins.config(site)
5
+ Plugins.register_layouts
6
+ Plugins.add_static_files
7
+ site = Plugins.site
6
8
  end
7
9
  end
8
10
  end
@@ -1,7 +1,7 @@
1
1
  module Octopress
2
2
  module Helpers
3
3
  module Conditional
4
- SYNTAX = /(.*)(if|unless)\s*(.+)/
4
+ SYNTAX = /(.*)\s(if|unless)\s(.+)/
5
5
 
6
6
  def self.parse(markup, context)
7
7
  if markup =~ SYNTAX
@@ -21,7 +21,7 @@ module Octopress
21
21
 
22
22
  def self.append_to_block(context, block, content)
23
23
  converter = context.environments.first['converter']
24
- content = converter.convert(content).lstrip
24
+ content = converter.convert(content).sub(/\n$/,'')
25
25
  get_block(context, block) << content
26
26
  end
27
27
  end
@@ -1,10 +1,10 @@
1
1
  module Octopress
2
2
  module Helpers
3
3
  module Path
4
- FILE = /(\S+)(\s.*)/
4
+ FILE = /(\S+)(\s?)(.*)/
5
5
  def self.parse(markup, context)
6
6
  if markup =~ FILE
7
- (context[$1].nil? ? $1 : context[$1]) + $2
7
+ (context[$1].nil? ? $1 : context[$1]) + ' ' + ($3 || '')
8
8
  else
9
9
  markup
10
10
  end
@@ -0,0 +1,36 @@
1
+ class String
2
+ def titlecase
3
+ small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs.)
4
+
5
+ x = split(" ").map do |word|
6
+ # note: word could contain non-word characters!
7
+ # downcase all small_words, capitalize the rest
8
+ small_words.include?(word.gsub(/\W/, "").downcase) ? word.downcase! : word.smart_capitalize!
9
+ word
10
+ end
11
+ # capitalize first and last words
12
+ x.first.to_s.smart_capitalize!
13
+ x.last.to_s.smart_capitalize!
14
+ # small words are capitalized after colon, period, exclamation mark, question mark
15
+ x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
16
+ end
17
+
18
+ def titlecase!
19
+ replace(titlecase)
20
+ end
21
+
22
+ def smart_capitalize
23
+ # ignore any leading crazy characters and capitalize the first real character
24
+ if self =~ /^['"\(\[']*([a-z])/
25
+ i = index($1)
26
+ x = self[i,self.length]
27
+ # word with capitals and periods mid-word are left alone
28
+ self[i,1] = self[i,1].upcase unless x =~ /[A-Z]/ or x =~ /\.\w+/
29
+ end
30
+ self
31
+ end
32
+
33
+ def smart_capitalize!
34
+ replace(smart_capitalize)
35
+ end
36
+ end
@@ -2,6 +2,7 @@ module Octopress
2
2
  module Helpers
3
3
  module Var
4
4
  TERNARY = /(.*?)\(\s*(.+?)\s+\?\s+(.+?)\s+:\s+(.+?)\s*\)(.+)?/
5
+ HAS_FILTERS = /(.+?)(\s+\|\s+.+)/
5
6
 
6
7
  def self.set_var(var, operator, value, context)
7
8
  case operator
@@ -22,21 +23,80 @@ module Octopress
22
23
  def self.get_value(vars, context)
23
24
  vars = evaluate_ternary(vars, context)
24
25
  vars = vars.strip.gsub(/ or /, ' || ')
26
+ filters = false
27
+ if vars =~ HAS_FILTERS
28
+ vars = $1
29
+ filters = $2
30
+ end
25
31
  vars = vars.split(/ \|\| /).map { |v|
26
- Liquid::Variable.new(v.strip).render(context)
32
+ context[v.strip]
27
33
  }.compact
28
34
 
29
- vars.empty? ? nil : vars.first
35
+ var = vars.first
36
+ if filters
37
+ var = Liquid::Variable.new("'#{var}'"+ filters).render(context)
38
+ end
39
+ var
30
40
  end
31
41
 
32
42
  def self.evaluate_ternary(markup, context)
33
43
  if markup =~ TERNARY
34
- $1 + (Conditional.parse("if #{$2}", context) ? $3 : $4) + $5
44
+ $1 + (Conditional.parse(" if #{$2}", context) ? $3 : $4) + $5
35
45
  else
36
46
  markup
37
47
  end
38
48
  end
39
49
 
50
+ # Parses filters into arrays
51
+ #
52
+ # input - a string of one or more filters, e.g. "| upcase | replace:'a','b'"
53
+ #
54
+ # Returns nested arrays of filters and arguments
55
+ #
56
+ def self.parse_filters(input)
57
+ output = []
58
+ if input.match(/#{Liquid::FilterSeparator}\s*(.*)/o)
59
+ filters = Regexp.last_match(1).scan(Liquid::Variable::FilterParser)
60
+ filters.each do |f|
61
+ if matches = f.match(/\s*(\w+)/)
62
+ filtername = matches[1]
63
+ filterargs = f.scan(/(?:#{Liquid::FilterArgumentSeparator}|#{Liquid::ArgumentSeparator})\s*((?:\w+\s*\:\s*)?#{Liquid::QuotedFragment})/o).flatten
64
+ output << [filtername, filterargs]
65
+ end
66
+ end
67
+ end
68
+ output
69
+ end
70
+
71
+ # Passes input through Liquid filters
72
+ #
73
+ # content - a string to be parsed
74
+ # filters - a series of liquid filters e.g. "| upcase | replace:'a','b'"
75
+ # context - the current Liquid context object
76
+ #
77
+ # Returns a filtered string
78
+ #
79
+ def self.render_filters(content, filters, context)
80
+ filters = parse_filters(filters)
81
+ return '' if content.nil?
82
+ filters.inject(content) do |output, filter|
83
+ filterargs = []
84
+ keyword_args = {}
85
+ filter[1].to_a.each do |a|
86
+ if matches = a.match(/\A#{Liquid::TagAttributes}\z/o)
87
+ keyword_args[matches[1]] = context[matches[2]]
88
+ else
89
+ filterargs << context[a]
90
+ end
91
+ end
92
+ filterargs << keyword_args unless keyword_args.empty?
93
+ begin
94
+ output = context.invoke(filter[0], output, *filterargs)
95
+ rescue
96
+ raise "Error - filter '#{filter[0]}' could not be found."
97
+ end
98
+ end
99
+ end
40
100
  end
41
101
  end
42
102
  end
@@ -8,6 +8,9 @@ module Jekyll
8
8
  payload['plugins'] = config['plugins']
9
9
  payload['theme'] = config['theme']
10
10
  payload['converter'] = self.converter
11
+ self.site.config['octopress'] = {}
12
+ self.site.config['octopress']['theme'] = config['theme']
13
+ self.site.config['octopress']['plugins'] = config['plugins']
11
14
  do_layout_orig(payload, layouts)
12
15
  end
13
16
  end
@@ -71,8 +71,8 @@ module Octopress
71
71
  end
72
72
  end
73
73
 
74
- def remove_jekyll_assets(files, site)
75
- files.each {|f| f.remove_jekyll_asset(site) }
74
+ def remove_jekyll_assets(files)
75
+ files.each {|f| f.remove_jekyll_asset }
76
76
  end
77
77
 
78
78
  def add_includes
@@ -123,40 +123,40 @@ module Octopress
123
123
  files.each { |f| add_file(f) }
124
124
  end
125
125
 
126
- def stylesheet_paths(site)
127
- get_paths(@stylesheets, site)
126
+ def stylesheet_paths
127
+ get_paths @stylesheets
128
128
  end
129
129
 
130
- def javascript_paths(site)
131
- get_paths(@javascripts, site)
130
+ def javascript_paths
131
+ get_paths @javascripts
132
132
  end
133
133
 
134
134
  def stylesheet_tags
135
- get_tags(@stylesheets)
135
+ get_tags @stylesheets
136
136
  end
137
137
 
138
138
  def sass_tags
139
- get_tags(@sass)
139
+ get_tags @sass
140
140
  end
141
141
 
142
142
  def javascript_tags
143
- get_tags(@javascripts)
143
+ get_tags @javascripts
144
144
  end
145
145
 
146
- def get_paths(files, site)
147
- files.dup.map { |f| f.path(site) }
146
+ def get_paths(files)
147
+ files.dup.map { |f| f.path }
148
148
  end
149
149
 
150
150
  def get_tags(files)
151
151
  files.dup.map { |f| f.tag }
152
152
  end
153
153
 
154
- def include(file, site)
155
- @includes.file(file, site)
154
+ def include(file)
155
+ @includes.file file
156
156
  end
157
157
 
158
- def configs(site)
159
- @config ||= @configs.read(site)
158
+ def configs
159
+ @config ||= @configs.read
160
160
  @config
161
161
  end
162
162
  end
@@ -3,14 +3,14 @@
3
3
  #
4
4
  module Octopress
5
5
  class StylesheetsPlugin < Octopress::Plugin
6
- def add_files(site)
6
+ def add_files
7
7
 
8
- add_stylesheets(local_stylesheets(site))
8
+ add_stylesheets local_stylesheets
9
9
 
10
- remove_jekyll_assets(@sass, site)
10
+ remove_jekyll_assets @sass
11
11
 
12
- if Plugins.concat_css(site)
13
- remove_jekyll_assets(@stylesheets, site)
12
+ if Plugins.concat_css
13
+ remove_jekyll_assets @stylesheets
14
14
  end
15
15
  end
16
16
 
@@ -36,11 +36,13 @@ module Octopress
36
36
  files
37
37
  end
38
38
 
39
- def local_stylesheets(site)
40
- if site.config['octopress'] && site.config['octopress']['stylesheets']
41
- site.config['octopress']['stylesheets'] || []
39
+ def local_stylesheets
40
+ config = Plugins.site.config
41
+ source = Plugins.site.source
42
+ if config['octopress'] && config['octopress']['stylesheets']
43
+ config['octopress']['stylesheets'] || []
42
44
  else
43
- dir = File.join(site.source, 'stylesheets/')
45
+ dir = File.join(source, 'stylesheets/')
44
46
  css = Dir.glob(File.join(dir, '**/*.css'))
45
47
  sass = Dir.glob(File.join(dir, '**/*.s[ca]ss')).reject { |f| File.basename(f) =~ /^_.*?s[ac]ss/ }
46
48
  files = css.concat sass