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
@@ -1,24 +0,0 @@
|
|
1
|
-
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
2
|
-
module Octopress
|
3
|
-
module Ink
|
4
|
-
module Tags
|
5
|
-
class ContentForTag < Liquid::Block
|
6
|
-
|
7
|
-
def initialize(tag_name, markup, tokens)
|
8
|
-
super
|
9
|
-
@tag_name = tag_name
|
10
|
-
@markup = markup
|
11
|
-
end
|
12
|
-
|
13
|
-
def render(context)
|
14
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
15
|
-
|
16
|
-
@block_name ||= Helpers::ContentFor.get_block_name(@tag_name, markup)
|
17
|
-
Helpers::ContentFor.append_to_block(context, @block_name, super)
|
18
|
-
''
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
module Ink
|
3
|
-
module Tags
|
4
|
-
class FilterTag < Liquid::Block
|
5
|
-
def initialize(tag_name, markup, tokens)
|
6
|
-
super
|
7
|
-
@markup = " #{markup}"
|
8
|
-
end
|
9
|
-
|
10
|
-
def render(context)
|
11
|
-
content = super.strip
|
12
|
-
|
13
|
-
return content unless markup = Helpers::Conditional.parse(@markup, context)
|
14
|
-
if markup =~ Helpers::Var::HAS_FILTERS and !content.nil?
|
15
|
-
content = Helpers::Var.render_filters(content, $2, context)
|
16
|
-
end
|
17
|
-
|
18
|
-
content
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
module Ink
|
3
|
-
module Tags
|
4
|
-
class IncludeTag < Liquid::Tag
|
5
|
-
PLUGIN_SYNTAX = /(.+?):(\S+)/
|
6
|
-
|
7
|
-
def initialize(tag_name, markup, tokens)
|
8
|
-
super
|
9
|
-
@og_markup = @markup = markup
|
10
|
-
end
|
11
|
-
|
12
|
-
def render(context)
|
13
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
14
|
-
if markup =~ Helpers::Var::HAS_FILTERS
|
15
|
-
markup = $1
|
16
|
-
filters = $2
|
17
|
-
end
|
18
|
-
markup = Helpers::Var.evaluate_ternary(markup, context)
|
19
|
-
markup = Helpers::Path.parse(markup, context)
|
20
|
-
|
21
|
-
include_tag = Jekyll::Tags::IncludeTag.new('include', markup, [])
|
22
|
-
|
23
|
-
# If markup references a plugin e.g. plugin-name:include-file.html
|
24
|
-
if markup.strip =~ PLUGIN_SYNTAX
|
25
|
-
plugin = $1
|
26
|
-
path = $2
|
27
|
-
begin
|
28
|
-
content = Plugins.include(plugin, path).read
|
29
|
-
rescue => error
|
30
|
-
raise IOError.new "Include failed: {% #{@tag_name} #{@og_markup}%}. The plugin '#{plugin}' does not have an include named '#{path}'."
|
31
|
-
end
|
32
|
-
partial = Liquid::Template.parse(content)
|
33
|
-
content = context.stack {
|
34
|
-
context['include'] = include_tag.parse_params(context)
|
35
|
-
partial.render!(context)
|
36
|
-
}.strip
|
37
|
-
|
38
|
-
# Otherwise, use Jekyll's default include tag
|
39
|
-
else
|
40
|
-
content = include_tag.render(context).strip
|
41
|
-
end
|
42
|
-
|
43
|
-
unless content.nil? || filters.nil?
|
44
|
-
content = Helpers::Var.render_filters(content, filters, context)
|
45
|
-
end
|
46
|
-
|
47
|
-
content
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
@@ -1,85 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
module Ink
|
3
|
-
module Tags
|
4
|
-
class RenderTag < Liquid::Tag
|
5
|
-
SYNTAX = /(\S+)(.+)?/
|
6
|
-
|
7
|
-
def initialize(tag_name, markup, tokens)
|
8
|
-
super
|
9
|
-
@og_markup = @markup = markup
|
10
|
-
if markup =~ /^(\s*raw\s)?(.+?)(\sraw\s*)?$/
|
11
|
-
@markup = $2
|
12
|
-
@raw = true unless $1.nil? and $3.nil?
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def render(context)
|
17
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
18
|
-
if markup =~ Helpers::Var::HAS_FILTERS
|
19
|
-
markup = $1
|
20
|
-
filters = $2
|
21
|
-
end
|
22
|
-
markup = Helpers::Var.evaluate_ternary(markup, context)
|
23
|
-
markup = Helpers::Path.parse(markup, context)
|
24
|
-
|
25
|
-
content = read(markup, context)
|
26
|
-
|
27
|
-
if content =~ /\A-{3}(.+[^\A])-{3}\n(.+)/m
|
28
|
-
local_vars = SafeYAML.load($1.strip)
|
29
|
-
content = $2.strip
|
30
|
-
end
|
31
|
-
|
32
|
-
raw_content = {}
|
33
|
-
|
34
|
-
content = content.gsub /{%\s*raw\s*%}(.+?){% endraw %}/m do
|
35
|
-
data = $1
|
36
|
-
key = Digest::MD5.hexdigest(data)
|
37
|
-
raw_content[key] = "{% raw %}#{data}{% endraw %}"
|
38
|
-
key
|
39
|
-
end
|
40
|
-
|
41
|
-
return content if @raw
|
42
|
-
|
43
|
-
include_tag = Jekyll::Tags::IncludeTag.new('include', markup, [])
|
44
|
-
|
45
|
-
partial = Liquid::Template.parse(content)
|
46
|
-
content = context.stack {
|
47
|
-
context['include'] = include_tag.parse_params(context)
|
48
|
-
if local_vars
|
49
|
-
context['page'] = Jekyll::Utils.deep_merge_hashes(context['page'], local_vars)
|
50
|
-
end
|
51
|
-
partial.render!(context)
|
52
|
-
}.strip
|
53
|
-
|
54
|
-
raw_content.each { |k, v| content.sub!(k, v) }
|
55
|
-
|
56
|
-
content = parse_convertible(content, context).strip
|
57
|
-
|
58
|
-
unless content.nil? || filters.nil?
|
59
|
-
content = Helpers::Var.render_filters(content, filters, context)
|
60
|
-
end
|
61
|
-
|
62
|
-
content
|
63
|
-
end
|
64
|
-
|
65
|
-
def read(markup, context)
|
66
|
-
path = markup.match(SYNTAX)[1]
|
67
|
-
@path = Helpers::Path.expand(path, context)
|
68
|
-
begin
|
69
|
-
File.open(@path).read
|
70
|
-
rescue
|
71
|
-
raise IOError.new "Render failed: {% #{@tag_name} #{@og_markup}%}. The file '#{path}' could not be found at #{@path}."
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def parse_convertible(content, context)
|
76
|
-
page = Jekyll::ConvertiblePartial.new(context.registers[:site], @path, content)
|
77
|
-
page.render({})
|
78
|
-
page.output.strip
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
module Ink
|
3
|
-
module Tags
|
4
|
-
class ReturnTag < Liquid::Tag
|
5
|
-
def initialize(tag_name, markup, tokens)
|
6
|
-
@markup = markup.strip
|
7
|
-
super
|
8
|
-
end
|
9
|
-
|
10
|
-
def render(context)
|
11
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
12
|
-
|
13
|
-
Helpers::Var.get_value(markup, context)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
2
|
-
#
|
3
|
-
module Octopress
|
4
|
-
module Ink
|
5
|
-
module Tags
|
6
|
-
class WrapTag < Liquid::Block
|
7
|
-
|
8
|
-
def initialize(tag_name, markup, tokens)
|
9
|
-
super
|
10
|
-
@og_markup = @markup = markup
|
11
|
-
@tag_name = tag_name
|
12
|
-
end
|
13
|
-
|
14
|
-
def render(context)
|
15
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
16
|
-
|
17
|
-
if markup =~ Helpers::Var::HAS_FILTERS
|
18
|
-
markup = $1
|
19
|
-
filters = $2
|
20
|
-
end
|
21
|
-
|
22
|
-
type = if markup =~ /^\s*yield\s(.+)/
|
23
|
-
markup = $1
|
24
|
-
'yield'
|
25
|
-
elsif markup =~ /^\s*render\s(.+)/
|
26
|
-
markup = $1
|
27
|
-
'render'
|
28
|
-
elsif markup =~ /^\s*include\s(.+)/
|
29
|
-
markup = $1
|
30
|
-
'include'
|
31
|
-
else
|
32
|
-
raise IOError.new "Wrap Failed: {% wrap #{@og_markup}%} - Which type of wrap: inlcude, yield, render? - Correct syntax: {% wrap type path or var [filters] [conditions] %}"
|
33
|
-
end
|
34
|
-
|
35
|
-
case type
|
36
|
-
when 'yield'
|
37
|
-
content = Tags::YieldTag.new('yield', markup, []).render(context)
|
38
|
-
when 'render'
|
39
|
-
begin
|
40
|
-
content = Tags::RenderTag.new('render', markup, []).render(context)
|
41
|
-
rescue => error
|
42
|
-
error_msg error
|
43
|
-
end
|
44
|
-
when 'include'
|
45
|
-
begin
|
46
|
-
content = Tags::IncludeTag.new('include', markup, []).render(context)
|
47
|
-
rescue => error
|
48
|
-
error_msg error
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# just in case yield had a value
|
53
|
-
old_yield = context.scopes.first['yield']
|
54
|
-
context.scopes.first['yield'] = content
|
55
|
-
|
56
|
-
content = super.strip
|
57
|
-
context.scopes.first['yield'] = old_yield
|
58
|
-
|
59
|
-
unless content.nil? || filters.nil?
|
60
|
-
content = Helpers::Var.render_filters(content, filters, context)
|
61
|
-
end
|
62
|
-
|
63
|
-
content
|
64
|
-
end
|
65
|
-
|
66
|
-
def error_msg(error)
|
67
|
-
error.message
|
68
|
-
message = "Wrap failed: {% #{@tag_name} #{@og_markup}%}."
|
69
|
-
message << $1 if error.message =~ /%}\.(.+)/
|
70
|
-
raise IOError.new message
|
71
|
-
end
|
72
|
-
|
73
|
-
def content_for(markup, context)
|
74
|
-
@block_name = Helpers::ContentFor.get_block_name(@tag_name, markup)
|
75
|
-
Helpers::ContentFor.render(context, @block_name).strip
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
2
|
-
#
|
3
|
-
module Octopress
|
4
|
-
module Ink
|
5
|
-
module Tags
|
6
|
-
class YieldTag < Liquid::Tag
|
7
|
-
|
8
|
-
def initialize(tag_name, markup, tokens)
|
9
|
-
if markup.strip == ''
|
10
|
-
raise IOError.new "Yield failed: {% #{tag_name} #{markup}%}. Please provide a block name to yield. - Syntax: {% yield block_name %}"
|
11
|
-
end
|
12
|
-
|
13
|
-
super
|
14
|
-
@markup = markup
|
15
|
-
if markup =~ Helpers::Var::HAS_FILTERS
|
16
|
-
markup = $1
|
17
|
-
@filters = $2
|
18
|
-
end
|
19
|
-
@block_name = Helpers::ContentFor.get_block_name(tag_name, markup)
|
20
|
-
end
|
21
|
-
|
22
|
-
def render(context)
|
23
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
24
|
-
content = Helpers::ContentFor.render(context, @block_name)
|
25
|
-
|
26
|
-
unless content.nil? || @filters.nil?
|
27
|
-
content = Helpers::Var.render_filters(content, @filters, context)
|
28
|
-
end
|
29
|
-
|
30
|
-
content
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
data/lib/octopress-ink/utils.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
module Utils
|
3
|
-
|
4
|
-
# Smart capitalization for titles
|
5
|
-
#
|
6
|
-
def self.titlecase(input)
|
7
|
-
small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs.)
|
8
|
-
|
9
|
-
x = input.split(" ").map do |word|
|
10
|
-
# note: word could contain non-word characters!
|
11
|
-
# downcase all small_words, capitalize the rest
|
12
|
-
small_words.include?(word.gsub(/\W/, "").downcase) ? word.downcase! : smart_capitalize!(word)
|
13
|
-
word
|
14
|
-
end
|
15
|
-
# capitalize first and last words
|
16
|
-
smart_capitalize!(x.first)
|
17
|
-
smart_capitalize!(x.last)
|
18
|
-
# small words are capitalized after colon, period, exclamation mark, question mark
|
19
|
-
x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{smart_capitalize($2)} " }
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.titlecase!(input)
|
23
|
-
input.replace(titlecase(input))
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.smart_capitalize(input)
|
27
|
-
target = input.dup
|
28
|
-
# ignore any leading crazy characters and capitalize the first real character
|
29
|
-
if target =~ /^['"\(\[']*([a-z])/
|
30
|
-
i = input.index($1)
|
31
|
-
x = target[i,target.length]
|
32
|
-
# word with capitals and periods mid-word are left alone
|
33
|
-
target[i,1] = target[i,1].upcase unless x =~ /[A-Z]/ or x =~ /\.\w+/
|
34
|
-
end
|
35
|
-
target
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.smart_capitalize!(input)
|
39
|
-
input.replace(smart_capitalize(input))
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
.do-not-exist { background: black; }
|
data/test/expected/index.html
DELETED
@@ -1,71 +0,0 @@
|
|
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>Your New Jekyll Site</title>
|
7
|
-
<meta name="viewport" content="width=device-width">
|
8
|
-
</head>
|
9
|
-
<body class=" ">
|
10
|
-
<div class='local-override'>
|
11
|
-
one <span class='separator'></b> two <span class='separator'></b> three <span class='separator'></b> four five
|
12
|
-
|
13
|
-
|
14
|
-
title: Another Test Post
|
15
|
-
title text: Another Test Post
|
16
|
-
title html: Another Test Post
|
17
|
-
title url: /2014/02/02/test-post-2.html
|
18
|
-
linkpost: false
|
19
|
-
|
20
|
-
date: 2014-02-02 00:00:00 -0600
|
21
|
-
date_xml: 2014-02-02T00:00:00-06:00
|
22
|
-
date_html: <time class='entry-date' datetime='2014-02-02T00:00:00-06:00' pubdate><span class='date-month'>Feb</span> <span class='date-day'>2</span><span class='date-suffix'>nd</span>, <span class='date-year'>2014</span></time>
|
23
|
-
|
24
|
-
content: <p>some random post
|
25
|
-
<a href="/food">relative link</a></p>
|
26
|
-
|
27
|
-
title: Test Post
|
28
|
-
title text: Test Post →
|
29
|
-
title html: Test Post <span class='post-marker post-marker-after'>→</span>
|
30
|
-
title url: http://timecube.com
|
31
|
-
linkpost: true
|
32
|
-
|
33
|
-
date: 2014-02-01 00:00:00 -0600
|
34
|
-
date_xml: 2014-02-01T00:00:00-06:00
|
35
|
-
date_html: <time class='entry-date' datetime='2014-02-01T00:00:00-06:00' pubdate><span class='date-month'>Feb</span> <span class='date-day'>1</span><span class='date-suffix'>st</span>, <span class='date-year'>2014</span></time>
|
36
|
-
|
37
|
-
content: <p>Test post <strong>strong</strong> <em>emphasized</em> <a href="http://example.com">some link</a></p>
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
title: Another Test Post
|
42
|
-
title text: Another Test Post
|
43
|
-
title html: Another Test Post
|
44
|
-
title url: /2014/02/02/test-post-2.html
|
45
|
-
linkpost: false
|
46
|
-
|
47
|
-
date: 2014-02-02 00:00:00 -0600
|
48
|
-
date_xml: 2014-02-02T00:00:00-06:00
|
49
|
-
date_html: <time class='entry-date' datetime='2014-02-02T00:00:00-06:00' pubdate><span class='date-month'>Feb</span> <span class='date-day'>2</span><span class='date-suffix'>nd</span>, <span class='date-year'>2014</span></time>
|
50
|
-
|
51
|
-
content: <p>some random post
|
52
|
-
<a href="/food">relative link</a></p>
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
title: Test Post
|
57
|
-
title text: Test Post →
|
58
|
-
title html: Test Post <span class='post-marker post-marker-after'>→</span>
|
59
|
-
title url: http://timecube.com
|
60
|
-
linkpost: true
|
61
|
-
|
62
|
-
date: 2014-02-01 00:00:00 -0600
|
63
|
-
date_xml: 2014-02-01T00:00:00-06:00
|
64
|
-
date_html: <time class='entry-date' datetime='2014-02-01T00:00:00-06:00' pubdate><span class='date-month'>Feb</span> <span class='date-day'>1</span><span class='date-suffix'>st</span>, <span class='date-year'>2014</span></time>
|
65
|
-
|
66
|
-
content: <p>Test post <strong>strong</strong> <em>emphasized</em> <a href="http://example.com">some link</a></p>
|
67
|
-
|
68
|
-
</div>
|
69
|
-
|
70
|
-
</body>
|
71
|
-
</html>
|