octopress-ink 1.0.0.rc.11 → 1.0.0.rc.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +12 -3
- data/assets/docs/creating-a-plugin.markdown +85 -23
- data/assets/docs/plugin-reference.markdown +1 -1
- data/assets/docs/working-with-plugins.markdown +188 -0
- data/lib/octopress-ink.rb +40 -93
- data/lib/octopress-ink/assets/asset.rb +8 -10
- data/lib/octopress-ink/assets/doc_page.rb +3 -6
- data/lib/octopress-ink/assets/file.rb +2 -2
- data/lib/octopress-ink/assets/layout.rb +1 -1
- data/lib/octopress-ink/assets/page.rb +17 -4
- data/lib/octopress-ink/assets/sass.rb +1 -1
- data/lib/octopress-ink/commands/helpers.rb +1 -1
- data/lib/octopress-ink/commands/list.rb +1 -1
- data/lib/octopress-ink/commands/new.rb +1 -4
- data/lib/octopress-ink/configuration.rb +10 -27
- data/lib/octopress-ink/jekyll/hooks.rb +23 -149
- data/lib/octopress-ink/jekyll/page.rb +12 -0
- data/lib/octopress-ink/plugin.rb +1 -1
- data/lib/octopress-ink/plugin_asset_pipeline.rb +4 -5
- data/lib/octopress-ink/plugins.rb +5 -5
- data/lib/octopress-ink/tags.rb +0 -11
- data/lib/octopress-ink/version.rb +1 -1
- data/octopress-ink.gemspec +7 -5
- data/test/.clash.yml +46 -0
- data/test/Gemfile +1 -3
- data/test/_config.yml +7 -6
- data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/awesome-sauce/plugin-media-test.css +0 -0
- data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/awesome-sauce/plugin-test.css +0 -0
- data/test/_expected/combine_css_false/theme/main.css +2 -0
- data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/theme/theme-media-test.css +0 -0
- data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/theme/theme-test.css +0 -0
- data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/theme/theme-test2.css +0 -0
- data/test/{combine_js_false/javascripts → _expected/combine_js_false}/theme/bar.js +0 -0
- data/test/{combine_js_false/javascripts → _expected/combine_js_false}/theme/blah.js +0 -0
- data/test/{combine_js_false/javascripts → _expected/combine_js_false}/theme/foo.js +0 -0
- data/test/{compress_false → _expected/compress_false}/javascripts/all-.js +0 -0
- data/test/{compress_false → _expected/compress_false}/stylesheets/all-.css +1 -1
- data/test/{compress_false → _expected/compress_false}/stylesheets/print-.css +0 -0
- data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/layouts/default.html +0 -0
- data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/layouts/test.html +0 -0
- data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/disable-test.html +0 -0
- data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/four.xml +0 -0
- data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/one.xml +0 -0
- data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/three.md +1 -1
- data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/two.md +0 -0
- data/test/{plugins/test-theme → _expected/copy_test}/config.yml +3 -0
- data/test/{copy_test/_copy → _expected/copy_test}/files/disabled-file.txt +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/files/favicon.ico +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/files/favicon.png +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/files/test.html +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/fonts/font-one.otf +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/fonts/font-two.ttf +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/includes/bar.html +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/includes/greet.html +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/javascripts/bar.js +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/javascripts/blah.coffee +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/javascripts/disable-this.js +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/javascripts/foo.js +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/layouts/default.html +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/layouts/test.html +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/pages/disable-test.html +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/pages/four.xml +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/pages/one.xml +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/pages/three.md +1 -1
- data/test/{copy_test/_copy → _expected/copy_test}/pages/two.md +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/_colors.scss +0 -0
- data/test/_expected/copy_test/stylesheets/disable-this.css +1 -0
- data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/disable.sass +0 -0
- data/test/_expected/copy_test/stylesheets/main.scss +5 -0
- data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/theme-media-test@print.css +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/theme-test.css +0 -0
- data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/theme-test2.css +0 -0
- data/test/{expected → _expected/site}/2014/02/01/test-post.html +0 -0
- data/test/{expected → _expected/site}/2014/02/02/test-post-2.html +0 -0
- data/test/{expected → _expected/site}/favicon.ico +0 -0
- data/test/{expected → _expected/site}/favicon.png +0 -0
- data/test/{expected → _expected/site}/four/index.xml +0 -0
- data/test/_expected/site/index.html +15 -0
- data/test/{expected → _expected/site}/javascripts/all-.js +0 -0
- data/test/{expected → _expected/site}/robots.txt +0 -0
- data/test/_expected/site/stylesheets/all-.css +1 -0
- data/test/{expected → _expected/site}/stylesheets/print-.css +0 -0
- data/test/{expected → _expected/site}/test.html +0 -0
- data/test/{expected → _expected/site}/test_config/plugin_config.html +0 -0
- data/test/{expected → _expected/site}/test_config/theme_config.html +0 -0
- data/test/{expected → _expected/site}/test_layouts/local.html +0 -0
- data/test/{expected → _expected/site}/test_layouts/plugin_layout.html +0 -0
- data/test/{expected → _expected/site}/test_layouts/test_markdown.html +0 -0
- data/test/{expected → _expected/site}/test_layouts/theme.html +0 -0
- data/test/{expected → _expected/site}/test_layouts/theme_override.html +0 -0
- data/test/{expected → _expected/site}/test_pages/feed/index.xml +0 -0
- data/test/{expected → _expected/site}/test_pages/plugin_page.html +0 -0
- data/test/{expected → _expected/site}/test_pages/plugin_page_override.html +0 -0
- data/test/{expected → _expected/site}/test_pages/theme_page.html +0 -0
- data/test/_expected/site/test_pages/three.html +13 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/.gitignore +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/Gemfile +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/LICENSE.txt +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/README.md +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/Rakefile +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/assets/config.yml +0 -0
- data/test/_expected/test-plugin-expected/demo/Gemfile +3 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/demo/_config.yml +0 -0
- data/test/{plugins/awesome-sauce/docs → _expected/test-plugin-expected/demo}/index.html +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/lib/test-plugin.rb +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/lib/test-plugin/version.rb +0 -0
- data/test/{test-plugin-expected → _expected/test-plugin-expected}/test-plugin.gemspec +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/.gitignore +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/Gemfile +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/LICENSE.txt +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/README.md +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/Rakefile +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/assets/config.yml +0 -0
- data/test/_expected/test-theme-expected/demo/Gemfile +3 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/demo/_config.yml +0 -0
- data/test/{test-plugin-expected → _expected/test-theme-expected}/demo/index.html +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/lib/test-theme.rb +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/lib/test-theme/version.rb +0 -0
- data/test/{test-theme-expected → _expected/test-theme-expected}/test-theme.gemspec +0 -0
- data/test/{uglify_js_false/javascripts → _expected/uglify_js_false}/all-.js +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/config.yml +0 -0
- data/test/{test-theme-expected/demo → _ink_plugins/awesome-sauce/docs}/index.html +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/files/robots.txt +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/includes/some-include.html +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/layouts/test-layout.html +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/pages/a.html +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/pages/b.html +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/plugin.rb +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/stylesheets/plugin-media-test@print.css +0 -0
- data/test/{plugins → _ink_plugins}/awesome-sauce/stylesheets/plugin-test.css +0 -0
- data/test/{copy_test/_copy → _ink_plugins/test-theme}/config.yml +3 -0
- data/test/{plugins → _ink_plugins}/test-theme/files/disabled-file.txt +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/files/favicon.ico +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/files/favicon.png +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/files/test.html +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/fonts/font-one.otf +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/fonts/font-two.ttf +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/includes/bar.html +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/includes/greet.html +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/javascripts/bar.js +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/javascripts/blah.coffee +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/javascripts/disable-this.js +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/javascripts/foo.js +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/layouts/default.html +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/layouts/test.html +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/pages/disable-test.html +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/pages/four.xml +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/pages/one.xml +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/pages/three.md +1 -1
- data/test/{plugins → _ink_plugins}/test-theme/pages/two.md +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/plugin.rb +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/stylesheets/_colors.scss +0 -0
- data/test/_ink_plugins/test-theme/stylesheets/disable-this.css +1 -0
- data/test/{plugins → _ink_plugins}/test-theme/stylesheets/disable.sass +0 -0
- data/test/_ink_plugins/test-theme/stylesheets/main.scss +5 -0
- data/test/{plugins → _ink_plugins}/test-theme/stylesheets/theme-media-test@print.css +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/stylesheets/theme-test.css +0 -0
- data/test/{plugins → _ink_plugins}/test-theme/stylesheets/theme-test2.css +0 -0
- data/test/_templates/page +4 -0
- data/test/_templates/post +5 -0
- data/test/source/_layouts/local.html +2 -0
- data/test/source/_plugins/loader.rb +2 -2
- data/test/source/_plugins/theme/stylesheets/_colors.sass +1 -1
- data/test/source/index.html +3 -15
- metadata +309 -351
- data/lib/octopress-ink/filters.rb +0 -111
- data/lib/octopress-ink/generators/plugin_assets.rb +0 -13
- data/lib/octopress-ink/helpers.rb +0 -10
- data/lib/octopress-ink/helpers/conditional.rb +0 -24
- data/lib/octopress-ink/helpers/content_for.rb +0 -32
- data/lib/octopress-ink/helpers/path.rb +0 -74
- data/lib/octopress-ink/helpers/var.rb +0 -105
- data/lib/octopress-ink/tags/abort.rb +0 -22
- data/lib/octopress-ink/tags/assign.rb +0 -33
- data/lib/octopress-ink/tags/capture.rb +0 -38
- data/lib/octopress-ink/tags/content_for.rb +0 -24
- data/lib/octopress-ink/tags/filter.rb +0 -24
- data/lib/octopress-ink/tags/include.rb +0 -53
- data/lib/octopress-ink/tags/line_comment.rb +0 -10
- data/lib/octopress-ink/tags/render.rb +0 -85
- data/lib/octopress-ink/tags/return.rb +0 -19
- data/lib/octopress-ink/tags/wrap.rb +0 -81
- data/lib/octopress-ink/tags/yield.rb +0 -36
- data/lib/octopress-ink/utils.rb +0 -42
- data/test/combine_css_false/stylesheets/theme/main.css +0 -2
- data/test/copy_test/_copy/stylesheets/disable-this.css +0 -1
- data/test/copy_test/_copy/stylesheets/main.scss +0 -5
- data/test/expected/index.html +0 -71
- data/test/expected/stylesheets/all-.css +0 -1
- data/test/expected/test_pages/three.html +0 -1
- data/test/expected/test_tags/abort_false.html +0 -1
- data/test/expected/test_tags/assign.html +0 -23
- data/test/expected/test_tags/capture.html +0 -21
- data/test/expected/test_tags/content_for.html +0 -1
- data/test/expected/test_tags/filter.html +0 -4
- data/test/expected/test_tags/include.html +0 -33
- data/test/expected/test_tags/render.html +0 -34
- data/test/expected/test_tags/return.html +0 -23
- data/test/expected/test_tags/wrap.html +0 -29
- data/test/plugins/test-theme/stylesheets/disable-this.css +0 -1
- data/test/plugins/test-theme/stylesheets/main.scss +0 -5
- data/test/source/.gitignore +0 -1
- data/test/source/test_render/_f.html +0 -1
- data/test/source/test_render/_var.html +0 -1
- data/test/source/test_tags/_test_render.md +0 -4
- data/test/source/test_tags/abort_false.html +0 -5
- data/test/source/test_tags/abort_posts.html +0 -5
- data/test/source/test_tags/abort_true.html +0 -5
- data/test/source/test_tags/assign.html +0 -26
- data/test/source/test_tags/capture.html +0 -31
- data/test/source/test_tags/content_for.html +0 -7
- data/test/source/test_tags/filter.html +0 -6
- data/test/source/test_tags/include.html +0 -36
- data/test/source/test_tags/render.html +0 -36
- data/test/source/test_tags/return.html +0 -30
- data/test/source/test_tags/wrap.html +0 -32
- data/test/test-plugin-expected/demo/Gemfile +0 -6
- data/test/test-theme-expected/demo/Gemfile +0 -6
- data/test/test.rb +0 -110
- data/test/test_suite.rb +0 -161
@@ -68,6 +68,8 @@ module Octopress
|
|
68
68
|
# Copy asset to user override directory
|
69
69
|
#
|
70
70
|
def copy(target_dir)
|
71
|
+
return unless exists? plugin_path
|
72
|
+
|
71
73
|
if target_dir
|
72
74
|
target_dir = File.join(target_dir, base)
|
73
75
|
else
|
@@ -83,9 +85,9 @@ module Octopress
|
|
83
85
|
# compiled site directory.
|
84
86
|
#
|
85
87
|
def remove_jekyll_asset
|
86
|
-
|
88
|
+
Octopress.site.static_files.clone.each do |sf|
|
87
89
|
if sf.kind_of?(Jekyll::StaticFile) && sf.path == path.to_s
|
88
|
-
|
90
|
+
Octopress.site.static_files.delete(sf)
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
@@ -110,19 +112,15 @@ module Octopress
|
|
110
112
|
content = path.read
|
111
113
|
|
112
114
|
if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
|
113
|
-
payload =
|
115
|
+
payload = Octopress.site.site_payload
|
114
116
|
content = $POSTMATCH
|
115
117
|
payload['page'] = SafeYAML.load($1)
|
116
|
-
|
118
|
+
Liquid::Template.parse(content).render!(payload)
|
117
119
|
else
|
118
120
|
content
|
119
121
|
end
|
120
122
|
end
|
121
123
|
|
122
|
-
def render_liquid(content, payload={})
|
123
|
-
Liquid::Template.parse(content).render!(Ink.payload(payload), {})
|
124
|
-
end
|
125
|
-
|
126
124
|
def plugin_dir
|
127
125
|
File.join root, base
|
128
126
|
end
|
@@ -132,11 +130,11 @@ module Octopress
|
|
132
130
|
end
|
133
131
|
|
134
132
|
def user_dir
|
135
|
-
File.join
|
133
|
+
File.join Octopress.site.source, Plugins.custom_dir, dir
|
136
134
|
end
|
137
135
|
|
138
136
|
def local_plugin_path
|
139
|
-
File.join
|
137
|
+
File.join Octopress.site.source, dir, file
|
140
138
|
end
|
141
139
|
|
142
140
|
def user_override_path
|
@@ -1,6 +1,3 @@
|
|
1
|
-
# These are files which need to be in added to the root of the site directory
|
2
|
-
# Use root assets for files like robots.text or favicon.ico
|
3
|
-
|
4
1
|
module Octopress
|
5
2
|
module Ink
|
6
3
|
module Assets
|
@@ -25,8 +22,8 @@ module Octopress
|
|
25
22
|
# Add doc page to Jekyll pages
|
26
23
|
#
|
27
24
|
def add
|
28
|
-
if
|
29
|
-
|
25
|
+
if Octopress.config['docs_mode']
|
26
|
+
Octopress.site.pages << page
|
30
27
|
end
|
31
28
|
end
|
32
29
|
|
@@ -34,7 +31,7 @@ module Octopress
|
|
34
31
|
|
35
32
|
def page
|
36
33
|
return @page if @page
|
37
|
-
@page = Page.new(
|
34
|
+
@page = Page.new(Octopress.site, source_dir, page_dir, file, {'path'=>plugin.docs_base_path})
|
38
35
|
@page.data['layout'] = 'docs'
|
39
36
|
@page.data['plugin'] = {
|
40
37
|
'name' => @plugin.name,
|
@@ -18,7 +18,7 @@ module Octopress
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def add
|
21
|
-
if !exists?(local_plugin_path) && !
|
21
|
+
if !exists?(local_plugin_path) && !Octopress.config['docs_mode']
|
22
22
|
Plugins.static_files << StaticFile.new(File.join(source_dir, file), destination)
|
23
23
|
end
|
24
24
|
end
|
@@ -30,7 +30,7 @@ module Octopress
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def user_dir
|
33
|
-
File.join
|
33
|
+
File.join Octopress.site.source, Plugins.custom_dir, plugin.slug, base
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -21,13 +21,26 @@ module Octopress
|
|
21
21
|
# Add page to Jekyll pages if no other page has a conflicting destination
|
22
22
|
#
|
23
23
|
def add
|
24
|
-
if page.url && !
|
25
|
-
|
24
|
+
if page.url && !Octopress.config['docs_mode']
|
25
|
+
Octopress.site.pages << page unless find_page(page)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def find_page(page)
|
30
|
+
site_dir = Octopress.site.config['destination']
|
31
|
+
dest = page.destination(site_dir)
|
32
|
+
|
33
|
+
Octopress.site.pages.clone.each do |p|
|
34
|
+
return p if p.destination(site_dir) == dest
|
35
|
+
end
|
36
|
+
return false
|
37
|
+
end
|
38
|
+
|
29
39
|
def page
|
30
|
-
@page
|
40
|
+
unless @page
|
41
|
+
@page = Page.new(Octopress.site, source_dir, page_dir, file, plugin.config)
|
42
|
+
end
|
43
|
+
@page
|
31
44
|
end
|
32
45
|
|
33
46
|
def info
|
@@ -50,7 +63,7 @@ module Octopress
|
|
50
63
|
end
|
51
64
|
|
52
65
|
def user_dir
|
53
|
-
File.join
|
66
|
+
File.join Octopress.site.source, Plugins.custom_dir, plugin.slug, base
|
54
67
|
end
|
55
68
|
|
56
69
|
end
|
@@ -51,7 +51,7 @@ module Octopress
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def user_load_path
|
54
|
-
File.join(
|
54
|
+
File.join(Octopress.site.source, Plugins.custom_dir, dir, File.dirname(file)).sub /\/\.$/, ''
|
55
55
|
end
|
56
56
|
|
57
57
|
def theme_load_path
|
@@ -16,7 +16,7 @@ module Octopress
|
|
16
16
|
c.option "images", "--images", "#{action} only images"
|
17
17
|
c.option "fonts", "--fonts", "#{action} only fonts"
|
18
18
|
c.option "files", "--files", "#{action} only files"
|
19
|
-
c.option "config", "--config
|
19
|
+
c.option "config", "--config", "#{action} only configuration file."
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -8,7 +8,7 @@ module Octopress
|
|
8
8
|
c.description "Get a list of installed octopress ink plugins for this site."
|
9
9
|
c.option "all", "--all", "List all plugins and their assets."
|
10
10
|
CommandHelpers.add_asset_options(c, 'List')
|
11
|
-
c.option "docs", "--docs", "List
|
11
|
+
c.option "docs", "--docs", "List documentation pages."
|
12
12
|
|
13
13
|
c.action do |args, options|
|
14
14
|
if args.empty?
|
@@ -190,10 +190,7 @@ website: ""
|
|
190
190
|
gemfile_content = <<-HERE
|
191
191
|
source 'https://rubygems.org'
|
192
192
|
|
193
|
-
|
194
|
-
gem 'octopress'
|
195
|
-
gem '#{@settings[:name]}', path: '../'
|
196
|
-
end
|
193
|
+
gemspec path: '../'
|
197
194
|
HERE
|
198
195
|
|
199
196
|
write(gemfile_path, gemfile_content)
|
@@ -2,6 +2,16 @@
|
|
2
2
|
require 'yaml'
|
3
3
|
|
4
4
|
module Octopress
|
5
|
+
# Override Octopress configuration to Merge with Ink's defaults
|
6
|
+
#
|
7
|
+
class << self
|
8
|
+
alias_method :orig_config, :config
|
9
|
+
|
10
|
+
def config(options={})
|
11
|
+
Jekyll::Utils.deep_merge_hashes(Ink::Configuration::DEFAULTS, orig_config(options))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
module Ink
|
6
16
|
module Configuration
|
7
17
|
DEFAULTS = {
|
@@ -13,34 +23,7 @@ module Octopress
|
|
13
23
|
'uglifier' => {},
|
14
24
|
'disable' => [],
|
15
25
|
'date_format' => 'ordinal',
|
16
|
-
|
17
|
-
'linkpost' => {
|
18
|
-
'marker' => "→",
|
19
|
-
'marker_position' => 'after'
|
20
|
-
},
|
21
|
-
|
22
|
-
'post' => {
|
23
|
-
'marker' => false,
|
24
|
-
'marker_position' => 'before'
|
25
|
-
}
|
26
26
|
}
|
27
|
-
|
28
|
-
def self.config
|
29
|
-
@config ||= Jekyll::Utils.deep_merge_hashes(DEFAULTS, octopress_config)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.octopress_config
|
33
|
-
if defined? Octopress.config
|
34
|
-
Octopress.config
|
35
|
-
else
|
36
|
-
file = '_octopress.yml'
|
37
|
-
if File.exist?(file)
|
38
|
-
SafeYAML.load_file(file) || {}
|
39
|
-
else
|
40
|
-
{}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
27
|
end
|
45
28
|
end
|
46
29
|
end
|
@@ -1,163 +1,37 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
|
4
|
-
alias_method :read_yaml_orig, :read_yaml
|
1
|
+
module Octopress
|
2
|
+
module Ink
|
3
|
+
class SiteHook < Hooks::Site
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
do_layout_orig(payload, layouts)
|
12
|
-
end
|
13
|
-
|
14
|
-
def read_yaml(base, name, opts = {})
|
15
|
-
read_yaml_orig(base, name, opts)
|
16
|
-
|
17
|
-
if type == :post
|
18
|
-
self.data.merge! add_post_vars(self.data)
|
5
|
+
def post_read(site)
|
6
|
+
Octopress.site = site
|
7
|
+
Ink::Plugins.register
|
8
|
+
Ink::Plugins.add_files
|
19
9
|
end
|
20
10
|
|
11
|
+
def merge_payload(payload, site)
|
12
|
+
config = Ink::Plugins.config
|
21
13
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
new_payload = {
|
15
|
+
'plugins' => config['plugins'],
|
16
|
+
'theme' => config['theme'],
|
17
|
+
'octopress' => {
|
18
|
+
'version' => Ink.version
|
19
|
+
}
|
20
|
+
}
|
28
21
|
|
29
|
-
|
30
|
-
|
22
|
+
if Octopress.config['docs_mode']
|
23
|
+
new_payload['doc_pages'] = Ink::Plugins.doc_pages
|
31
24
|
end
|
32
|
-
end
|
33
|
-
|
34
|
-
if self.data['updated']
|
35
|
-
text = format_date(self.data['updated'])
|
36
|
-
xmlschema = datetime(self.data['updated']).xmlschema
|
37
|
-
html = date_html(text, xmlschema)
|
38
25
|
|
39
|
-
|
40
|
-
self.data['updated_date_html'] = html
|
26
|
+
new_payload
|
41
27
|
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def add_post_vars(data)
|
45
|
-
linkpost = data['external-url']
|
46
|
-
|
47
|
-
if linkpost
|
48
|
-
config = Octopress::Ink.config['linkpost']
|
49
|
-
else
|
50
|
-
config = Octopress::Ink.config['post']
|
51
|
-
end
|
52
|
-
|
53
|
-
if extract_excerpt.to_s.strip != content.strip
|
54
|
-
excerpted = true
|
55
|
-
end
|
56
|
-
|
57
|
-
if Octopress::Ink.config['titlecase']
|
58
|
-
Octopress::Utils.titlecase!(data['title'])
|
59
|
-
end
|
60
|
-
|
61
|
-
{
|
62
|
-
'title_text' => title_text(config, data['title']),
|
63
|
-
'title_html' => title_html(config, data['title']),
|
64
|
-
'title_url' => linkpost || self.url,
|
65
|
-
'linkpost' => !linkpost.nil?,
|
66
|
-
'excerpted' => excerpted
|
67
|
-
}
|
68
|
-
end
|
69
|
-
|
70
|
-
def date_html(text, xmlschema)
|
71
|
-
"<time class='entry-date' datetime='#{ xmlschema }' pubdate>#{ text }</time>"
|
72
|
-
end
|
73
|
-
|
74
|
-
def format_date(date)
|
75
|
-
format = Octopress::Ink.config['date_format']
|
76
|
-
date = datetime(date)
|
77
|
-
if format == 'ordinal'
|
78
|
-
ordinalize(date)
|
79
|
-
else
|
80
|
-
date.strftime(format)
|
81
|
-
end
|
82
|
-
end
|
83
28
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
d = "<span class='date-month'>#{date.strftime('%b')}</span> "
|
88
|
-
d += "<span class='date-day'>#{date.strftime('%-d')}</span>"
|
89
|
-
d += "<span class='date-suffix'>#{ordinal_suffix(date)}</span>, "
|
90
|
-
d += "<span class='date-year'>#{date.strftime('%Y')}</span>"
|
91
|
-
end
|
92
|
-
|
93
|
-
# Returns an ordinal number. 13 -> 13th, 21 -> 21st etc.
|
94
|
-
def ordinal_suffix(date)
|
95
|
-
number = date.strftime('%e').to_i
|
96
|
-
if (11..13).include?(number % 100)
|
97
|
-
"th"
|
98
|
-
else
|
99
|
-
case number % 10
|
100
|
-
when 1; "st"
|
101
|
-
when 2; "nd"
|
102
|
-
when 3; "rd"
|
103
|
-
else "th"
|
29
|
+
def post_write(site)
|
30
|
+
Octopress::Ink::Plugins.static_files.each do |f|
|
31
|
+
f.write(site.config['destination'])
|
104
32
|
end
|
105
33
|
end
|
106
34
|
end
|
107
|
-
|
108
|
-
def datetime(input)
|
109
|
-
case input
|
110
|
-
when Time
|
111
|
-
input
|
112
|
-
when String
|
113
|
-
Time.parse(input) rescue Time.at(input.to_i)
|
114
|
-
when Numeric
|
115
|
-
Time.at(input)
|
116
|
-
else
|
117
|
-
raise "Invalid Date:", "'#{input}' is not a valid datetime."
|
118
|
-
exit(1)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
def title_html(config, title)
|
124
|
-
title = Octopress::Ink::Filters.unorphan(title)
|
125
|
-
|
126
|
-
return title if !config['marker']
|
127
|
-
|
128
|
-
marker = "<span class='post-marker post-marker-#{config['marker_position']}'>#{config['marker']}</span>"
|
129
|
-
position = config['marker_position']
|
130
|
-
|
131
|
-
if config['marker_position'] == 'before'
|
132
|
-
title = "#{marker} #{title}"
|
133
|
-
else
|
134
|
-
title = "#{title} #{marker}"
|
135
|
-
end
|
136
|
-
|
137
|
-
title
|
138
|
-
end
|
139
|
-
|
140
|
-
def title_text(config, title)
|
141
|
-
return title if !config['marker']
|
142
|
-
position = config['marker_position']
|
143
|
-
|
144
|
-
if config['marker_position'] == 'before'
|
145
|
-
"#{config['marker']} #{title}"
|
146
|
-
else
|
147
|
-
"#{title} #{config['marker']}"
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
class Site
|
153
|
-
alias_method :write_orig, :write
|
154
|
-
# Called after write
|
155
|
-
|
156
|
-
def write
|
157
|
-
write_orig
|
158
|
-
Octopress::Ink::Plugins.static_files.each do |f|
|
159
|
-
f.write(config['destination'])
|
160
|
-
end
|
161
|
-
end
|
162
35
|
end
|
163
36
|
end
|
37
|
+
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Octopress
|
2
2
|
module Ink
|
3
3
|
class Page < Jekyll::Page
|
4
|
+
include Jekyll::Convertible
|
4
5
|
|
5
6
|
# Purpose: Configs can override a page's permalink
|
6
7
|
#
|
@@ -12,6 +13,11 @@ module Octopress
|
|
12
13
|
def initialize(site, base, dir, name, config={})
|
13
14
|
@config = config
|
14
15
|
super(site, base, dir, name)
|
16
|
+
post_init if respond_to?(:post_init)
|
17
|
+
end
|
18
|
+
|
19
|
+
def hooks
|
20
|
+
self.site.page_hooks
|
15
21
|
end
|
16
22
|
|
17
23
|
def destination(dest)
|
@@ -24,6 +30,12 @@ module Octopress
|
|
24
30
|
@dest
|
25
31
|
end
|
26
32
|
|
33
|
+
def relative_asset_path
|
34
|
+
site_source = Pathname.new Octopress.site.source
|
35
|
+
page_source = Pathname.new @base
|
36
|
+
page_source.relative_path_from(site_source).to_s
|
37
|
+
end
|
38
|
+
|
27
39
|
# Allow pages to read url from plugin configuration
|
28
40
|
#
|
29
41
|
def url
|