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.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +12 -3
  5. data/assets/docs/creating-a-plugin.markdown +85 -23
  6. data/assets/docs/plugin-reference.markdown +1 -1
  7. data/assets/docs/working-with-plugins.markdown +188 -0
  8. data/lib/octopress-ink.rb +40 -93
  9. data/lib/octopress-ink/assets/asset.rb +8 -10
  10. data/lib/octopress-ink/assets/doc_page.rb +3 -6
  11. data/lib/octopress-ink/assets/file.rb +2 -2
  12. data/lib/octopress-ink/assets/layout.rb +1 -1
  13. data/lib/octopress-ink/assets/page.rb +17 -4
  14. data/lib/octopress-ink/assets/sass.rb +1 -1
  15. data/lib/octopress-ink/commands/helpers.rb +1 -1
  16. data/lib/octopress-ink/commands/list.rb +1 -1
  17. data/lib/octopress-ink/commands/new.rb +1 -4
  18. data/lib/octopress-ink/configuration.rb +10 -27
  19. data/lib/octopress-ink/jekyll/hooks.rb +23 -149
  20. data/lib/octopress-ink/jekyll/page.rb +12 -0
  21. data/lib/octopress-ink/plugin.rb +1 -1
  22. data/lib/octopress-ink/plugin_asset_pipeline.rb +4 -5
  23. data/lib/octopress-ink/plugins.rb +5 -5
  24. data/lib/octopress-ink/tags.rb +0 -11
  25. data/lib/octopress-ink/version.rb +1 -1
  26. data/octopress-ink.gemspec +7 -5
  27. data/test/.clash.yml +46 -0
  28. data/test/Gemfile +1 -3
  29. data/test/_config.yml +7 -6
  30. data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/awesome-sauce/plugin-media-test.css +0 -0
  31. data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/awesome-sauce/plugin-test.css +0 -0
  32. data/test/_expected/combine_css_false/theme/main.css +2 -0
  33. data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/theme/theme-media-test.css +0 -0
  34. data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/theme/theme-test.css +0 -0
  35. data/test/{combine_css_false/stylesheets → _expected/combine_css_false}/theme/theme-test2.css +0 -0
  36. data/test/{combine_js_false/javascripts → _expected/combine_js_false}/theme/bar.js +0 -0
  37. data/test/{combine_js_false/javascripts → _expected/combine_js_false}/theme/blah.js +0 -0
  38. data/test/{combine_js_false/javascripts → _expected/combine_js_false}/theme/foo.js +0 -0
  39. data/test/{compress_false → _expected/compress_false}/javascripts/all-.js +0 -0
  40. data/test/{compress_false → _expected/compress_false}/stylesheets/all-.css +1 -1
  41. data/test/{compress_false → _expected/compress_false}/stylesheets/print-.css +0 -0
  42. data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/layouts/default.html +0 -0
  43. data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/layouts/test.html +0 -0
  44. data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/disable-test.html +0 -0
  45. data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/four.xml +0 -0
  46. data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/one.xml +0 -0
  47. data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/three.md +1 -1
  48. data/test/{copy_layouts_pages/_copy → _expected/copy_layouts_pages}/pages/two.md +0 -0
  49. data/test/{plugins/test-theme → _expected/copy_test}/config.yml +3 -0
  50. data/test/{copy_test/_copy → _expected/copy_test}/files/disabled-file.txt +0 -0
  51. data/test/{copy_test/_copy → _expected/copy_test}/files/favicon.ico +0 -0
  52. data/test/{copy_test/_copy → _expected/copy_test}/files/favicon.png +0 -0
  53. data/test/{copy_test/_copy → _expected/copy_test}/files/test.html +0 -0
  54. data/test/{copy_test/_copy → _expected/copy_test}/fonts/font-one.otf +0 -0
  55. data/test/{copy_test/_copy → _expected/copy_test}/fonts/font-two.ttf +0 -0
  56. data/test/{copy_test/_copy → _expected/copy_test}/includes/bar.html +0 -0
  57. data/test/{copy_test/_copy → _expected/copy_test}/includes/greet.html +0 -0
  58. data/test/{copy_test/_copy → _expected/copy_test}/javascripts/bar.js +0 -0
  59. data/test/{copy_test/_copy → _expected/copy_test}/javascripts/blah.coffee +0 -0
  60. data/test/{copy_test/_copy → _expected/copy_test}/javascripts/disable-this.js +0 -0
  61. data/test/{copy_test/_copy → _expected/copy_test}/javascripts/foo.js +0 -0
  62. data/test/{copy_test/_copy → _expected/copy_test}/layouts/default.html +0 -0
  63. data/test/{copy_test/_copy → _expected/copy_test}/layouts/test.html +0 -0
  64. data/test/{copy_test/_copy → _expected/copy_test}/pages/disable-test.html +0 -0
  65. data/test/{copy_test/_copy → _expected/copy_test}/pages/four.xml +0 -0
  66. data/test/{copy_test/_copy → _expected/copy_test}/pages/one.xml +0 -0
  67. data/test/{copy_test/_copy → _expected/copy_test}/pages/three.md +1 -1
  68. data/test/{copy_test/_copy → _expected/copy_test}/pages/two.md +0 -0
  69. data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/_colors.scss +0 -0
  70. data/test/_expected/copy_test/stylesheets/disable-this.css +1 -0
  71. data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/disable.sass +0 -0
  72. data/test/_expected/copy_test/stylesheets/main.scss +5 -0
  73. data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/theme-media-test@print.css +0 -0
  74. data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/theme-test.css +0 -0
  75. data/test/{copy_test/_copy → _expected/copy_test}/stylesheets/theme-test2.css +0 -0
  76. data/test/{expected → _expected/site}/2014/02/01/test-post.html +0 -0
  77. data/test/{expected → _expected/site}/2014/02/02/test-post-2.html +0 -0
  78. data/test/{expected → _expected/site}/favicon.ico +0 -0
  79. data/test/{expected → _expected/site}/favicon.png +0 -0
  80. data/test/{expected → _expected/site}/four/index.xml +0 -0
  81. data/test/_expected/site/index.html +15 -0
  82. data/test/{expected → _expected/site}/javascripts/all-.js +0 -0
  83. data/test/{expected → _expected/site}/robots.txt +0 -0
  84. data/test/_expected/site/stylesheets/all-.css +1 -0
  85. data/test/{expected → _expected/site}/stylesheets/print-.css +0 -0
  86. data/test/{expected → _expected/site}/test.html +0 -0
  87. data/test/{expected → _expected/site}/test_config/plugin_config.html +0 -0
  88. data/test/{expected → _expected/site}/test_config/theme_config.html +0 -0
  89. data/test/{expected → _expected/site}/test_layouts/local.html +0 -0
  90. data/test/{expected → _expected/site}/test_layouts/plugin_layout.html +0 -0
  91. data/test/{expected → _expected/site}/test_layouts/test_markdown.html +0 -0
  92. data/test/{expected → _expected/site}/test_layouts/theme.html +0 -0
  93. data/test/{expected → _expected/site}/test_layouts/theme_override.html +0 -0
  94. data/test/{expected → _expected/site}/test_pages/feed/index.xml +0 -0
  95. data/test/{expected → _expected/site}/test_pages/plugin_page.html +0 -0
  96. data/test/{expected → _expected/site}/test_pages/plugin_page_override.html +0 -0
  97. data/test/{expected → _expected/site}/test_pages/theme_page.html +0 -0
  98. data/test/_expected/site/test_pages/three.html +13 -0
  99. data/test/{test-plugin-expected → _expected/test-plugin-expected}/.gitignore +0 -0
  100. data/test/{test-plugin-expected → _expected/test-plugin-expected}/Gemfile +0 -0
  101. data/test/{test-plugin-expected → _expected/test-plugin-expected}/LICENSE.txt +0 -0
  102. data/test/{test-plugin-expected → _expected/test-plugin-expected}/README.md +0 -0
  103. data/test/{test-plugin-expected → _expected/test-plugin-expected}/Rakefile +0 -0
  104. data/test/{test-plugin-expected → _expected/test-plugin-expected}/assets/config.yml +0 -0
  105. data/test/_expected/test-plugin-expected/demo/Gemfile +3 -0
  106. data/test/{test-plugin-expected → _expected/test-plugin-expected}/demo/_config.yml +0 -0
  107. data/test/{plugins/awesome-sauce/docs → _expected/test-plugin-expected/demo}/index.html +0 -0
  108. data/test/{test-plugin-expected → _expected/test-plugin-expected}/lib/test-plugin.rb +0 -0
  109. data/test/{test-plugin-expected → _expected/test-plugin-expected}/lib/test-plugin/version.rb +0 -0
  110. data/test/{test-plugin-expected → _expected/test-plugin-expected}/test-plugin.gemspec +0 -0
  111. data/test/{test-theme-expected → _expected/test-theme-expected}/.gitignore +0 -0
  112. data/test/{test-theme-expected → _expected/test-theme-expected}/Gemfile +0 -0
  113. data/test/{test-theme-expected → _expected/test-theme-expected}/LICENSE.txt +0 -0
  114. data/test/{test-theme-expected → _expected/test-theme-expected}/README.md +0 -0
  115. data/test/{test-theme-expected → _expected/test-theme-expected}/Rakefile +0 -0
  116. data/test/{test-theme-expected → _expected/test-theme-expected}/assets/config.yml +0 -0
  117. data/test/_expected/test-theme-expected/demo/Gemfile +3 -0
  118. data/test/{test-theme-expected → _expected/test-theme-expected}/demo/_config.yml +0 -0
  119. data/test/{test-plugin-expected → _expected/test-theme-expected}/demo/index.html +0 -0
  120. data/test/{test-theme-expected → _expected/test-theme-expected}/lib/test-theme.rb +0 -0
  121. data/test/{test-theme-expected → _expected/test-theme-expected}/lib/test-theme/version.rb +0 -0
  122. data/test/{test-theme-expected → _expected/test-theme-expected}/test-theme.gemspec +0 -0
  123. data/test/{uglify_js_false/javascripts → _expected/uglify_js_false}/all-.js +0 -0
  124. data/test/{plugins → _ink_plugins}/awesome-sauce/config.yml +0 -0
  125. data/test/{test-theme-expected/demo → _ink_plugins/awesome-sauce/docs}/index.html +0 -0
  126. data/test/{plugins → _ink_plugins}/awesome-sauce/files/robots.txt +0 -0
  127. data/test/{plugins → _ink_plugins}/awesome-sauce/includes/some-include.html +0 -0
  128. data/test/{plugins → _ink_plugins}/awesome-sauce/layouts/test-layout.html +0 -0
  129. data/test/{plugins → _ink_plugins}/awesome-sauce/pages/a.html +0 -0
  130. data/test/{plugins → _ink_plugins}/awesome-sauce/pages/b.html +0 -0
  131. data/test/{plugins → _ink_plugins}/awesome-sauce/plugin.rb +0 -0
  132. data/test/{plugins → _ink_plugins}/awesome-sauce/stylesheets/plugin-media-test@print.css +0 -0
  133. data/test/{plugins → _ink_plugins}/awesome-sauce/stylesheets/plugin-test.css +0 -0
  134. data/test/{copy_test/_copy → _ink_plugins/test-theme}/config.yml +3 -0
  135. data/test/{plugins → _ink_plugins}/test-theme/files/disabled-file.txt +0 -0
  136. data/test/{plugins → _ink_plugins}/test-theme/files/favicon.ico +0 -0
  137. data/test/{plugins → _ink_plugins}/test-theme/files/favicon.png +0 -0
  138. data/test/{plugins → _ink_plugins}/test-theme/files/test.html +0 -0
  139. data/test/{plugins → _ink_plugins}/test-theme/fonts/font-one.otf +0 -0
  140. data/test/{plugins → _ink_plugins}/test-theme/fonts/font-two.ttf +0 -0
  141. data/test/{plugins → _ink_plugins}/test-theme/includes/bar.html +0 -0
  142. data/test/{plugins → _ink_plugins}/test-theme/includes/greet.html +0 -0
  143. data/test/{plugins → _ink_plugins}/test-theme/javascripts/bar.js +0 -0
  144. data/test/{plugins → _ink_plugins}/test-theme/javascripts/blah.coffee +0 -0
  145. data/test/{plugins → _ink_plugins}/test-theme/javascripts/disable-this.js +0 -0
  146. data/test/{plugins → _ink_plugins}/test-theme/javascripts/foo.js +0 -0
  147. data/test/{plugins → _ink_plugins}/test-theme/layouts/default.html +0 -0
  148. data/test/{plugins → _ink_plugins}/test-theme/layouts/test.html +0 -0
  149. data/test/{plugins → _ink_plugins}/test-theme/pages/disable-test.html +0 -0
  150. data/test/{plugins → _ink_plugins}/test-theme/pages/four.xml +0 -0
  151. data/test/{plugins → _ink_plugins}/test-theme/pages/one.xml +0 -0
  152. data/test/{plugins → _ink_plugins}/test-theme/pages/three.md +1 -1
  153. data/test/{plugins → _ink_plugins}/test-theme/pages/two.md +0 -0
  154. data/test/{plugins → _ink_plugins}/test-theme/plugin.rb +0 -0
  155. data/test/{plugins → _ink_plugins}/test-theme/stylesheets/_colors.scss +0 -0
  156. data/test/_ink_plugins/test-theme/stylesheets/disable-this.css +1 -0
  157. data/test/{plugins → _ink_plugins}/test-theme/stylesheets/disable.sass +0 -0
  158. data/test/_ink_plugins/test-theme/stylesheets/main.scss +5 -0
  159. data/test/{plugins → _ink_plugins}/test-theme/stylesheets/theme-media-test@print.css +0 -0
  160. data/test/{plugins → _ink_plugins}/test-theme/stylesheets/theme-test.css +0 -0
  161. data/test/{plugins → _ink_plugins}/test-theme/stylesheets/theme-test2.css +0 -0
  162. data/test/_templates/page +4 -0
  163. data/test/_templates/post +5 -0
  164. data/test/source/_layouts/local.html +2 -0
  165. data/test/source/_plugins/loader.rb +2 -2
  166. data/test/source/_plugins/theme/stylesheets/_colors.sass +1 -1
  167. data/test/source/index.html +3 -15
  168. metadata +309 -351
  169. data/lib/octopress-ink/filters.rb +0 -111
  170. data/lib/octopress-ink/generators/plugin_assets.rb +0 -13
  171. data/lib/octopress-ink/helpers.rb +0 -10
  172. data/lib/octopress-ink/helpers/conditional.rb +0 -24
  173. data/lib/octopress-ink/helpers/content_for.rb +0 -32
  174. data/lib/octopress-ink/helpers/path.rb +0 -74
  175. data/lib/octopress-ink/helpers/var.rb +0 -105
  176. data/lib/octopress-ink/tags/abort.rb +0 -22
  177. data/lib/octopress-ink/tags/assign.rb +0 -33
  178. data/lib/octopress-ink/tags/capture.rb +0 -38
  179. data/lib/octopress-ink/tags/content_for.rb +0 -24
  180. data/lib/octopress-ink/tags/filter.rb +0 -24
  181. data/lib/octopress-ink/tags/include.rb +0 -53
  182. data/lib/octopress-ink/tags/line_comment.rb +0 -10
  183. data/lib/octopress-ink/tags/render.rb +0 -85
  184. data/lib/octopress-ink/tags/return.rb +0 -19
  185. data/lib/octopress-ink/tags/wrap.rb +0 -81
  186. data/lib/octopress-ink/tags/yield.rb +0 -36
  187. data/lib/octopress-ink/utils.rb +0 -42
  188. data/test/combine_css_false/stylesheets/theme/main.css +0 -2
  189. data/test/copy_test/_copy/stylesheets/disable-this.css +0 -1
  190. data/test/copy_test/_copy/stylesheets/main.scss +0 -5
  191. data/test/expected/index.html +0 -71
  192. data/test/expected/stylesheets/all-.css +0 -1
  193. data/test/expected/test_pages/three.html +0 -1
  194. data/test/expected/test_tags/abort_false.html +0 -1
  195. data/test/expected/test_tags/assign.html +0 -23
  196. data/test/expected/test_tags/capture.html +0 -21
  197. data/test/expected/test_tags/content_for.html +0 -1
  198. data/test/expected/test_tags/filter.html +0 -4
  199. data/test/expected/test_tags/include.html +0 -33
  200. data/test/expected/test_tags/render.html +0 -34
  201. data/test/expected/test_tags/return.html +0 -23
  202. data/test/expected/test_tags/wrap.html +0 -29
  203. data/test/plugins/test-theme/stylesheets/disable-this.css +0 -1
  204. data/test/plugins/test-theme/stylesheets/main.scss +0 -5
  205. data/test/source/.gitignore +0 -1
  206. data/test/source/test_render/_f.html +0 -1
  207. data/test/source/test_render/_var.html +0 -1
  208. data/test/source/test_tags/_test_render.md +0 -4
  209. data/test/source/test_tags/abort_false.html +0 -5
  210. data/test/source/test_tags/abort_posts.html +0 -5
  211. data/test/source/test_tags/abort_true.html +0 -5
  212. data/test/source/test_tags/assign.html +0 -26
  213. data/test/source/test_tags/capture.html +0 -31
  214. data/test/source/test_tags/content_for.html +0 -7
  215. data/test/source/test_tags/filter.html +0 -6
  216. data/test/source/test_tags/include.html +0 -36
  217. data/test/source/test_tags/render.html +0 -36
  218. data/test/source/test_tags/return.html +0 -30
  219. data/test/source/test_tags/wrap.html +0 -32
  220. data/test/test-plugin-expected/demo/Gemfile +0 -6
  221. data/test/test-theme-expected/demo/Gemfile +0 -6
  222. data/test/test.rb +0 -110
  223. data/test/test_suite.rb +0 -161
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 576099a0e49e1ab0edc2d5cbb5a9e16200a4394f
4
- data.tar.gz: e5eb8df4eda75bfc27abfe48f0b20e293fe84525
3
+ metadata.gz: 48037693d08748489adee87f801cb143f5a320fd
4
+ data.tar.gz: 7ffb7e286fd7664305502dbbb98dd6e32c55c6fc
5
5
  SHA512:
6
- metadata.gz: c3bee656fcd73fd9c9fa3e24eb69d26fc7cd978838c25a5a38af9daa8b6e5c18cba20393146d3cfd026ead3f5a415a24cfbbdfea13d220762209c99633c077c5
7
- data.tar.gz: 1336166f60125b7cab46bacbcde7f4a3d50f26672f63a17a1c641a6323c3ae0f08d921a93dd468b24ac4c756db9badf607884f5e70830869a6f96369fb20702c
6
+ metadata.gz: c1021fc8290f4d780810aa696046f60d9fe63c49d370817d4eb0514445f05cee27ce32bffcbaf39464166599b0418d5a609c5d5f062b829b7ae21d0b0bb5931e
7
+ data.tar.gz: 4b20db2aec8fc8bdcdaba7b17708e9c6d0543dee05a5c54e645e27f07a3631e669ab14add044f72a6ee779c60bf9dd9e819b76da591c5047af7db3844df28ed1
data/.gitignore CHANGED
@@ -19,3 +19,4 @@ tmp
19
19
  .sass-cache
20
20
  test/site
21
21
  .code-highlighter-cache
22
+ _site
data/.travis.yml CHANGED
@@ -2,5 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 1.9.3
5
- script: cd test && bundle exec ruby test.rb
5
+ script: cd test && bundle exec clash
6
6
 
data/CHANGELOG.md CHANGED
@@ -1,13 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## Current released version
3
+ ### 1.0.0 RC13 - 2014-08-11
4
+
5
+ - Fixed an issue with asset tags
6
+
7
+ ### 1.0.0 RC12 - 2014-08-03
8
+
9
+ - Extracted all tags to separate projects under [github.com/octopress](https://github.com/octopress).
10
+ - Now the only tag provided by default is [include-tag](https://github.com/octopress/include-tag).
11
+ - Switched from jekyll-page-hooks to octopress-hooks.
12
+ - Extracted link post feature as a separate plugin [octopress-linkblog](https://github.com/octopress/linkblog)
13
+ - Extracted page date feature as a separate plugin [octopress-date-format](https://github.com/octopress/date-format)
14
+ - Extracted Autoprefixer a separate plugin [octopress-autoprefixer](https://github.com/octopress/autoprefixer)
4
15
 
5
16
  ### 1.0.0 RC11 - 2014-06-27
6
17
 
7
18
  - Fixed: Render tag properly processes local variables.
8
19
 
9
- ## Past versions
10
-
11
20
  ### 1.0.0 RC10 - 2014-06-26
12
21
 
13
22
  - Render tag does a better job of preserving {% raw %} escaped content.
@@ -3,7 +3,7 @@ title: "Create an Octopress Ink Plugin"
3
3
  permalink: /guides/creating-a-plugin/
4
4
  ---
5
5
 
6
- *This guide assumes you have already installed Git, and Ruby 1.9.3 or greater.*
6
+ *This guide assumes you have already installed Git, and have Ruby 1.9.3 or greater.*
7
7
 
8
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
 
@@ -17,6 +17,8 @@ The configuration options are as follows.
17
17
 
18
18
  {% render ./_configuration.markdown %}
19
19
 
20
+ Note: For themes, the slug will be set to `theme`. This makes it easy for users to work with any theme with a consistent slug name.
21
+
20
22
  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
23
 
22
24
  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.
@@ -29,21 +31,21 @@ This will add the asset directories, create a demo site, and print out a plugin
29
31
 
30
32
  ### Create a plugin from scratch
31
33
 
32
- To create a new plugin named "Spicy Baconnaise" run:
34
+ To create a new plugin named "Some Plugin" run:
33
35
 
34
36
  ```sh
35
- $ octopress ink new spicy_baconnaise
37
+ $ octopress ink new some_plugin
36
38
  ```
37
39
 
38
40
  This does the following.
39
41
 
40
42
  - Creates a new gem using Bundler's gem scaffolding.
41
43
  - It adds `octopress` and `octopress-ink` as dependencies in the gemspec.
42
- - An Octopress Ink plugin template is added to `lib/spicy_baconnaise.rb`.
44
+ - An Octopress Ink plugin template is added to `lib/some_plugin.rb`.
43
45
  - `assets/` contains empty asset directories.
44
46
  - `demo/` contains a blank Jekyll site with your plugin already integrated for easy testing.
45
47
 
46
- Here's what the new `spicy_baconnaise` directory looks like.
48
+ Here's what the new `some_plugin` directory looks like.
47
49
 
48
50
  ```
49
51
  assets/
@@ -57,33 +59,33 @@ assets/
57
59
  pages/
58
60
  stylesheets/
59
61
  lib/
60
- spicy_baconnaise/
62
+ some_plugin/
61
63
  version.rb
62
- spicy_baconnaise.rb
64
+ some_plugin.rb
63
65
  demo/
64
66
  _layouts/
65
67
  _posts/
66
68
  Gemfile
67
69
  index.html
68
- spicy_baconnaise.gemspec
70
+ some_plugin.gemspec
69
71
  Gemfile
70
72
  LICENSE.txt
71
73
  Rakefile
72
74
  README.md
73
75
  ```
74
76
 
75
- In `lib/spicy_baconnaise.rb` you'll find an Octopress Ink plugin created specifically for your gem.
77
+ In `lib/some_plugin.rb` you'll find an Octopress Ink plugin created specifically for your gem.
76
78
 
77
79
  ```ruby
78
80
  require 'lib/version'
79
81
  require 'octopress-ink'
80
82
 
81
83
  Octopress::Ink.add_plugin({
82
- name: "Spicy Baconnaise"
83
- slug: "spicy_baconnaise",
84
+ name: "Some Plugin"
85
+ slug: "some_plugin",
84
86
  assets_path: File.expand_path(File.join(File.dirname(__FILE__), "../assets")),
85
- type: "spicy_baconnaise",
86
- version: SpicyBaconnaise::Version,
87
+ type: "some_plugin",
88
+ version: SomePlugin::Version,
87
89
  description: "",
88
90
  website: ""
89
91
  })
@@ -104,21 +106,81 @@ plugin. To finish setting up your plugin, you'll need to add the plugin template
104
106
 
105
107
  ## Plugin assets
106
108
 
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.
109
+ Octopress Ink plugins make it super easy to integrate assets with any Jekyll site. Your plugin should have an `assets` directory,
110
+ typically in the root directory of your gem. Inside `assets` there will be folders for each asset type your plugin uses plan to use.
110
111
 
112
+ Note: Assets are copied at build time and assets will not overwrite an existing file.
111
113
 
112
114
  | Asset directory | Description |
113
115
  |:----------------|:------------------------------------------------|
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. |
116
+ | layouts | Users can add layouts by setting `layout: plugin_slug:some_layout` in a page's YAML front-matter. |
117
+ | includes | Includes are available to users by `{% raw %}{% include plugin_slug:some_file.html %}{% endraw %}`. |
121
118
  | 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
119
  | files | `files/favicon.ico` is copied to `_site/favicon.ico`. |
120
+ | fonts | `wingdings.ttf` is copied to `_site/fonts/plugin_slug/wingdings.ttf`. |
121
+ | images | `cat.gif` is copied to `_site/images/plugin_slug/cat.gif`. |
122
+ | javascripts | `boom.js` is combined with all plugin javascripts into a single fingerprinted file. |
123
+ | stylesheets | `theme.scss` and `print.css` are combined with all plugin stylesheets into a single fingerprinted file. |
124
+ | 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 %}) |
125
+
123
126
 
127
+ ### Layouts
128
+
129
+ Layouts will probably mostly be useful if you're developing a theme. For a typical theme you'll probably have three layouts:
130
+
131
+ ```
132
+ assets/
133
+ layouts/
134
+ default.html
135
+ page.html
136
+ post.html
137
+ ```
138
+
139
+ Here's a example of a simple `default.html` layout.
140
+
141
+ ```
142
+ <!DOCTYPE html>
143
+ <meta charset="utf-8">
144
+ <html>
145
+ <head>
146
+ <title>{{ page.title }} - {{ site.title }}</title>
147
+ {% octopress_css %}
148
+ </head>
149
+ <body>
150
+ {{ content }}
151
+ {% octopress_js %}
152
+ </body>
153
+ </html>
154
+ ```
155
+
156
+ You'll notice the `{% octopress_css %}` and `{% octopress_js %}` tags. These are special tags that come with Octopress Ink and output the `<link>` and `<script>` tags from the Octopress Ink asset pipeline.
157
+
158
+ A `page.html` or `post.html` might look like this:
159
+
160
+ ```
161
+ ---
162
+ layout: theme:default
163
+ ---
164
+ <article>
165
+ <h1>{{ page.title }}</h1>
166
+ {{ content }}
167
+ </article>
168
+ ```
169
+
170
+ You'll notice that the default layout is included with `layout: theme:default`. Of course, if your plugin's slug was `baconnaise` you'd use `layout: baconnaise:default`.
171
+
172
+ Users can override the theme's default layout by adding a file to `_plugins/theme/layouts/default.html`. Now the theme's page and post layouts will
173
+ load the user's default layout instead of loading it from the theme's assets. If your plugin's slug was `baconnaise` the user could override the layout by placing a
174
+ file at `_plugins/baconnaise/layouts/default.html`.
175
+
176
+ ### Includes
177
+
178
+ Includes are how you store a partial of code to be reused in several locations. For example, you might want to share site navigation between several layouts.
179
+
180
+ ```
181
+ assets/
182
+ includes/
183
+ navigation.html
184
+ ```
124
185
 
186
+ To include this partial, use an include tag, but add the plugin slug before the filename like this `{% include plugin_slug:navigation %}`.
@@ -19,4 +19,4 @@ The configuration options are as follows:
19
19
 
20
20
  ### Plugin Assets
21
21
 
22
- You can set `assets_path` to point wherever you like inside your gem file, but in this case we have it pointing to the `assets` directory in root of the gem. There isn't a directory there yet, so we'll need to add one, and while were at it, add any assets that this plugin will need.
22
+ You can set `assets_path` to point wherever you like insde your gem file, but in this case we have it pointing to the `assets` directiory in root of the gem. There isn't a directory there yet, so we'll need to add one, and while were at it, add any assets that this plugin will need.
@@ -0,0 +1,188 @@
1
+ ---
2
+ title: "Working with Octopress Ink Plugins"
3
+ permalink: /working-with-plugins/
4
+ ---
5
+
6
+ ## Installing plugins
7
+
8
+ Octopress Ink plugins are distributed as Ruby gems. This makes them really easy to add to any Jekyll site.
9
+ If you were going to install the [octopress-codefence](https://github.com/octopress/codefence) plugin, first you'd need to install the gem.
10
+
11
+ #### Using Bundler
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.
14
+
15
+ ```ruby
16
+ group :octopress do
17
+ gem 'octopress-codefence'
18
+ end
19
+ ```
20
+
21
+ #### Manually
22
+
23
+ If you aren't using Bundler, first install the gem manually.
24
+
25
+ ```sh
26
+ $ gem install octopress-codefence
27
+ ```
28
+
29
+ Then add it to your gems list in your `_config.yml`.
30
+
31
+ ```
32
+ gems:
33
+ - octopress-codefence
34
+ ```
35
+
36
+ Now whenever you build your site, Jekyll will automatically load the Octopress Codefence plugin.
37
+
38
+ ## Listing plugins
39
+
40
+ If you have installed the `octopress` gem. You can easily learn about the plugins you have installed.
41
+
42
+ ```
43
+ $ octopress ink list [PLUGIN] [options] # List basic info about all installed plugins.
44
+ $ octopress ink list --all # List detailed info about all plugins.
45
+ $ octopress ink list --stylesheets # List stylesheets from all plugins with stylesheets.
46
+ $ octopress ink list awesome-plugin # List everything about a specific plugin.
47
+ $ octopress ink list awesome-plugin --layouts # List layouts from a specific plugin.
48
+ $ octopress ink list theme --config # List your theme's default configuration opitons.
49
+ ```
50
+
51
+ Here's an example of what `octopress ink list` might print with `octopress-codefence` and `octopress-solarized` installed.
52
+
53
+ ```
54
+ Octopress Ink - v1.0.0.0
55
+ Octopress Codefence (octopress-codefence) - v1.0.1 - Generate beautiful code snippets with advanced features on any Jekyll site.
56
+ Octopress Solarized (octopress-solarized) - v1.0.0 - Style code snippets with Ethan Schoonover's Solarized theme (tweaked a bit).
57
+ ```
58
+
59
+ This lists the Octopress Ink version and each plugins along with some basic information. Here are some of the commands you can use. Run
60
+ `octopress ink list --help` to see all of the options.
61
+
62
+ Here's an example of the output from running `octopress ink list awesome-plugin`.
63
+
64
+ ```
65
+ Plugin: Some Awesome Theme
66
+ Slug: theme
67
+ This theme is the awesome one.
68
+ ================================================================================
69
+ layouts:
70
+ - default.html
71
+ - post.html
72
+ - page.html
73
+
74
+ includes:
75
+ - navigation.html
76
+ - header.html
77
+ - footer.html
78
+
79
+ pages:
80
+ - feed.xml /feed/index.html
81
+ - index.html /index.html
82
+ - archive.html /archives/index.html
83
+
84
+ sass:
85
+ - _colors.scss
86
+ - _layout.scss
87
+ - theme.scss
88
+
89
+ files:
90
+ - favicon.ico
91
+ ```
92
+
93
+ ## Customizing plugins
94
+
95
+ Assets for Octopress Ink plugins (templates, images, stylesheets, etc.) all live inside the gem and are
96
+ only integrated with your site during the build process. Here's how you can customize a plugin's assets.
97
+
98
+ Each plugin has a slug, for a theme this slug is always `theme`, but for other plugins it will be different. Run `octopress ink list` and
99
+ the plugin slugs will be listed after the plugin's name inside the parenthesis. Octopress Ink will look in `_plugins/[your_plugin_slug]/` for your plugin customizations.
100
+
101
+ For example, If you want to override the `default.html` layout for a theme, you'd add a file in your site's source directory at
102
+ `_plugins/theme/layouts/default.html`. Now when your site is built, Octopress Ink will override the theme's default layout with your
103
+ custom version.
104
+
105
+ The easiest way to make changes to a theme is to copy its assets into your override directories and make changes there.
106
+
107
+ ### Copying plugin assets
108
+
109
+ If you have installed the `octopress` gem. You can copy a plugin's assets to it's corresponding override directory using the `octopress
110
+ ink copy` command. Here are some examples.
111
+
112
+ ```
113
+ $ octopress ink copy <PLUGIN> [options]
114
+ $ octopress ink copy theme # Copy all theme assets to _plugins/theme/.
115
+ $ octopress ink copy theme --stylesheets # Copy theme Sass or CSS to _plugins/theme/stylesheets/.
116
+ $ octopress ink copy theme --config # Copy the theme's configuration file to _plugins/theme/config.yml.
117
+ $ octopress ink copy magic-plugin --layouts # Copy layouts for magic-plugin to _plugin/magic-plugin/layouts/.
118
+ $ octopress ink copy magic-plugin --path test # Copy all assets for magic-plugin to ./test
119
+ ```
120
+
121
+ To make modifications to the default layout for your theme you might.
122
+
123
+ 1. Run `octopress ink copy theme --layouts`.
124
+ 2. Go to `_plugins/theme/layouts/` and remove all files except `default.html`.
125
+ 3. Make necessary modifications to `default.html`.
126
+
127
+ If you decide that you want to revert to the original layout, simply remove your overriding copy and Octopress Ink will read the layout
128
+ from the gem once again.
129
+
130
+ This same system works for any type of asset listed with the `octopress ink list` command.
131
+
132
+ ### Disabling plugin assets
133
+
134
+ You can disable assets from your plugin's configuration file. Disable individual assets, or all of one type of asset. Here's an example of how to disable assets on a theme.
135
+
136
+ ```yaml
137
+ # _plugins/theme/config.yml
138
+ disable:
139
+ fonts: true # disable all fonts
140
+ files: favicon.ico # disable a specific file
141
+ pages: # disable multiple pages
142
+ - archive.html
143
+ - feed.xml
144
+ ```
145
+
146
+ Any asset can be disabled except for layouts, includes and Sass partials. Layouts and includes are only added to a site when you manually
147
+ include them, so disabling them isn't necessary. Sass partials can't be disabled because they aren't added directly to Jekyll,
148
+ but are instead included by Sass files.
149
+
150
+ You can verify that you've disabled assets by running `octopress ink list <PLUGIN>`. Assets which are disabled will be marked like this.
151
+
152
+ ```
153
+ fonts:
154
+ - awesome.ttf disabled
155
+ - awesome.woff disabled
156
+ - awesome.eot disabled
157
+
158
+ files:
159
+ - favicon.ico disabled
160
+ - robots.txt
161
+
162
+ pages:
163
+ - archive.html disabled
164
+ - feed.xml disabled
165
+ - index.html /index.html
166
+ ```
167
+
168
+ ### Changing URLs for plugin pages
169
+
170
+ You can override URLs for plugin pages in your plugin's configuration. Under `page_permalinks` add the file's name (not including the extension) as a key, followed by
171
+ your custom permalink. Here's an example.
172
+
173
+ ```
174
+ page_permalinks:
175
+ index: posts/ # index.html is moved to /posts/index.html
176
+ feed: rss/ # feed.xml is moved to /rss/index.xml
177
+ ```
178
+
179
+ Now when you run `octopress ink list <PLUGIN> --pages` you'll see your custom URLs listed by the pages.
180
+
181
+ ```
182
+ pages:
183
+ - archive.html /archive.html
184
+ - feed.xml /rss/index.xml
185
+ - index.html /posts/index.html
186
+ ```
187
+
188
+
data/lib/octopress-ink.rb CHANGED
@@ -1,22 +1,40 @@
1
1
  require 'jekyll'
2
2
  require 'sass'
3
3
  require 'uglifier'
4
- require 'autoprefixer-rails'
5
4
  require 'digest/md5'
6
- require 'jekyll-page-hooks'
5
+ require 'octopress'
6
+ require 'octopress-hooks'
7
+ require 'octopress-filters'
7
8
 
8
9
  require 'octopress-ink/version'
9
10
 
10
- require 'octopress-ink/utils'
11
- require 'octopress-ink/generators/plugin_assets'
11
+ require 'octopress-ink/configuration'
12
12
  require 'octopress-ink/jekyll/hooks'
13
13
 
14
14
  module Octopress
15
+ def self.site(options={})
16
+ @site ||= init_site(options)
17
+ end
18
+
19
+ def self.site=(site)
20
+ # Octopress historically used site.title
21
+ # This allows theme developers to expect site.name
22
+ # in consistancy with Jekyll's scaffold config
23
+
24
+ site.config['name'] ||= site.config['title']
25
+
26
+ @site = site
27
+ end
28
+
29
+ def self.init_site(options)
30
+ Jekyll.logger.log_level = :error
31
+ site = Jekyll::Site.new(Jekyll.configuration(options))
32
+ Jekyll.logger.log_level = :info
33
+ site
34
+ end
35
+
15
36
  module Ink
16
37
 
17
- autoload :Configuration, 'octopress-ink/configuration'
18
- autoload :Helpers, 'octopress-ink/helpers'
19
- autoload :Filters, 'octopress-ink/filters'
20
38
  autoload :Assets, 'octopress-ink/assets'
21
39
  autoload :Page, 'octopress-ink/jekyll/page'
22
40
  autoload :StaticFile, 'octopress-ink/jekyll/static_file'
@@ -59,69 +77,6 @@ module Octopress
59
77
  @config ||= Configuration.config
60
78
  end
61
79
 
62
- def self.site(options={})
63
- unless @site
64
- @site ||= init_site(options)
65
- end
66
-
67
- @site
68
- end
69
-
70
- def self.site=(site)
71
- # Octopress historically used site.title
72
- # This allows theme developers to expect site.name
73
- # in consistancy with Jekyll's scaffold config
74
- site.config['name'] ||= site.config['title']
75
-
76
- @site = site
77
- end
78
-
79
- def self.payload(jekyll_payload={})
80
- Jekyll::Utils.deep_merge_hashes(jekyll_payload, custom_payload)
81
- end
82
-
83
- def self.custom_payload
84
- unless @custom_payload
85
- config = Plugins.config
86
-
87
- payload = {
88
- 'plugins' => config['plugins'],
89
- 'theme' => config['theme'],
90
- 'octopress' => {
91
- 'version' => Octopress::Ink.version
92
- },
93
- 'site' => {
94
- 'linkposts' => self.linkposts,
95
- 'articles' => self.articles,
96
- }
97
- }
98
-
99
- if Octopress::Ink.config['docs_mode']
100
- payload['doc_pages'] = Octopress::Ink::Plugins.doc_pages
101
- end
102
-
103
- @custom_payload = payload
104
- end
105
-
106
- @custom_payload
107
- end
108
-
109
- def self.linkposts
110
- @linkposts ||= site.posts.select {|p| p.data['linkpost']}
111
- end
112
-
113
- def self.articles
114
- @articles ||= site.posts.reject {|p| p.data['linkpost']}
115
- end
116
-
117
- def self.init_site(options)
118
- log_level = Jekyll.logger.log_level
119
- Jekyll.logger.log_level = :error
120
- site = Jekyll::Site.new(Jekyll.configuration(options))
121
- Jekyll.logger.log_level = log_level
122
- site
123
- end
124
-
125
80
  def self.plugins
126
81
  Plugins.plugins
127
82
  end
@@ -144,7 +99,7 @@ module Octopress
144
99
  #
145
100
  #
146
101
  def self.list(options={})
147
- site(options)
102
+ Octopress.site(options)
148
103
  Plugins.register
149
104
  options = {'minimal'=>true} if options.empty?
150
105
  message = "Octopress Ink - v#{VERSION}\n"
@@ -160,9 +115,11 @@ module Octopress
160
115
  end
161
116
 
162
117
  def self.plugin_list(name, options)
163
- site(options)
118
+ config = options.delete('config') # Jekyll conflicts with this option
119
+ Octopress.site(options)
164
120
  Plugins.register
165
- options.delete('config')
121
+ options['config'] = config if config
122
+
166
123
  if p = plugin(name)
167
124
  puts p.list(options)
168
125
  else
@@ -171,8 +128,11 @@ module Octopress
171
128
  end
172
129
 
173
130
  def self.copy_plugin_assets(name, options)
174
- site(options)
131
+ config = options.delete('config') # Jekyll conflicts with this option
132
+ Octopress.site(options)
175
133
  Plugins.register
134
+ options['config'] = config if config
135
+
176
136
  path = copy_path(name, options)
177
137
 
178
138
 
@@ -190,23 +150,23 @@ module Octopress
190
150
 
191
151
  def self.copy_path(name, options)
192
152
  if path = options.delete('path')
193
- full_path = File.join(Ink.site.source, path)
153
+ full_path = File.join(Dir.pwd, path)
194
154
  if !Dir["#{full_path}/*"].empty? && options['force'].nil?
195
155
  abort "Error: directory #{path} is not empty. Use --force to overwrite files."
196
156
  end
197
157
  else
198
- full_path = File.join(Ink.site.source, Plugins.custom_dir, name)
158
+ full_path = File.join(Dir.pwd, Plugins.custom_dir, name)
199
159
  end
200
160
 
201
161
  full_path
202
162
  end
203
163
 
204
164
  def self.list_plugins(options={})
205
- site(options)
165
+ Octopress.site(options)
206
166
  Plugins.register
207
167
  puts "\nCurrently installed plugins:"
208
168
  if plugins.size > 0
209
- plugins.each { |plugin| puts plugin.name }
169
+ plugins.each { |plugin| puts plugin.name + " (#{plugin.slug})" }
210
170
  else
211
171
  puts "You have no plugins installed."
212
172
  end
@@ -250,21 +210,8 @@ module Octopress
250
210
  end
251
211
  end
252
212
 
253
- Liquid::Template.register_filter Octopress::Ink::Filters
254
-
255
- Liquid::Template.register_tag('include', Octopress::Ink::Tags::IncludeTag)
256
- Liquid::Template.register_tag('assign', Octopress::Ink::Tags::AssignTag)
257
- Liquid::Template.register_tag('capture', Octopress::Ink::Tags::CaptureTag)
258
- Liquid::Template.register_tag('return', Octopress::Ink::Tags::ReturnTag)
259
- Liquid::Template.register_tag('filter', Octopress::Ink::Tags::FilterTag)
260
- Liquid::Template.register_tag('render', Octopress::Ink::Tags::RenderTag)
261
- Liquid::Template.register_tag('css_asset_tag', Octopress::Ink::Tags::JavascriptTag)
262
- Liquid::Template.register_tag('js_asset_tag', Octopress::Ink::Tags::StylesheetTag)
263
- Liquid::Template.register_tag('content_for', Octopress::Ink::Tags::ContentForTag)
264
- Liquid::Template.register_tag('yield', Octopress::Ink::Tags::YieldTag)
265
- Liquid::Template.register_tag('wrap', Octopress::Ink::Tags::WrapTag)
266
- Liquid::Template.register_tag('abort', Octopress::Ink::Tags::AbortTag)
267
- Liquid::Template.register_tag('_', Octopress::Ink::Tags::LineCommentTag)
213
+ Liquid::Template.register_tag('css_asset_tag', Octopress::Ink::Tags::StylesheetTag)
214
+ Liquid::Template.register_tag('js_asset_tag', Octopress::Ink::Tags::JavascriptTag)
268
215
  Liquid::Template.register_tag('doc_url', Octopress::Ink::Tags::DocUrlTag)
269
216
 
270
217
  require 'octopress-ink/plugins/ink'