octopress-ink 1.0.0.alpha.29 → 1.0.0.alpha.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/octopress-ink.rb +14 -4
  3. data/lib/octopress-ink/assets.rb +1 -0
  4. data/lib/octopress-ink/assets/page.rb +40 -0
  5. data/lib/octopress-ink/assets/root.rb +1 -2
  6. data/lib/octopress-ink/filters.rb +24 -9
  7. data/lib/octopress-ink/generators/plugin_assets.rb +1 -1
  8. data/lib/octopress-ink/helpers/path.rb +24 -1
  9. data/lib/octopress-ink/helpers/var.rb +1 -1
  10. data/lib/octopress-ink/jekyll/hooks.rb +3 -4
  11. data/lib/octopress-ink/jekyll/page.rb +31 -0
  12. data/lib/octopress-ink/{assets → jekyll}/static_file.rb +0 -0
  13. data/lib/octopress-ink/{assets → jekyll}/static_file_content.rb +0 -0
  14. data/lib/octopress-ink/plugin.rb +35 -8
  15. data/lib/octopress-ink/plugins.rb +8 -10
  16. data/lib/octopress-ink/tags.rb +2 -0
  17. data/lib/octopress-ink/tags/abort.rb +19 -0
  18. data/lib/octopress-ink/tags/assign.rb +1 -2
  19. data/lib/octopress-ink/tags/capture.rb +9 -2
  20. data/lib/octopress-ink/tags/content_for.rb +1 -2
  21. data/lib/octopress-ink/tags/filter.rb +21 -0
  22. data/lib/octopress-ink/tags/include.rb +1 -2
  23. data/lib/octopress-ink/tags/render.rb +1 -2
  24. data/lib/octopress-ink/tags/return.rb +1 -2
  25. data/lib/octopress-ink/tags/wrap.rb +10 -3
  26. data/lib/octopress-ink/tags/yield.rb +1 -6
  27. data/lib/octopress-ink/version.rb +1 -1
  28. data/test/expected/2014/02/01/test-post.html +14 -0
  29. data/test/expected/test_tags/abort_false.html +1 -0
  30. data/test/expected/test_tags/capture.html +2 -0
  31. data/test/expected/test_tags/filter.html +4 -0
  32. data/test/expected/test_tags/wrap.html +1 -0
  33. data/test/plugins/awesome-sauce/config.yml +2 -0
  34. data/test/{source/_plugins → plugins}/awesome-sauce/files/robots.txt +0 -0
  35. data/test/{source/_plugins → plugins}/awesome-sauce/includes/some-include.html +0 -0
  36. data/test/{source/_plugins → plugins}/awesome-sauce/layouts/test-layout.html +0 -0
  37. data/test/plugins/awesome-sauce/plugin.rb +16 -0
  38. data/test/{source/_plugins → plugins}/awesome-sauce/stylesheets/plugin-media-test.css +0 -0
  39. data/test/{source/_plugins → plugins}/awesome-sauce/stylesheets/plugin-test.css +0 -0
  40. data/test/{source/_plugins → plugins}/test-theme/config.yml +3 -0
  41. data/test/{source/_plugins → plugins}/test-theme/files/favicon.ico +0 -0
  42. data/test/{source/_plugins → plugins}/test-theme/files/favicon.png +0 -0
  43. data/test/{source/_plugins → plugins}/test-theme/files/test.html +0 -0
  44. data/test/{source/_plugins → plugins}/test-theme/includes/bar.html +0 -0
  45. data/test/{source/_plugins → plugins}/test-theme/includes/greet.html +0 -0
  46. data/test/{source/_plugins → plugins}/test-theme/javascripts/bar.js +0 -0
  47. data/test/{source/_plugins → plugins}/test-theme/javascripts/foo.js +0 -0
  48. data/test/{source/_plugins → plugins}/test-theme/layouts/default.html +0 -0
  49. data/test/{source/_plugins → plugins}/test-theme/layouts/test.html +0 -0
  50. data/test/plugins/test-theme/pages/pages-test.md +6 -0
  51. data/test/plugins/test-theme/pages/sub/test.md +5 -0
  52. data/test/{source/_plugins/bundler.rb → plugins/test-theme/plugin.rb} +1 -17
  53. data/test/{source/_plugins → plugins}/test-theme/stylesheets/_colors.scss +0 -0
  54. data/test/{source/_plugins → plugins}/test-theme/stylesheets/main.scss +0 -0
  55. data/test/{source/_plugins → plugins}/test-theme/stylesheets/theme-media-test@print.css +0 -0
  56. data/test/{source/_plugins → plugins}/test-theme/stylesheets/theme-test.css +0 -0
  57. data/test/{source/_plugins → plugins}/test-theme/stylesheets/theme-test2.css +0 -0
  58. data/test/site/2014/02/01/test-post.html +14 -0
  59. data/test/site/index.html +2 -0
  60. data/test/site/pages-tet.html +13 -0
  61. data/test/site/test_layouts/test_markdown.html +13 -0
  62. data/test/site/test_tags/abort_false.html +1 -0
  63. data/test/site/test_tags/abort_true.html +1 -0
  64. data/test/site/test_tags/capture.html +2 -0
  65. data/test/site/test_tags/filter.html +4 -0
  66. data/test/site/test_tags/wrap.html +1 -0
  67. data/test/source/_plugins/awesome-sauce/config.yml +1 -2
  68. data/test/source/_plugins/loader.rb +2 -0
  69. data/test/source/{_custom → _plugins}/theme/config.yml +3 -0
  70. data/test/source/{_custom → _plugins}/theme/includes/bar.html +0 -0
  71. data/test/source/{_custom → _plugins}/theme/layouts/test.html +0 -0
  72. data/test/source/{_custom → _plugins}/theme/stylesheets/_colors.sass +0 -0
  73. data/test/source/{_custom → _plugins}/theme/stylesheets/theme-test.css +0 -0
  74. data/test/source/_posts/2014-02-01-test-post.md +6 -0
  75. data/test/source/index.md +10 -0
  76. data/test/source/pages-tet.md +5 -0
  77. data/test/source/test_layouts/test_markdown.md +5 -0
  78. data/test/source/test_tags/abort_false.html +5 -0
  79. data/test/source/test_tags/abort_true.html +5 -0
  80. data/test/source/test_tags/capture.html +7 -0
  81. data/test/source/test_tags/content_for.html +1 -1
  82. data/test/source/test_tags/filter.html +6 -0
  83. data/test/source/test_tags/wrap.html +2 -1
  84. data/test/test.rb +13 -2
  85. metadata +100 -58
  86. data/test/source/_custom/awesome-sauce/config.yml +0 -1
@@ -0,0 +1,19 @@
1
+ module Octopress
2
+ module Tags
3
+ class AbortTag < Liquid::Tag
4
+ def initialize(tag_name, markup, tokens)
5
+ super
6
+ @markup = " #{markup}"
7
+ end
8
+
9
+ def render(context)
10
+ if Helpers::Conditional.parse(@markup, context)
11
+ env = context.environments.first
12
+ dest = File.join(Helpers::Path.site_dir, env['page']['url'])
13
+ context.environments.first['site']['pages'] = Helpers::Path.remove_page(dest)
14
+ end
15
+ ''
16
+ end
17
+ end
18
+ end
19
+ end
@@ -9,8 +9,7 @@ module Octopress
9
9
  end
10
10
 
11
11
  def render(context)
12
- markup = Helpers::Conditional.parse(@markup, context)
13
- return unless markup
12
+ return unless markup = Helpers::Conditional.parse(@markup, context)
14
13
 
15
14
  if markup =~ SYNTAX
16
15
  var = $1
@@ -9,14 +9,21 @@ module Octopress
9
9
  end
10
10
 
11
11
  def render(context)
12
- markup = Helpers::Conditional.parse(@markup, context)
13
- return unless markup
12
+ return unless markup = Helpers::Conditional.parse(@markup, context)
13
+ if markup =~ Helpers::Var::HAS_FILTERS
14
+ markup = $1
15
+ filters = $2
16
+ end
14
17
 
15
18
  if markup =~ SYNTAX
16
19
  var = $1
17
20
  operator = $2
18
21
  value = super.lstrip
19
22
 
23
+ unless value.nil? || filters.nil?
24
+ value = Helpers::Var.render_filters(value, filters, context)
25
+ end
26
+
20
27
  context = Helpers::Var.set_var(var, operator, value, context)
21
28
  else
22
29
  raise SyntaxError.new("Syntax Error in 'capture' - Valid syntax: capture [var]")
@@ -10,8 +10,7 @@ module Octopress
10
10
  end
11
11
 
12
12
  def render(context)
13
- markup = Helpers::Conditional.parse(@markup, context)
14
- return unless markup
13
+ return unless markup = Helpers::Conditional.parse(@markup, context)
15
14
 
16
15
  @block_name ||= Helpers::ContentFor.get_block_name(@tag_name, markup)
17
16
  Helpers::ContentFor.append_to_block(context, @block_name, super)
@@ -0,0 +1,21 @@
1
+ module Octopress
2
+ module Tags
3
+ class FilterTag < Liquid::Block
4
+ def initialize(tag_name, markup, tokens)
5
+ super
6
+ @markup = " #{markup}"
7
+ end
8
+
9
+ def render(context)
10
+ content = super.strip
11
+
12
+ return content unless markup = Helpers::Conditional.parse(@markup, context)
13
+ if markup =~ Helpers::Var::HAS_FILTERS and !content.nil?
14
+ content = Helpers::Var.render_filters(content, $2, context)
15
+ end
16
+
17
+ content
18
+ end
19
+ end
20
+ end
21
+ end
@@ -9,12 +9,11 @@ module Octopress
9
9
  end
10
10
 
11
11
  def render(context)
12
- markup = Helpers::Conditional.parse(@markup, context)
12
+ return unless markup = Helpers::Conditional.parse(@markup, context)
13
13
  if markup =~ Helpers::Var::HAS_FILTERS
14
14
  markup = $1
15
15
  filters = $2
16
16
  end
17
- return unless markup
18
17
  markup = Helpers::Var.evaluate_ternary(markup, context)
19
18
  markup = Helpers::Path.parse(markup, context)
20
19
 
@@ -13,12 +13,11 @@ module Octopress
13
13
  end
14
14
 
15
15
  def render(context)
16
- markup = Helpers::Conditional.parse(@markup, context)
16
+ return unless markup = Helpers::Conditional.parse(@markup, context)
17
17
  if markup =~ Helpers::Var::HAS_FILTERS
18
18
  markup = $1
19
19
  filters = $2
20
20
  end
21
- return unless markup
22
21
  markup = Helpers::Var.evaluate_ternary(markup, context)
23
22
  markup = Helpers::Path.parse(markup, context)
24
23
 
@@ -7,8 +7,7 @@ module Octopress
7
7
  end
8
8
 
9
9
  def render(context)
10
- markup = Helpers::Conditional.parse(@markup, context)
11
- return unless markup
10
+ return unless markup = Helpers::Conditional.parse(@markup, context)
12
11
 
13
12
  Helpers::Var.get_value(markup, context)
14
13
  end
@@ -11,9 +11,12 @@ module Octopress
11
11
  end
12
12
 
13
13
  def render(context)
14
- require 'pry-debugger'
15
- markup = Helpers::Conditional.parse(@markup, context)
16
- return unless markup
14
+ return unless markup = Helpers::Conditional.parse(@markup, context)
15
+
16
+ if markup =~ Helpers::Var::HAS_FILTERS
17
+ markup = $1
18
+ filters = $2
19
+ end
17
20
 
18
21
  type = if markup =~ /^\s*yield\s(.+)/
19
22
  markup = $1
@@ -52,6 +55,10 @@ module Octopress
52
55
  content = super.strip
53
56
  context.scopes.first['yield'] = old_yield
54
57
 
58
+ unless content.nil? || filters.nil?
59
+ content = Helpers::Var.render_filters(content, filters, context)
60
+ end
61
+
55
62
  content
56
63
  end
57
64
 
@@ -19,18 +19,13 @@ module Octopress
19
19
  end
20
20
 
21
21
  def render(context)
22
- markup = Helpers::Conditional.parse(@markup, context)
23
- return unless markup
22
+ return unless markup = Helpers::Conditional.parse(@markup, context)
24
23
  content = Helpers::ContentFor.render(context, @block_name)
25
24
 
26
25
  unless content.nil? || @filters.nil?
27
26
  content = Helpers::Var.render_filters(content, @filters, context)
28
27
  end
29
28
 
30
- if @block_name == 'head' && ENV['OCTOPRESS_ENV'] != 'TEST'
31
- content.insert 0, "<meta name='generator' content='Octopress #{Octopress::Ink::VERSION}'>"
32
- end
33
-
34
29
  content
35
30
  end
36
31
  end
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Ink
3
- VERSION = "1.0.0.alpha.29"
3
+ VERSION = "1.0.0.alpha.30"
4
4
  end
5
5
  end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <title>Test Post</title>
7
+ <meta name="viewport" content="width=device-width">
8
+ </head>
9
+ <body class=" ">
10
+ <div class='local-override'><p>Test post <strong>strong</strong> <em>emphasized</em> <a href="http://example.com">some link</a></p>
11
+ </div>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1 @@
1
+ Woohoo
@@ -17,3 +17,5 @@ hi → hi
17
17
  um, hi → um, hi
18
18
 
19
19
 
20
+ ## Test filters
21
+ foo bar baz booga → foo bar baz booga
@@ -0,0 +1,4 @@
1
+ omg → omg
2
+ OMG → OMG
3
+ BOOGIE → BOOGIE
4
+ boogie → boogie
@@ -8,6 +8,7 @@
8
8
 
9
9
  ## Filter testing
10
10
  [- TESTING INCLUDE -] → [- TESTING INCLUDE -]
11
+ [= TESTING INCLUDE =] → [= TESTING INCLUDE =]
11
12
  [- TESTING FILTERS -] → [- TESTING FILTERS -]
12
13
 
13
14
  ## Conditional wrap
@@ -0,0 +1,2 @@
1
+ test: config from plugin
2
+ test_override: also config from plugin
@@ -0,0 +1,16 @@
1
+ class TestPlugin < Octopress::Plugin
2
+ def initialize(name, type)
3
+ @assets_path = File.expand_path(File.join(File.dirname(__FILE__)))
4
+ super
5
+ end
6
+
7
+ def add_assets
8
+ add_stylesheet 'plugin-test.css'
9
+ add_stylesheet 'plugin-media-test.css', 'print'
10
+ add_root_file 'robots.txt'
11
+ super
12
+ end
13
+ end
14
+
15
+ Octopress.register_plugin(TestPlugin, 'awesome-sauce')
16
+
@@ -1,2 +1,5 @@
1
1
  test: config from theme
2
2
  test_override: also config from theme
3
+ pages:
4
+ test:
5
+ url: /awesome/
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: theme:default
3
+ url_config: pages.test.path
4
+ ---
5
+
6
+ Testing pages. **strong** *emphasized* [a link](http://example.com)
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ SUB BABY
@@ -2,7 +2,7 @@ require 'octopress-ink'
2
2
 
3
3
  class TestTheme < Octopress::Plugin
4
4
  def initialize(name, type)
5
- @assets_path = File.expand_path(File.join(File.dirname(__FILE__), 'test-theme'))
5
+ @assets_path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  super
7
7
  end
8
8
  def add_assets
@@ -13,20 +13,4 @@ class TestTheme < Octopress::Plugin
13
13
  end
14
14
  end
15
15
 
16
- class TestPlugin < Octopress::Plugin
17
- def initialize(name, type)
18
- @assets_path = File.expand_path(File.join(File.dirname(__FILE__), 'awesome-sauce'))
19
- super
20
- end
21
-
22
- def add_assets
23
- add_stylesheet 'plugin-test.css'
24
- add_stylesheet 'plugin-media-test.css', 'print'
25
- add_root_file 'robots.txt'
26
- super
27
- end
28
- end
29
-
30
16
  Octopress.register_plugin(TestTheme, 'classic', 'theme')
31
- Octopress.register_plugin(TestPlugin, 'awesome-sauce')
32
-
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <title>Test Post</title>
7
+ <meta name="viewport" content="width=device-width">
8
+ </head>
9
+ <body class=" ">
10
+ <div class='local-override'><p>Test post <strong>strong</strong> <em>emphasized</em> <a href="http://example.com">some link</a></p>
11
+ </div>
12
+
13
+ </body>
14
+ </html>
data/test/site/index.html CHANGED
@@ -26,6 +26,8 @@
26
26
  <li>concat_css</li>
27
27
  <li>concat_js</li>
28
28
  </ul>
29
+
30
+ <p>one <span class='separator'></b> two <span class='separator'></b> three <span class='separator'></b> four five</p>
29
31
  </div>
30
32
 
31
33
  </body>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <title></title>
7
+ <meta name="viewport" content="width=device-width">
8
+ </head>
9
+ <body class=" ">
10
+ <p>Testing pages override. <strong>strong</strong> <em>emphasized</em> <a href="http://example.com">a link</a></p>
11
+
12
+ </body>
13
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <title></title>
7
+ <meta name="viewport" content="width=device-width">
8
+ </head>
9
+ <body class=" ">
10
+ <p><strong>strong</strong> <em>emphasized</em> <a href="http://example.com">a link</a></p>
11
+
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ Woohoo
@@ -0,0 +1 @@
1
+
@@ -17,3 +17,5 @@ hi → hi
17
17
  um, hi → um, hi
18
18
 
19
19
 
20
+ ## Test filters
21
+ foo bar baz booga → foo bar baz booga
@@ -0,0 +1,4 @@
1
+ omg → omg
2
+ OMG → OMG
3
+ BOOGIE → BOOGIE
4
+ boogie → boogie
@@ -8,6 +8,7 @@
8
8
 
9
9
  ## Filter testing
10
10
  [- TESTING INCLUDE -] → [- TESTING INCLUDE -]
11
+ [= TESTING INCLUDE =] → [= TESTING INCLUDE =]
11
12
  [- TESTING FILTERS -] → [- TESTING FILTERS -]
12
13
 
13
14
  ## Conditional wrap
@@ -1,2 +1 @@
1
- test: config from plugin
2
- test_override: also config from plugin
1
+ test_override: config from plugin override