octopress-ink 1.0.0.alpha.31 → 1.0.0.alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/octopress-ink.rb +92 -37
- data/lib/octopress-ink/assets.rb +12 -10
- data/lib/octopress-ink/assets/asset.rb +91 -80
- data/lib/octopress-ink/assets/config.rb +29 -27
- data/lib/octopress-ink/assets/include.rb +11 -9
- data/lib/octopress-ink/assets/javascript.rb +7 -4
- data/lib/octopress-ink/assets/layout.rb +16 -11
- data/lib/octopress-ink/assets/page.rb +32 -30
- data/lib/octopress-ink/assets/root.rb +17 -15
- data/lib/octopress-ink/assets/sass.rb +48 -46
- data/lib/octopress-ink/assets/stylesheet.rb +25 -23
- data/lib/octopress-ink/commands.rb +23 -0
- data/lib/octopress-ink/commands/helpers.rb +19 -0
- data/lib/octopress-ink/commands/info.rb +24 -0
- data/lib/octopress-ink/filters.rb +112 -109
- data/lib/octopress-ink/generators/plugin_assets.rb +8 -6
- data/lib/octopress-ink/helpers.rb +7 -5
- data/lib/octopress-ink/helpers/conditional.rb +16 -14
- data/lib/octopress-ink/helpers/content_for.rb +23 -20
- data/lib/octopress-ink/helpers/path.rb +51 -48
- data/lib/octopress-ink/helpers/var.rb +82 -80
- data/lib/octopress-ink/jekyll/hooks.rb +2 -2
- data/lib/octopress-ink/jekyll/page.rb +38 -35
- data/lib/octopress-ink/jekyll/static_file.rb +18 -16
- data/lib/octopress-ink/jekyll/static_file_content.rb +8 -6
- data/lib/octopress-ink/plugin.rb +189 -144
- data/lib/octopress-ink/plugins.rb +249 -230
- data/lib/octopress-ink/plugins/stylesheets.rb +37 -35
- data/lib/octopress-ink/tags.rb +16 -14
- data/lib/octopress-ink/tags/abort.rb +15 -12
- data/lib/octopress-ink/tags/assign.rb +21 -19
- data/lib/octopress-ink/tags/capture.rb +26 -24
- data/lib/octopress-ink/tags/content_for.rb +15 -12
- data/lib/octopress-ink/tags/filter.rb +16 -13
- data/lib/octopress-ink/tags/include.rb +40 -38
- data/lib/octopress-ink/tags/javascript.rb +6 -4
- data/lib/octopress-ink/tags/line_comment.rb +6 -3
- data/lib/octopress-ink/tags/render.rb +53 -51
- data/lib/octopress-ink/tags/return.rb +12 -9
- data/lib/octopress-ink/tags/stylesheet.rb +6 -4
- data/lib/octopress-ink/tags/wrap.rb +62 -60
- data/lib/octopress-ink/tags/yield.rb +23 -20
- data/lib/octopress-ink/version.rb +1 -1
- data/octopress-ink.gemspec +1 -1
- data/test/Gemfile +3 -2
- data/test/_config.yml +2 -0
- data/test/plugins/awesome-sauce/plugin.rb +3 -2
- data/test/plugins/test-theme/plugin.rb +3 -2
- metadata +7 -4
@@ -2,51 +2,53 @@
|
|
2
2
|
# the Plugins module.
|
3
3
|
#
|
4
4
|
module Octopress
|
5
|
-
|
6
|
-
|
5
|
+
module Ink
|
6
|
+
class StylesheetsPlugin < Octopress::Ink::Plugin
|
7
|
+
def add_files
|
7
8
|
|
8
|
-
|
9
|
+
add_stylesheets local_stylesheets
|
9
10
|
|
10
|
-
|
11
|
+
remove_jekyll_assets @sass
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
if Plugins.concat_css
|
14
|
+
remove_jekyll_assets @stylesheets
|
15
|
+
end
|
14
16
|
end
|
15
|
-
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
else
|
29
|
-
if file =~ /\.css/
|
30
|
-
add_stylesheet file
|
18
|
+
def add_stylesheets(files)
|
19
|
+
files = [files] unless files.is_a? Array
|
20
|
+
files.each do |file|
|
21
|
+
# accept ['file', 'media_type']
|
22
|
+
if file.is_a? Array
|
23
|
+
if file.first =~ /\.css/
|
24
|
+
add_stylesheet file.first, file.last
|
25
|
+
else
|
26
|
+
add_sass file.first, file.last
|
27
|
+
end
|
28
|
+
# accept 'file'
|
31
29
|
else
|
32
|
-
|
30
|
+
if file =~ /\.css/
|
31
|
+
add_stylesheet file
|
32
|
+
else
|
33
|
+
add_sass file
|
34
|
+
end
|
33
35
|
end
|
34
36
|
end
|
37
|
+
files
|
35
38
|
end
|
36
|
-
files
|
37
|
-
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
def local_stylesheets
|
41
|
+
config = Plugins.site.config
|
42
|
+
source = Plugins.site.source
|
43
|
+
if config['octopress'] && config['octopress']['stylesheets']
|
44
|
+
config['octopress']['stylesheets'] || []
|
45
|
+
else
|
46
|
+
dir = File.join(source, 'stylesheets/')
|
47
|
+
css = Dir.glob(File.join(dir, '**/*.css'))
|
48
|
+
sass = Dir.glob(File.join(dir, '**/*.s[ca]ss')).reject { |f| File.basename(f) =~ /^_.*?s[ac]ss/ }
|
49
|
+
files = css.concat sass
|
50
|
+
files.map { |f| f.split(dir).last }
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
data/lib/octopress-ink/tags.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
module Octopress
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
2
|
+
module Ink
|
3
|
+
module Tags
|
4
|
+
autoload :IncludeTag, 'octopress-ink/tags/include'
|
5
|
+
autoload :AssignTag, 'octopress-ink/tags/assign'
|
6
|
+
autoload :ReturnTag, 'octopress-ink/tags/return'
|
7
|
+
autoload :FilterTag, 'octopress-ink/tags/filter'
|
8
|
+
autoload :RenderTag, 'octopress-ink/tags/render'
|
9
|
+
autoload :CaptureTag, 'octopress-ink/tags/capture'
|
10
|
+
autoload :JavascriptTag, 'octopress-ink/tags/javascript'
|
11
|
+
autoload :StylesheetTag, 'octopress-ink/tags/stylesheet'
|
12
|
+
autoload :ContentForTag, 'octopress-ink/tags/content_for'
|
13
|
+
autoload :YieldTag, 'octopress-ink/tags/yield'
|
14
|
+
autoload :WrapTag, 'octopress-ink/tags/wrap'
|
15
|
+
autoload :AbortTag, 'octopress-ink/tags/abort'
|
16
|
+
autoload :LineCommentTag, 'octopress-ink/tags/line_comment'
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -1,19 +1,22 @@
|
|
1
1
|
module Octopress
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
module Ink
|
3
|
+
module Tags
|
4
|
+
class AbortTag < Liquid::Tag
|
5
|
+
def initialize(tag_name, markup, tokens)
|
6
|
+
super
|
7
|
+
@markup = " #{markup}"
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
def render(context)
|
11
|
+
if Helpers::Conditional.parse(@markup, context)
|
12
|
+
env = context.environments.first
|
13
|
+
dest = File.join(Helpers::Path.site_dir, env['page']['url'])
|
14
|
+
context.environments.first['site']['pages'] = Helpers::Path.remove_page(dest)
|
15
|
+
end
|
16
|
+
''
|
14
17
|
end
|
15
|
-
''
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
22
|
+
|
@@ -1,29 +1,31 @@
|
|
1
1
|
module Octopress
|
2
|
-
module
|
3
|
-
|
4
|
-
|
2
|
+
module Ink
|
3
|
+
module Tags
|
4
|
+
class AssignTag < Liquid::Tag
|
5
|
+
SYNTAX = /([[:word:]]+)\s*(=|\+=|\|\|=)\s*(.*)\s*/o
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def initialize(tag_name, markup, tokens)
|
8
|
+
@markup = markup
|
9
|
+
super
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
def render(context)
|
13
|
+
return unless markup = Helpers::Conditional.parse(@markup, context)
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
if markup =~ SYNTAX
|
16
|
+
var = $1
|
17
|
+
operator = $2
|
18
|
+
value = $3
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
value = Helpers::Var.get_value(value, context)
|
21
|
+
return if value.nil?
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
context = Helpers::Var.set_var(var, operator, value, context)
|
24
|
+
else
|
25
|
+
raise SyntaxError.new("Syntax Error in 'assign tag': #{@markup} - Valid syntax: assign [var] = [source] | filter")
|
26
|
+
end
|
27
|
+
''
|
25
28
|
end
|
26
|
-
''
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
@@ -1,34 +1,36 @@
|
|
1
1
|
module Octopress
|
2
|
-
module
|
3
|
-
|
4
|
-
|
2
|
+
module Ink
|
3
|
+
module Tags
|
4
|
+
class CaptureTag < Liquid::Block
|
5
|
+
SYNTAX = /([[:word:]]+)\s*(\+=|\|\|=)?/o
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def render(context)
|
12
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
13
|
-
if markup =~ Helpers::Var::HAS_FILTERS
|
14
|
-
markup = $1
|
15
|
-
filters = $2
|
7
|
+
def initialize(tag_name, markup, tokens)
|
8
|
+
@markup = markup
|
9
|
+
super
|
16
10
|
end
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
unless value.nil? || filters.nil?
|
24
|
-
value = Helpers::Var.render_filters(value, filters, context)
|
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
|
25
17
|
end
|
26
18
|
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
if markup =~ SYNTAX
|
20
|
+
var = $1
|
21
|
+
operator = $2
|
22
|
+
value = super.lstrip
|
23
|
+
|
24
|
+
unless value.nil? || filters.nil?
|
25
|
+
value = Helpers::Var.render_filters(value, filters, context)
|
26
|
+
end
|
27
|
+
|
28
|
+
context = Helpers::Var.set_var(var, operator, value, context)
|
29
|
+
else
|
30
|
+
raise SyntaxError.new("Syntax Error in 'capture' - Valid syntax: capture [var]")
|
31
|
+
end
|
32
|
+
''
|
30
33
|
end
|
31
|
-
''
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -1,21 +1,24 @@
|
|
1
1
|
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
2
2
|
module Octopress
|
3
|
-
module
|
4
|
-
|
3
|
+
module Ink
|
4
|
+
module Tags
|
5
|
+
class ContentForTag < Liquid::Block
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def initialize(tag_name, markup, tokens)
|
8
|
+
super
|
9
|
+
@tag_name = tag_name
|
10
|
+
@markup = markup
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
def render(context)
|
14
|
+
return unless markup = Helpers::Conditional.parse(@markup, context)
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
@block_name ||= Helpers::ContentFor.get_block_name(@tag_name, markup)
|
17
|
+
Helpers::ContentFor.append_to_block(context, @block_name, super)
|
18
|
+
''
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
24
|
+
|
@@ -1,21 +1,24 @@
|
|
1
1
|
module Octopress
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
def render(context)
|
11
|
+
content = super.strip
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
16
17
|
|
17
|
-
|
18
|
+
content
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
24
|
+
|
@@ -1,49 +1,51 @@
|
|
1
1
|
module Octopress
|
2
|
-
module
|
3
|
-
|
4
|
-
|
2
|
+
module Ink
|
3
|
+
module Tags
|
4
|
+
class IncludeTag < Liquid::Tag
|
5
|
+
PLUGIN_SYNTAX = /(.+?):(\S+)/
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def render(context)
|
12
|
-
return unless markup = Helpers::Conditional.parse(@markup, context)
|
13
|
-
if markup =~ Helpers::Var::HAS_FILTERS
|
14
|
-
markup = $1
|
15
|
-
filters = $2
|
7
|
+
def initialize(tag_name, markup, tokens)
|
8
|
+
super
|
9
|
+
@og_markup = @markup = markup
|
16
10
|
end
|
17
|
-
markup = Helpers::Var.evaluate_ternary(markup, context)
|
18
|
-
markup = Helpers::Path.parse(markup, context)
|
19
11
|
|
20
|
-
|
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, [])
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
30
41
|
end
|
31
|
-
partial = Liquid::Template.parse(content)
|
32
|
-
content = context.stack {
|
33
|
-
context['include'] = include_tag.parse_params(context)
|
34
|
-
partial.render!(context)
|
35
|
-
}.strip
|
36
|
-
|
37
|
-
# Otherwise, use Jekyll's default include tag
|
38
|
-
else
|
39
|
-
content = include_tag.render(context).strip
|
40
|
-
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
unless content.nil? || filters.nil?
|
44
|
+
content = Helpers::Var.render_filters(content, filters, context)
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
+
content
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|