octopress-ink 1.0.0.alpha.44 → 1.0.0.alpha.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -6
- data/assets/docs/_plugin-template.markdown +9 -21
- data/assets/docs/creating-a-plugin.markdown +90 -12
- data/lib/octopress-ink/assets/asset.rb +55 -26
- data/lib/octopress-ink/assets/coffeescript.rb +22 -0
- data/lib/octopress-ink/assets/config.rb +12 -8
- data/lib/octopress-ink/assets/doc_page.rb +21 -18
- data/lib/octopress-ink/assets/file.rb +9 -7
- data/lib/octopress-ink/assets/javascript.rb +7 -0
- data/lib/octopress-ink/assets/layout.rb +3 -1
- data/lib/octopress-ink/assets/page.rb +12 -10
- data/lib/octopress-ink/assets/sass.rb +24 -17
- data/lib/octopress-ink/assets/stylesheet.rb +12 -6
- data/lib/octopress-ink/assets.rb +1 -4
- data/lib/octopress-ink/commands/helpers.rb +7 -4
- data/lib/octopress-ink/commands/init.rb +48 -0
- data/lib/octopress-ink/commands/list.rb +1 -1
- data/lib/octopress-ink/commands/new.rb +126 -49
- data/lib/octopress-ink/commands.rb +2 -0
- data/lib/octopress-ink/configuration.rb +18 -10
- data/lib/octopress-ink/filters.rb +4 -4
- data/lib/octopress-ink/generators/plugin_assets.rb +3 -2
- data/lib/octopress-ink/helpers/path.rb +4 -4
- data/lib/octopress-ink/jekyll/hooks.rb +123 -7
- data/lib/octopress-ink/jekyll/page.rb +3 -1
- data/lib/octopress-ink/plugin.rb +198 -165
- data/lib/octopress-ink/plugin_asset_pipeline.rb +172 -0
- data/lib/octopress-ink/plugins.rb +44 -168
- data/lib/octopress-ink/tags/javascript.rb +1 -1
- data/lib/octopress-ink/tags/render.rb +4 -2
- data/lib/octopress-ink/tags/stylesheet.rb +1 -1
- data/lib/octopress-ink/utils.rb +42 -0
- data/lib/octopress-ink/version.rb +1 -1
- data/lib/octopress-ink.rb +70 -34
- data/octopress-ink.gemspec +2 -2
- data/test/_combine_false.yml +4 -0
- data/test/_config.yml +1 -1
- data/test/combine_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +15 -0
- data/test/{sass_expanded → combine_css}/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +2 -4
- data/test/{concat_css_false → combine_css_false}/stylesheets/awesome-sauce/plugin-media-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/awesome-sauce/plugin-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/site.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-media-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-test.css +0 -0
- data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-test2.css +0 -0
- data/test/combine_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js +7 -0
- data/test/{concat_js_false → combine_js_false}/javascripts/site.js +0 -0
- data/test/combine_js_false/javascripts/test.js +10 -0
- data/test/{concat_js_false → combine_js_false}/javascripts/theme/bar.js +0 -0
- data/test/{concat_js_false → combine_js_false}/javascripts/theme/foo.js +0 -0
- data/test/copy_layouts_pages/_copy/pages/two.md +0 -1
- data/test/copy_test/_copy/pages/two.md +0 -1
- data/test/copy_test/_copy/stylesheets/main.scss +4 -1
- data/test/expected/index.html +2 -2
- data/test/plugins/awesome-sauce/pages/b.html +0 -1
- data/test/plugins/awesome-sauce/plugin.rb +1 -1
- data/test/plugins/test-theme/javascripts/blah.coffee +1 -0
- data/test/plugins/test-theme/plugin.rb +1 -1
- data/test/plugins/test-theme/stylesheets/main.scss +4 -1
- data/test/source/_plugins/awesome-sauce/config.yml +1 -1
- data/test/source/_plugins/theme/config.yml +1 -1
- data/test/source/_posts/2014-02-01-test-post.md +1 -0
- data/test/source/index.md +2 -2
- data/test/test.rb +15 -27
- metadata +66 -84
- data/lib/octopress-ink/assets/local_asset.rb +0 -47
- data/lib/octopress-ink/assets/local_javascript.rb +0 -12
- data/lib/octopress-ink/assets/local_sass.rb +0 -30
- data/lib/octopress-ink/assets/local_stylesheet.rb +0 -33
- data/lib/octopress-ink/helpers/titlecase.rb +0 -37
- data/lib/octopress-ink/plugins/asset_pipeline.rb +0 -103
- data/test/_concat_false.yml +0 -2
- data/test/_sass_compact.yml +0 -4
- data/test/_sass_expanded.yml +0 -4
- data/test/concat_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -1
- data/test/concat_css/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +0 -1
- data/test/concat_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js +0 -3
- data/test/sass_compact/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -18
- data/test/sass_compact/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +0 -5
- data/test/sass_expanded/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -36
- data/test/source/_javascripts/site.js +0 -1
- data/test/source/_stylesheets/_foo.scss +0 -1
- data/test/source/_stylesheets/site.sass +0 -7
- data/test/source/_stylesheets/test.css +0 -1
@@ -1,37 +0,0 @@
|
|
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
|
-
target = dup
|
24
|
-
# ignore any leading crazy characters and capitalize the first real character
|
25
|
-
if target =~ /^['"\(\[']*([a-z])/
|
26
|
-
i = index($1)
|
27
|
-
x = target[i,target.length]
|
28
|
-
# word with capitals and periods mid-word are left alone
|
29
|
-
target[i,1] = target[i,1].upcase unless x =~ /[A-Z]/ or x =~ /\.\w+/
|
30
|
-
end
|
31
|
-
target
|
32
|
-
end
|
33
|
-
|
34
|
-
def smart_capitalize!
|
35
|
-
replace(smart_capitalize)
|
36
|
-
end
|
37
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# The CSS assets for this plugin are populated at runtime by the add_static_files method of
|
2
|
-
# the Plugins module.
|
3
|
-
#
|
4
|
-
module Octopress
|
5
|
-
module Ink
|
6
|
-
class AssetPipelinePlugin < Plugin
|
7
|
-
def configuration
|
8
|
-
{
|
9
|
-
name: "Octopress Asset Pipeline",
|
10
|
-
description: "Add your CSS and JS to the asset pipeline.",
|
11
|
-
local: true
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def config
|
16
|
-
@config ||= Ink.config
|
17
|
-
end
|
18
|
-
|
19
|
-
def register_assets
|
20
|
-
|
21
|
-
local_stylesheets.each {|f| add_stylesheet(f) }
|
22
|
-
local_javascripts.each {|f| add_javascript(f) }
|
23
|
-
|
24
|
-
remove_jekyll_assets @sass if @sass
|
25
|
-
|
26
|
-
if config['concat_js']
|
27
|
-
remove_jekyll_assets @javascripts if @javascripts
|
28
|
-
end
|
29
|
-
|
30
|
-
if config['concat_css']
|
31
|
-
remove_jekyll_assets @css if @css
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def disabled?(dir, file)
|
36
|
-
case dir
|
37
|
-
when stylesheets_dir
|
38
|
-
config['disable'].include?('site_stylesheets')
|
39
|
-
when javascripts_dir
|
40
|
-
config['disable'].include?('site_javascripts')
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def add_javascript(file)
|
45
|
-
@javascripts << Assets::LocalJavascript.new(self, javascripts_dir, file)
|
46
|
-
end
|
47
|
-
|
48
|
-
def add_stylesheet(file)
|
49
|
-
# accept ['file', 'media_type']
|
50
|
-
#
|
51
|
-
if file.is_a? Array
|
52
|
-
if file.first =~ /\.css/
|
53
|
-
@css << Assets::LocalStylesheet.new(self, stylesheets_dir, file.first, file.last)
|
54
|
-
else
|
55
|
-
@sass << Assets::LocalSass.new(self, stylesheets_dir, file.first, file.last)
|
56
|
-
end
|
57
|
-
|
58
|
-
# accept 'file'
|
59
|
-
#
|
60
|
-
else
|
61
|
-
if file =~ /\.css/
|
62
|
-
@css << Assets::LocalStylesheet.new(self, stylesheets_dir, file)
|
63
|
-
else
|
64
|
-
@sass << Assets::LocalSass.new(self, stylesheets_dir, file)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def javascripts_dir
|
70
|
-
config['javascripts_dir']
|
71
|
-
end
|
72
|
-
|
73
|
-
def stylesheets_dir
|
74
|
-
config['stylesheets_dir']
|
75
|
-
end
|
76
|
-
|
77
|
-
def local_stylesheets
|
78
|
-
local_files('stylesheets', stylesheets_dir).reject do |f|
|
79
|
-
File.basename(f) =~ /^_.*?s[ac]ss/
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def local_javascripts
|
84
|
-
local_files('javascripts', javascripts_dir)
|
85
|
-
end
|
86
|
-
|
87
|
-
def local_files(type, dir)
|
88
|
-
source = Plugins.site.source
|
89
|
-
|
90
|
-
# If they manually specify files
|
91
|
-
#
|
92
|
-
if config[type].is_a?(Array) && !config[type].empty?
|
93
|
-
config[type]
|
94
|
-
else
|
95
|
-
dir = File.join(source, dir)
|
96
|
-
files = glob_assets(dir)
|
97
|
-
files.map { |f| f.split(dir).last }
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
data/test/_concat_false.yml
DELETED
data/test/_sass_compact.yml
DELETED
data/test/_sass_expanded.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
body{margin:2px;padding:2px}.main{color:#444}body{background:#000}.plugin-widget{background:red;color:#fff}.css-plugin{background:#fed}body{display:table}body{background:#aaa111}div{display:table}
|
@@ -1 +0,0 @@
|
|
1
|
-
*{background:none;color:#000}article a:after{content:attr(href)}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/* Theme: Classic Theme */
|
2
|
-
body { margin: 2px; padding: 2px; }
|
3
|
-
|
4
|
-
.main { color: #444; }
|
5
|
-
|
6
|
-
body { background: black; }
|
7
|
-
|
8
|
-
/* Plugin: awesome-sauce */
|
9
|
-
.plugin-widget { background: red; color: #fff; }
|
10
|
-
|
11
|
-
/* Plugin: Octopress Asset Pipeline */
|
12
|
-
.css-plugin { background: #fed; }
|
13
|
-
|
14
|
-
body { display: table; }
|
15
|
-
|
16
|
-
body { background: #aaa111; }
|
17
|
-
|
18
|
-
div { display: table; }
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/* Theme: Classic Theme */
|
2
|
-
body {
|
3
|
-
margin: 2px;
|
4
|
-
padding: 2px;
|
5
|
-
}
|
6
|
-
|
7
|
-
.main {
|
8
|
-
color: #444;
|
9
|
-
}
|
10
|
-
|
11
|
-
body {
|
12
|
-
background: black;
|
13
|
-
}
|
14
|
-
|
15
|
-
/* Plugin: awesome-sauce */
|
16
|
-
.plugin-widget {
|
17
|
-
background: red;
|
18
|
-
color: #fff;
|
19
|
-
}
|
20
|
-
|
21
|
-
/* Plugin: Octopress Asset Pipeline */
|
22
|
-
.css-plugin {
|
23
|
-
background: #fed;
|
24
|
-
}
|
25
|
-
|
26
|
-
body {
|
27
|
-
display: table;
|
28
|
-
}
|
29
|
-
|
30
|
-
body {
|
31
|
-
background: #aaa111;
|
32
|
-
}
|
33
|
-
|
34
|
-
div {
|
35
|
-
display: table;
|
36
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
console.log('local js')
|
@@ -1 +0,0 @@
|
|
1
|
-
body { display: table; }
|
@@ -1 +0,0 @@
|
|
1
|
-
.css-plugin { background: #fed; }
|