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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93de0d96c0c1233b369f703f42e9c5232f6fa122
|
4
|
+
data.tar.gz: 64f81451f17f6c13c9bc614d9996103ba7723a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e2db0a926b6b38952e84f2bf03e873cc1e8826710aed7f0908962f9585ebde1d5ec9025341f4bcf2ab0579933bae79c04e7b0bb84c48349a956b09b85ebdb7d
|
7
|
+
data.tar.gz: 6be1640d06425163015188be229496775d3b31e25258595acaf95028d940aacb4face70c80ccb4e880ad295d96454900419865d60f7d054dd7fceb390ef3c87e
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Use Ink to help you build themes and plugins for Jekyll.
|
|
7
7
|
|
8
8
|
### Features
|
9
9
|
- Installing Ink plugins is easy.
|
10
|
-
- Users won't need to install or
|
10
|
+
- Users won't need to install or manage plugin assets.
|
11
11
|
- Jekyll will read your plugin's layouts, javascripts, stylesheets and more directly from your gem.
|
12
12
|
- Ink allows users to modify a theme or plugin by adding a modified version to source/_custom directory.
|
13
13
|
|
@@ -30,11 +30,6 @@ Or install it yourself as:
|
|
30
30
|
This is still evolving quite a bit. If you want to use it, you
|
31
31
|
should probably talk to me directly.
|
32
32
|
|
33
|
-
## Roadmap
|
34
|
-
- Write an example theme
|
35
|
-
- Write an example plugin
|
36
|
-
- Add support for compiling and stitching javascript/coffeescript.
|
37
|
-
|
38
33
|
## Contributing
|
39
34
|
|
40
35
|
For right now. Talk to me directly. I'd love help thinking
|
@@ -1,25 +1,13 @@
|
|
1
1
|
```ruby
|
2
2
|
require "octopress-ink"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
assets_path: File.expand_path(File.join(File.dirname(__FILE__), '../assets')),
|
14
|
-
type: "plugin",
|
15
|
-
version: MyPlugin::VERSION,
|
16
|
-
description: "",
|
17
|
-
website: ""
|
18
|
-
}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Register the plugin with Octopress Ink
|
24
|
-
Octopress::Ink.register_plugin(SomePlugin::InkPlugin)
|
4
|
+
Octopress::Ink.add_plugin({
|
5
|
+
name: "My Plugin",
|
6
|
+
slug: "my-plugin",
|
7
|
+
assets_path: File.expand_path(File.join(File.dirname(__FILE__), '../assets')),
|
8
|
+
type: "plugin",
|
9
|
+
version: MyPlugin::VERSION,
|
10
|
+
description: "",
|
11
|
+
website: ""
|
12
|
+
})
|
25
13
|
```
|
@@ -5,20 +5,49 @@ permalink: /guides/creating-a-plugin/
|
|
5
5
|
|
6
6
|
*This guide assumes you have already installed Git, and Ruby 1.9.3 or greater.*
|
7
7
|
|
8
|
-
Octopress Ink plugins are distributed as ruby gems so you'll
|
8
|
+
Octopress Ink plugins are distributed as ruby gems so you'll need to create an account at [RubyGems.org](https://rubygems.org/sign_up) if you haven't yet. Also, be sure to install the [Bundler](http://bundler.io) gem.
|
9
9
|
|
10
|
-
## Creating a
|
10
|
+
## Creating a plugin
|
11
11
|
|
12
|
-
|
12
|
+
Creating an Octopress Ink plugin is very simple. Here's the standard template.
|
13
|
+
|
14
|
+
{% render ./_plugin-template.markdown %}
|
15
|
+
|
16
|
+
The configuration options are as follows.
|
17
|
+
|
18
|
+
{% render ./_configuration.markdown %}
|
19
|
+
|
20
|
+
Next you simply need an `assets` directory at the root of your gem with subdirectories for each asset type you plan to use in your plugin.
|
21
|
+
|
22
|
+
If you have a gem-based plugin which you'd like to convert into an Octopress Ink plugin, this should make it easy for you.
|
23
|
+
|
24
|
+
```sh
|
25
|
+
$ octopress ink init your_gem
|
26
|
+
```
|
27
|
+
|
28
|
+
This will add the asset directories, create a demo site, and print out a plugin template with instructions for how to add it to your gem.
|
29
|
+
|
30
|
+
### Create a plugin from scratch
|
31
|
+
|
32
|
+
To create a new plugin named "Spicy Baconnaise" run:
|
13
33
|
|
14
34
|
```sh
|
15
|
-
octopress ink new
|
35
|
+
$ octopress ink new spicy_baconnaise
|
16
36
|
```
|
17
37
|
|
18
|
-
This
|
38
|
+
This does the following.
|
39
|
+
|
40
|
+
- Creates a new gem using Bundler's gem scaffolding.
|
41
|
+
- It adds `octopress` and `octopress-ink` as dependencies in the gemspec.
|
42
|
+
- An Octopress Ink plugin template is added to `lib/spicy_baconnaise.rb`.
|
43
|
+
- `assets/` contains empty asset directories.
|
44
|
+
- `demo/` contains a blank Jekyll site with your plugin already integrated for easy testing.
|
45
|
+
|
46
|
+
Here's what the new `spicy_baconnaise` directory looks like.
|
19
47
|
|
20
48
|
```
|
21
49
|
assets/
|
50
|
+
docs/
|
22
51
|
files/
|
23
52
|
fonts/
|
24
53
|
images/
|
@@ -28,19 +57,68 @@ assets/
|
|
28
57
|
pages/
|
29
58
|
stylesheets/
|
30
59
|
lib/
|
31
|
-
|
60
|
+
spicy_baconnaise/
|
32
61
|
version.rb
|
33
|
-
|
34
|
-
|
62
|
+
spicy_baconnaise.rb
|
63
|
+
demo/
|
64
|
+
_layouts/
|
65
|
+
_posts/
|
66
|
+
Gemfile
|
67
|
+
index.html
|
68
|
+
spicy_baconnaise.gemspec
|
35
69
|
Gemfile
|
36
70
|
LICENSE.txt
|
37
71
|
Rakefile
|
38
72
|
README.md
|
39
73
|
```
|
40
74
|
|
41
|
-
|
75
|
+
In `lib/spicy_baconnaise.rb` you'll find an Octopress Ink plugin created specifically for your gem.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
require 'lib/version'
|
79
|
+
require 'octopress-ink'
|
80
|
+
|
81
|
+
Octopress::Ink.add_plugin({
|
82
|
+
name: "Spicy Baconnaise"
|
83
|
+
slug: "spicy_baconnaise",
|
84
|
+
assets_path: File.expand_path(File.join(File.dirname(__FILE__), "../assets")),
|
85
|
+
type: "spicy_baconnaise",
|
86
|
+
version: SpicyBaconnaise::Version,
|
87
|
+
description: "",
|
88
|
+
website: ""
|
89
|
+
})
|
90
|
+
```
|
91
|
+
|
92
|
+
Change whatever you want and you are ready to start building your plugin.
|
93
|
+
|
94
|
+
### Building on an existing plugin
|
95
|
+
|
96
|
+
If you're going to convert an existing gem-based Jekyll plugin to use Octopress Ink, from your gem directory run:
|
97
|
+
|
98
|
+
```sh
|
99
|
+
$ octopress ink init .
|
100
|
+
```
|
101
|
+
|
102
|
+
This will add the assets directories and the demo site to your
|
103
|
+
plugin. To finish setting up your plugin, you'll need to add the plugin template to your gem.
|
104
|
+
|
105
|
+
## Plugin assets
|
106
|
+
|
107
|
+
Octopress Ink plugins make it super easy to integrate assets with any Jekyll site. Your plugin should have an assets directory called `assets`. Typically this should be in the root directory of your gem. Inside `assets` there will be folders for each asset type you plan to use.
|
108
|
+
|
109
|
+
Note: Assets are only copied at build time and assets will not overwrite an existing file.
|
110
|
+
|
111
|
+
|
112
|
+
| Asset directory | Description |
|
113
|
+
|:----------------|:------------------------------------------------|
|
114
|
+
| docs | Add documentation files for your plugin here. Users will be able to read it by running `octopress docs`. [read more]({% doc_url plugin-documentation %}) |
|
115
|
+
| fonts | `wingdings.ttf` is copied to `_site/fonts/[plugin_slug]/wingdings.ttf`. |
|
116
|
+
| images | `cat.gif` is copied to `_site/images/[plugin_slug]/cat.gif`. |
|
117
|
+
| javascripts | `boom.js` is combined with all plugin javascripts into a single fingerprinted file. |
|
118
|
+
| stylesheets | `theme.scss` and `print.css` are combined with all plugin stylesheets into a single fingerprinted file. |
|
119
|
+
| includes | Includes are available to users by {% raw %}`{% include [plugin_slug]:some_file.html %}`{% endraw %}. |
|
120
|
+
| layouts | Users can add layouts by setting `layout: [plugin_slug]:some_layout` in a page's YAML front-matter. |
|
121
|
+
| pages | `pages/feed.xml` is processed and copied to `_site/feed.xml` at build time. Setting `permalink: feed/` renders to `_site/feed/index.xml`. |
|
122
|
+
| files | `files/favicon.ico` is copied to `_site/favicon.ico`. |
|
42
123
|
|
43
|
-
- Empty asset directories are added.
|
44
|
-
- The gemspec requires `octopress-ink` as a runtime dependency.
|
45
|
-
- A basic Octopress Ink plugin is added to `lib/cool_plugin.rb`.
|
46
124
|
|
@@ -25,7 +25,7 @@ module Octopress
|
|
25
25
|
shortpath = File.join(Plugins.custom_dir, dir)
|
26
26
|
message += "from: #{shortpath}/#{filename}"
|
27
27
|
end
|
28
|
-
message
|
28
|
+
" - #{message}"
|
29
29
|
end
|
30
30
|
|
31
31
|
def filename
|
@@ -33,7 +33,12 @@ module Octopress
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def disabled?
|
36
|
-
|
36
|
+
is_disabled(base, filename)
|
37
|
+
end
|
38
|
+
|
39
|
+
def is_disabled(base, file)
|
40
|
+
config = @plugin.config['disable']
|
41
|
+
config.include?(base) || config.include?(File.join(base, filename))
|
37
42
|
end
|
38
43
|
|
39
44
|
def path
|
@@ -52,20 +57,12 @@ module Octopress
|
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
|
-
def
|
56
|
-
|
57
|
-
user_dir
|
58
|
-
else
|
59
|
-
plugin_dir
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def destination
|
64
|
-
File.join(dir, file)
|
60
|
+
def read
|
61
|
+
path.read
|
65
62
|
end
|
66
63
|
|
67
64
|
def add
|
68
|
-
Plugins.
|
65
|
+
Plugins.static_files << StaticFile.new(path, destination)
|
69
66
|
end
|
70
67
|
|
71
68
|
# Copy asset to user override directory
|
@@ -82,6 +79,49 @@ module Octopress
|
|
82
79
|
"+ ".green + "#{File.join(target_dir, filename)}"
|
83
80
|
end
|
84
81
|
|
82
|
+
# Remove files from Jekyll's static_files array so it doesn't end up in the
|
83
|
+
# compiled site directory.
|
84
|
+
#
|
85
|
+
def remove_jekyll_asset
|
86
|
+
Ink.site.static_files.clone.each do |sf|
|
87
|
+
if sf.kind_of?(Jekyll::StaticFile) && sf.path == path.to_s
|
88
|
+
Ink.site.static_files.delete(sf)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def source_dir
|
96
|
+
if exists? user_override_path
|
97
|
+
user_dir
|
98
|
+
else
|
99
|
+
plugin_dir
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def destination
|
104
|
+
File.join(dir, file)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Render file through Liquid if it contains YAML front-matter
|
108
|
+
#
|
109
|
+
def render
|
110
|
+
content = path.read
|
111
|
+
|
112
|
+
if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
|
113
|
+
payload = Ink.site.site_payload
|
114
|
+
content = $POSTMATCH
|
115
|
+
payload['page'] = SafeYAML.load($1)
|
116
|
+
render_liquid(content, payload)
|
117
|
+
else
|
118
|
+
content
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def render_liquid(content, payload={})
|
123
|
+
Liquid::Template.parse(content).render!(Ink.payload(payload), {})
|
124
|
+
end
|
85
125
|
|
86
126
|
def plugin_dir
|
87
127
|
File.join root, base
|
@@ -92,11 +132,11 @@ module Octopress
|
|
92
132
|
end
|
93
133
|
|
94
134
|
def user_dir
|
95
|
-
File.join
|
135
|
+
File.join Ink.site.source, Plugins.custom_dir, dir
|
96
136
|
end
|
97
137
|
|
98
138
|
def local_plugin_path
|
99
|
-
File.join
|
139
|
+
File.join Ink.site.source, dir, file
|
100
140
|
end
|
101
141
|
|
102
142
|
def user_override_path
|
@@ -107,17 +147,6 @@ module Octopress
|
|
107
147
|
user_override_path
|
108
148
|
end
|
109
149
|
|
110
|
-
# Remove files from Jekyll's static_files array so it doesn't end up in the
|
111
|
-
# compiled site directory.
|
112
|
-
#
|
113
|
-
def remove_jekyll_asset
|
114
|
-
Plugins.site.static_files.clone.each do |sf|
|
115
|
-
if sf.kind_of?(Jekyll::StaticFile) && sf.path == path.to_s
|
116
|
-
Plugins.site.static_files.delete(sf)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
150
|
def file_check
|
122
151
|
if !exists? plugin_path
|
123
152
|
raise "\nPlugin: #{plugin.name}: Could not find #{File.basename(file)} at #{plugin_path}".red
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Ink
|
3
|
+
module Assets
|
4
|
+
class Coffeescript < Javascript
|
5
|
+
def read
|
6
|
+
@compiled ||= compile
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def compile
|
12
|
+
::CoffeeScript.compile(render)
|
13
|
+
end
|
14
|
+
|
15
|
+
def destination
|
16
|
+
File.join(base, plugin.slug, file.sub(/\.coffee/,'.js'))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -12,25 +12,29 @@ module Octopress
|
|
12
12
|
@file = path
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
# If config plugin config file exists, return contents for list command
|
16
|
+
def info
|
17
|
+
if exists?(config = plugin_path)
|
18
|
+
File.open(config).read.gsub(/^/,' ')
|
19
|
+
else
|
20
|
+
" none"
|
21
|
+
end
|
21
22
|
end
|
22
23
|
|
23
24
|
def read
|
24
25
|
config = {}
|
25
26
|
default = plugin_path
|
26
27
|
if exists? default
|
27
|
-
config =
|
28
|
+
config = SafeYAML.load_file(default) || {}
|
28
29
|
end
|
29
30
|
|
30
31
|
if exists? user_path
|
31
|
-
|
32
|
+
user_config = SafeYAML.load_file(user_path) || {}
|
33
|
+
config = Jekyll::Utils.deep_merge_hashes(config, user_config)
|
32
34
|
end
|
33
35
|
|
36
|
+
config['permalinks'] ||= {}
|
37
|
+
|
34
38
|
config
|
35
39
|
end
|
36
40
|
end
|
@@ -18,25 +18,23 @@ module Octopress
|
|
18
18
|
file_check
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
dir == '.' ? '' : dir
|
23
|
-
end
|
24
|
-
|
25
|
-
def plugin_path
|
21
|
+
def path
|
26
22
|
File.join(plugin_dir, page_dir, file)
|
27
23
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
|
25
|
+
# Add doc page to Jekyll pages
|
26
|
+
#
|
27
|
+
def add
|
28
|
+
if Ink.config['docs_mode']
|
29
|
+
Ink.site.pages << page
|
30
|
+
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
File.join(plugin_dir, page_dir, file)
|
35
|
-
end
|
33
|
+
private
|
36
34
|
|
37
35
|
def page
|
38
36
|
return @page if @page
|
39
|
-
@page = Page.new(
|
37
|
+
@page = Page.new(Ink.site, source_dir, page_dir, file, {'path'=>plugin.docs_base_path})
|
40
38
|
@page.data['layout'] = 'docs'
|
41
39
|
@page.data['plugin'] = {
|
42
40
|
'name' => @plugin.name,
|
@@ -47,13 +45,18 @@ module Octopress
|
|
47
45
|
@page
|
48
46
|
end
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
def page_dir
|
49
|
+
dir == '.' ? '' : dir
|
50
|
+
end
|
51
|
+
|
52
|
+
def plugin_path
|
53
|
+
File.join(plugin_dir, page_dir, file)
|
54
|
+
end
|
55
|
+
|
56
|
+
def source_dir
|
57
|
+
File.join root, base
|
56
58
|
end
|
59
|
+
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
@@ -17,18 +17,20 @@ module Octopress
|
|
17
17
|
file_check
|
18
18
|
end
|
19
19
|
|
20
|
+
def add
|
21
|
+
if !exists?(local_plugin_path) && !Ink.config['docs_mode']
|
22
|
+
Plugins.static_files << StaticFile.new(File.join(source_dir, file), destination)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
20
28
|
def filename
|
21
29
|
@filename
|
22
30
|
end
|
23
31
|
|
24
32
|
def user_dir
|
25
|
-
File.join
|
26
|
-
end
|
27
|
-
|
28
|
-
def add
|
29
|
-
if !exists?(local_plugin_path) && !Ink.config['docs_mode']
|
30
|
-
Plugins.site.static_files << StaticFile.new(File.join(source_dir, file), destination)
|
31
|
-
end
|
33
|
+
File.join Ink.site.source, Plugins.custom_dir, plugin.slug, base
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -8,13 +8,15 @@ module Octopress
|
|
8
8
|
register
|
9
9
|
end
|
10
10
|
|
11
|
+
private
|
12
|
+
|
11
13
|
def register
|
12
14
|
dir = user_dir
|
13
15
|
if !exists?(File.join(dir, file))
|
14
16
|
dir = plugin_dir
|
15
17
|
end
|
16
18
|
|
17
|
-
|
19
|
+
Ink.site.layouts[name] = Jekyll::Layout.new(Ink.site, dir, file)
|
18
20
|
end
|
19
21
|
|
20
22
|
def name
|
@@ -18,6 +18,16 @@ module Octopress
|
|
18
18
|
file_check
|
19
19
|
end
|
20
20
|
|
21
|
+
# Add page to Jekyll pages if no other page has a conflicting destination
|
22
|
+
#
|
23
|
+
def add
|
24
|
+
if page.url && !Ink.config['docs_mode']
|
25
|
+
Ink.site.pages << page unless Helpers::Path.find_page(page)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
21
31
|
def page_dir
|
22
32
|
dir == '.' ? '' : dir
|
23
33
|
end
|
@@ -31,19 +41,11 @@ module Octopress
|
|
31
41
|
end
|
32
42
|
|
33
43
|
def user_dir
|
34
|
-
File.join
|
44
|
+
File.join Ink.site.source, Plugins.custom_dir, plugin.slug, base
|
35
45
|
end
|
36
46
|
|
37
47
|
def page
|
38
|
-
@page ||= Page.new(
|
39
|
-
end
|
40
|
-
|
41
|
-
# Add page to Jekyll pages if no other page has a conflicting destination
|
42
|
-
#
|
43
|
-
def add
|
44
|
-
if page.url && !Ink.config['docs_mode']
|
45
|
-
Plugins.site.pages << page unless Helpers::Path.find_page(page)
|
46
|
-
end
|
48
|
+
@page ||= Page.new(Ink.site, source_dir, page_dir, file, plugin.config)
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
@@ -17,27 +17,38 @@ module Octopress
|
|
17
17
|
"<link href='#{Filters.expand_url(File.join(dir, file))}' media='#{@media}' rel='stylesheet' type='text/css'>"
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
File.join(Plugins.site.source, Plugins.custom_dir, dir, File.dirname(file)).sub /\/\.$/, ''
|
20
|
+
def read
|
21
|
+
@compiled ||= compile
|
23
22
|
end
|
24
23
|
|
25
|
-
def
|
26
|
-
|
24
|
+
def content
|
25
|
+
render
|
26
|
+
end
|
27
|
+
|
28
|
+
def ext
|
29
|
+
path.extname
|
30
|
+
end
|
31
|
+
|
32
|
+
def load_paths
|
33
|
+
[user_load_path, theme_load_path]
|
27
34
|
end
|
28
35
|
|
29
36
|
def disabled?
|
30
|
-
|
31
|
-
plugin.disabled?('stylesheets', filename)
|
37
|
+
is_disabled('sass', filename) || is_disabled('stylesheets', filename)
|
32
38
|
end
|
33
39
|
|
40
|
+
private
|
41
|
+
|
34
42
|
def compile
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
PluginAssetPipeline.compile_sass(self)
|
44
|
+
end
|
45
|
+
|
46
|
+
def user_load_path
|
47
|
+
File.join(Ink.site.source, Plugins.custom_dir, dir, File.dirname(file)).sub /\/\.$/, ''
|
48
|
+
end
|
49
|
+
|
50
|
+
def theme_load_path
|
51
|
+
File.expand_path(File.join(root, base))
|
41
52
|
end
|
42
53
|
|
43
54
|
def user_override_path
|
@@ -58,10 +69,6 @@ module Octopress
|
|
58
69
|
def destination
|
59
70
|
File.join(base, plugin.slug, file.sub(/@(.+?)\./,'.').sub(/s.ss/, 'css'))
|
60
71
|
end
|
61
|
-
|
62
|
-
def add
|
63
|
-
Plugins.site.static_files << StaticFileContent.new(compile, destination)
|
64
|
-
end
|
65
72
|
end
|
66
73
|
end
|
67
74
|
end
|
@@ -23,17 +23,23 @@ module Octopress
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def disabled?
|
26
|
-
|
27
|
-
plugin.disabled?('stylesheets', filename)
|
28
|
-
end
|
29
|
-
|
30
|
-
def destination
|
31
|
-
File.join(base, plugin.slug, file.sub(/@(.+?)\./,'.'))
|
26
|
+
is_disabled('css', filename) || is_disabled('stylesheets', filename)
|
32
27
|
end
|
33
28
|
|
34
29
|
def tag
|
35
30
|
"<link href='#{Filters.expand_url(File.join(dir, file))}' media='#{media}' rel='stylesheet' type='text/css'>"
|
36
31
|
end
|
32
|
+
|
33
|
+
def add
|
34
|
+
Plugins.add_css_tag tag
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def destination
|
41
|
+
File.join(base, plugin.slug, file.sub(/@(.+?)\./,'.'))
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
39
45
|
end
|
data/lib/octopress-ink/assets.rb
CHANGED
@@ -2,17 +2,14 @@ module Octopress
|
|
2
2
|
module Ink
|
3
3
|
module Assets
|
4
4
|
autoload :Asset, 'octopress-ink/assets/asset'
|
5
|
-
autoload :LocalAsset, 'octopress-ink/assets/local_asset'
|
6
5
|
autoload :Config, 'octopress-ink/assets/config'
|
7
6
|
autoload :FileAsset, 'octopress-ink/assets/file'
|
8
7
|
autoload :PageAsset, 'octopress-ink/assets/page'
|
9
8
|
autoload :DocPageAsset, 'octopress-ink/assets/doc_page'
|
10
9
|
autoload :Javascript, 'octopress-ink/assets/javascript'
|
10
|
+
autoload :Coffeescript, 'octopress-ink/assets/coffeescript'
|
11
11
|
autoload :Stylesheet, 'octopress-ink/assets/stylesheet'
|
12
|
-
autoload :LocalStylesheet, 'octopress-ink/assets/local_stylesheet'
|
13
|
-
autoload :LocalJavascript, 'octopress-ink/assets/local_javascript'
|
14
12
|
autoload :Sass, 'octopress-ink/assets/sass'
|
15
|
-
autoload :LocalSass, 'octopress-ink/assets/local_sass'
|
16
13
|
autoload :Include, 'octopress-ink/assets/include'
|
17
14
|
autoload :Layout, 'octopress-ink/assets/layout'
|
18
15
|
end
|