awestruct 0.2.18 → 0.4.2.x1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/awestruct +2 -274
- data/lib/awestruct/astruct.rb +22 -0
- data/lib/awestruct/astruct_mixin.rb +81 -0
- data/lib/awestruct/cli/auto.rb +34 -0
- data/lib/awestruct/cli/deploy.rb +38 -0
- data/lib/awestruct/{commands → cli}/generate.rb +3 -3
- data/lib/awestruct/cli/invoker.rb +120 -0
- data/lib/awestruct/cli/options.rb +116 -0
- data/lib/awestruct/{commands → cli}/server.rb +1 -1
- data/lib/awestruct/config.rb +20 -8
- data/lib/awestruct/context.rb +22 -0
- data/lib/awestruct/dependencies.rb +102 -0
- data/lib/awestruct/deploy/github_pages_deploy.rb +61 -0
- data/lib/awestruct/{commands/deploy.rb → deploy/rsync_deploy.rb} +10 -6
- data/lib/awestruct/deployers.rb +15 -0
- data/lib/awestruct/engine.rb +172 -411
- data/lib/awestruct/extensions/atomizer.rb +7 -4
- data/lib/awestruct/extensions/coffeescripttransform.rb +42 -0
- data/lib/awestruct/extensions/minify.rb +21 -23
- data/lib/awestruct/extensions/paginator.rb +6 -4
- data/lib/awestruct/extensions/partial.rb +0 -1
- data/lib/awestruct/extensions/pipeline.rb +5 -0
- data/lib/awestruct/extensions/posts.rb +11 -9
- data/lib/awestruct/extensions/sitemap.rb +2 -1
- data/lib/awestruct/extensions/tagger.rb +0 -2
- data/lib/awestruct/extensions/template.atom.haml +4 -3
- data/lib/awestruct/handler_chain.rb +28 -0
- data/lib/awestruct/handler_chains.rb +48 -0
- data/lib/awestruct/handlers/asciidoc_handler.rb +57 -0
- data/lib/awestruct/handlers/base_handler.rb +111 -0
- data/lib/awestruct/handlers/base_sass_handler.rb +42 -0
- data/lib/awestruct/handlers/coffeescript_handler.rb +48 -0
- data/lib/awestruct/handlers/erb_handler.rb +44 -0
- data/lib/awestruct/handlers/file_handler.rb +64 -0
- data/lib/awestruct/handlers/front_matter_handler.rb +85 -0
- data/lib/awestruct/handlers/haml_handler.rb +54 -0
- data/lib/awestruct/handlers/interpolation_handler.rb +28 -0
- data/lib/awestruct/handlers/layout_handler.rb +63 -0
- data/lib/awestruct/handlers/markdown_handler.rb +50 -0
- data/lib/awestruct/handlers/no_op_handler.rb +34 -0
- data/lib/awestruct/handlers/orgmode_handler.rb +48 -0
- data/lib/awestruct/handlers/page_delegating_handler.rb +54 -0
- data/lib/awestruct/handlers/restructuredtext_handler.rb +67 -0
- data/lib/awestruct/handlers/sass_handler.rb +21 -0
- data/lib/awestruct/handlers/scss_handler.rb +21 -0
- data/lib/awestruct/handlers/string_handler.rb +29 -0
- data/lib/awestruct/handlers/textile_handler.rb +58 -0
- data/lib/awestruct/handlers/yaml_handler.rb +25 -0
- data/lib/awestruct/layouts.rb +16 -0
- data/lib/awestruct/page.rb +141 -0
- data/lib/awestruct/page_loader.rb +82 -0
- data/lib/awestruct/pipeline.rb +56 -0
- data/lib/awestruct/site.rb +29 -35
- data/lib/awestruct/version.rb +1 -1
- data/lib/guard/awestruct.rb +38 -0
- metadata +115 -88
- data/lib/awestruct.rb +0 -2
- data/lib/awestruct/asciidoc_file.rb +0 -24
- data/lib/awestruct/asciidocable.rb +0 -35
- data/lib/awestruct/commands/frameworks/960/base_layout.html.haml +0 -10
- data/lib/awestruct/commands/frameworks/base_index.html.haml +0 -5
- data/lib/awestruct/commands/frameworks/base_pipeline.rb +0 -6
- data/lib/awestruct/commands/frameworks/blueprint/base_layout.html.haml +0 -12
- data/lib/awestruct/commands/frameworks/bootstrap/base_index.html.haml +0 -27
- data/lib/awestruct/commands/frameworks/bootstrap/base_layout.html.haml +0 -29
- data/lib/awestruct/commands/git_hub_pages.rb +0 -55
- data/lib/awestruct/commands/init.rb +0 -40
- data/lib/awestruct/commands/manifest.rb +0 -205
- data/lib/awestruct/erb_file.rb +0 -24
- data/lib/awestruct/erbable.rb +0 -19
- data/lib/awestruct/front_matter_file.rb +0 -54
- data/lib/awestruct/haml/filters/asciidoc.rb +0 -8
- data/lib/awestruct/haml_file.rb +0 -27
- data/lib/awestruct/hamlable.rb +0 -19
- data/lib/awestruct/markdown_file.rb +0 -23
- data/lib/awestruct/markdownable.rb +0 -18
- data/lib/awestruct/orgmode_file.rb +0 -23
- data/lib/awestruct/orgmodeable.rb +0 -15
- data/lib/awestruct/renderable.rb +0 -18
- data/lib/awestruct/renderable_file.rb +0 -39
- data/lib/awestruct/restructuredtext_file.rb +0 -23
- data/lib/awestruct/restructuredtextable.rb +0 -38
- data/lib/awestruct/sass_file.rb +0 -24
- data/lib/awestruct/sassable.rb +0 -33
- data/lib/awestruct/scss_file.rb +0 -24
- data/lib/awestruct/textilable.rb +0 -22
- data/lib/awestruct/textile_file.rb +0 -23
- data/lib/awestruct/verbatim_file.rb +0 -12
@@ -2,14 +2,16 @@ module Awestruct
|
|
2
2
|
module Extensions
|
3
3
|
class Atomizer
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(entries, output_path, opts={})
|
6
|
+
@entries = entries
|
7
7
|
@output_path = output_path
|
8
8
|
@num_entries = opts[:num_entries] || 50
|
9
|
+
@content_url = opts[:content_url]
|
10
|
+
@feed_title = opts[:feed_title]
|
9
11
|
end
|
10
12
|
|
11
13
|
def execute(site)
|
12
|
-
entries = site.send( @
|
14
|
+
entries = @entries.is_a?(Array) ? @entries : site.send( @entries ) || []
|
13
15
|
unless ( @num_entries == :all )
|
14
16
|
entries = entries[0, @num_entries]
|
15
17
|
end
|
@@ -32,7 +34,8 @@ module Awestruct
|
|
32
34
|
page.date = page.timestamp unless page.timestamp.nil?
|
33
35
|
page.output_path = @output_path
|
34
36
|
page.entries = atom_pages
|
35
|
-
page.title = site.title || site.base_url
|
37
|
+
page.title = @feed_title || site.title || site.base_url
|
38
|
+
page.content_url = @content_url || site.base_url
|
36
39
|
site.pages << page
|
37
40
|
end
|
38
41
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'coffee-script'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
##
|
5
|
+
# Awestruct:Extensions:CoffeeScript is a transformer that compiles inline CoffeeScript in HTML files as JavaScript.
|
6
|
+
|
7
|
+
module Awestruct
|
8
|
+
module Extensions
|
9
|
+
class CoffeeScriptTransform
|
10
|
+
|
11
|
+
def transform(site, page, input)
|
12
|
+
ext = File.extname(page.output_path)[1..-1].to_sym
|
13
|
+
case ext
|
14
|
+
when :html
|
15
|
+
encoding = 'UTF-8'
|
16
|
+
encoding = site.encoding unless site.encoding.nil?
|
17
|
+
|
18
|
+
return compile(input, encoding)
|
19
|
+
end
|
20
|
+
return input
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def compile(input, encoding)
|
26
|
+
html = Nokogiri::HTML(input, nil, encoding);
|
27
|
+
html.search('script').each do |script|
|
28
|
+
next unless 'text/coffeescript'.eql? script.attr('type')
|
29
|
+
|
30
|
+
if script.attr('src') =~ /\.coffee$/
|
31
|
+
script.set_attribute('src', File.basename( script.attr('src'), '.coffee' ) + '.js')
|
32
|
+
else
|
33
|
+
script.inner_html = CoffeeScript.compile script.inner_html
|
34
|
+
end
|
35
|
+
script.set_attribute('type', 'text/javascript')
|
36
|
+
|
37
|
+
end
|
38
|
+
return html.to_html
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -12,10 +12,10 @@ require 'fileutils'
|
|
12
12
|
#
|
13
13
|
# These commands must be available on your PATH in order to use them.
|
14
14
|
#
|
15
|
-
# This class is loaded as a transformer
|
15
|
+
# This class is loaded as a transformer into the Awestruct pipeline. The
|
16
16
|
# constructor accepts an array of symbols representing the file types to minimize.
|
17
17
|
#
|
18
|
-
#
|
18
|
+
# transformer Awestruct::Extensions::Minify.new
|
19
19
|
#
|
20
20
|
# This transform recognizes the following symbols:
|
21
21
|
#
|
@@ -57,30 +57,28 @@ module Awestruct
|
|
57
57
|
|
58
58
|
def transform(site, page, input)
|
59
59
|
if site.minify
|
60
|
-
ext = File.extname(page.output_path)
|
61
|
-
if
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
60
|
+
ext = File.extname(page.output_path)
|
61
|
+
if !ext.empty?
|
62
|
+
ext_sym = ext[1..-1].to_sym
|
63
|
+
if @types.include?(ext_sym)
|
64
|
+
case ext_sym
|
65
|
+
when :html
|
66
|
+
print "minifying html #{page.output_path}"
|
67
|
+
input = htmlcompressor(page, input, site.minify_html_opts)
|
68
|
+
when :css
|
69
|
+
print "minifying css #{page.output_path}"
|
70
|
+
input = yuicompressor(page, input, :css)
|
71
|
+
when :js
|
72
|
+
print "minifying js #{page.output_path}"
|
73
|
+
input = yuicompressor(page, input, :js)
|
74
|
+
when :png
|
75
|
+
print "minifying png #{page.output_path}"
|
76
|
+
input = pngcrush(page, input)
|
77
|
+
end
|
77
78
|
end
|
78
|
-
else
|
79
|
-
input
|
80
79
|
end
|
81
|
-
else
|
82
|
-
input
|
83
80
|
end
|
81
|
+
input
|
84
82
|
end
|
85
83
|
|
86
84
|
private
|
@@ -82,10 +82,12 @@ module Awestruct
|
|
82
82
|
|
83
83
|
prev_page = nil
|
84
84
|
paginated_pages.each_with_index do |page,i|
|
85
|
-
page.send( @prop_name )
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
slice = page.send( @prop_name )
|
86
|
+
|
87
|
+
slice.current_page = page
|
88
|
+
slice.current_page_index = i
|
89
|
+
slice.pages = paginated_pages
|
90
|
+
slice.window = 1
|
89
91
|
|
90
92
|
if ( prev_page != nil )
|
91
93
|
prev_page.send( @prop_name ).next_page = page
|
@@ -20,28 +20,29 @@ module Awestruct
|
|
20
20
|
day = $3
|
21
21
|
slug = $4
|
22
22
|
page.date = Time.utc( year.to_i, month.to_i, day.to_i )
|
23
|
-
elsif (page.date)
|
23
|
+
elsif (page.date?)
|
24
24
|
page.relative_source_path =~ /^#{@path_prefix}\/(.*)\..*$/
|
25
25
|
date = page.date;
|
26
26
|
if date.kind_of? String
|
27
27
|
date = Time.parse page.date
|
28
28
|
end
|
29
29
|
year = date.year
|
30
|
-
month = date.month
|
31
|
-
day = date.day
|
30
|
+
month = sprintf( "%02d", date.month )
|
31
|
+
day = sprintf( "%02d", date.day )
|
32
32
|
page.date = Time.utc(year, month, day)
|
33
33
|
slug = $1
|
34
34
|
end
|
35
35
|
|
36
36
|
# if a date was found create a post
|
37
37
|
if( year and month and day)
|
38
|
-
page.slug
|
39
|
-
context = OpenStruct.new({
|
40
|
-
|
41
|
-
|
42
|
-
})
|
38
|
+
page.slug ||= slug
|
39
|
+
#context = OpenStruct.new({
|
40
|
+
#:site=>site,
|
41
|
+
#:page=>page,
|
42
|
+
#})
|
43
|
+
context = page.create_context
|
43
44
|
#page.body = page.render( context )
|
44
|
-
page.output_path = "#{@path_prefix}/#{year}/#{month}/#{day}/#{slug}.html"
|
45
|
+
page.output_path = "#{@path_prefix}/#{year}/#{month}/#{day}/#{page.slug}.html"
|
45
46
|
#page.layout = 'post'
|
46
47
|
posts << page
|
47
48
|
end
|
@@ -61,6 +62,7 @@ module Awestruct
|
|
61
62
|
end
|
62
63
|
|
63
64
|
site.send( "#{@assign_to}=", posts )
|
65
|
+
|
64
66
|
end
|
65
67
|
|
66
68
|
end
|
@@ -17,7 +17,7 @@ module Awestruct
|
|
17
17
|
|
18
18
|
# Generate sitemap pages for stuff in _config/sitemap.yml
|
19
19
|
site.sitemap.pages.each do |entry|
|
20
|
-
page = Awestruct::
|
20
|
+
page = Awestruct::Page.new( site )
|
21
21
|
page.output_path = entry.url
|
22
22
|
page.date = entry.date( nil )
|
23
23
|
page.priority = entry.priority( nil )
|
@@ -33,6 +33,7 @@ module Awestruct
|
|
33
33
|
page = site.engine.load_page( sitemap )
|
34
34
|
page.output_path = 'sitemap.xml'
|
35
35
|
page.sitemap_entries = sitemap_pages
|
36
|
+
page.do_not_track_dependencies = true
|
36
37
|
|
37
38
|
# Add the sitemap to our site
|
38
39
|
site.pages << page
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'awestruct/extensions/extend_string'
|
2
1
|
|
3
2
|
module Awestruct
|
4
3
|
module Extensions
|
@@ -19,7 +18,6 @@ module Awestruct
|
|
19
18
|
end
|
20
19
|
|
21
20
|
module TagLinker
|
22
|
-
attr_accessor :tags
|
23
21
|
def tag_links(delimiter = ', ', style_class = nil)
|
24
22
|
class_attr = (style_class ? ' class="' + style_class + '"' : '')
|
25
23
|
tags.map{|tag| %Q{<a#{class_attr} href="#{tag.primary_page.url}">#{tag}</a>}}.join(delimiter)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
!!! XML
|
4
4
|
|
5
5
|
%feed{ 'xml:lang'=>'en-US', :xmlns=>'http://www.w3.org/2005/Atom' }
|
6
|
-
%id= "#{
|
6
|
+
%id= "#{page.content_url}/"
|
7
7
|
%title= escape_once( page.title )
|
8
8
|
- if ( defined?( site.author ) )
|
9
9
|
%author
|
@@ -16,12 +16,13 @@
|
|
16
16
|
- unless page.entries.empty?
|
17
17
|
%updated= page.entries.first.date.xmlschema
|
18
18
|
%link{:rel=>"self", :type=>"application/atom+xml", :href=>"#{site.base_url}#{page.url}" }
|
19
|
-
%link{:rel=>"alternate", :type=>"text/html", :href=>"#{
|
19
|
+
%link{:rel=>"alternate", :type=>"text/html", :href=>"#{page.content_url}/" }
|
20
20
|
- for entry in page.entries
|
21
21
|
%entry
|
22
22
|
%id #{site.base_url}#{entry.url}
|
23
23
|
%title= escape_once( entry.title )
|
24
24
|
%updated= entry.date.xmlschema
|
25
|
+
%published= entry.date.xmlschema
|
25
26
|
%link{:rel=>"alternate", :type=>"text/html", :href=>"#{site.base_url}#{entry.url}" }
|
26
27
|
- if ( defined?( entry.author ) )
|
27
28
|
%author
|
@@ -32,7 +33,7 @@
|
|
32
33
|
- else
|
33
34
|
%name= entry.author
|
34
35
|
%summary
|
35
|
-
#{summarize( html_to_text( entry.content ), 100 )}
|
36
|
+
#{summarize( html_to_text( entry.content ), 100 )}
|
36
37
|
%content{:type=>'html'}
|
37
38
|
= clean_html( html_escape( fully_qualify_urls( site.base_url, find_and_preserve( entry.content ) ) ) )
|
38
39
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
module Awestruct
|
3
|
+
|
4
|
+
class HandlerChain
|
5
|
+
|
6
|
+
attr_reader :matcher
|
7
|
+
attr_reader :handler_classes
|
8
|
+
|
9
|
+
def initialize(matcher, *handler_classes)
|
10
|
+
@matcher = matcher
|
11
|
+
@handler_classes = handler_classes
|
12
|
+
end
|
13
|
+
|
14
|
+
def matches?(path)
|
15
|
+
@matcher.match( path )
|
16
|
+
end
|
17
|
+
|
18
|
+
def create(site, path)
|
19
|
+
cur = path
|
20
|
+
@handler_classes.each do |cls|
|
21
|
+
cur = cls.new( site, cur )
|
22
|
+
end
|
23
|
+
cur
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'awestruct/handler_chain'
|
2
|
+
require 'awestruct/handlers/file_handler'
|
3
|
+
require 'awestruct/handlers/markdown_handler'
|
4
|
+
require 'awestruct/handlers/orgmode_handler'
|
5
|
+
require 'awestruct/handlers/asciidoc_handler'
|
6
|
+
require 'awestruct/handlers/restructuredtext_handler'
|
7
|
+
require 'awestruct/handlers/textile_handler'
|
8
|
+
require 'awestruct/handlers/erb_handler'
|
9
|
+
require 'awestruct/handlers/haml_handler'
|
10
|
+
require 'awestruct/handlers/sass_handler'
|
11
|
+
require 'awestruct/handlers/scss_handler'
|
12
|
+
require 'awestruct/handlers/coffeescript_handler'
|
13
|
+
|
14
|
+
module Awestruct
|
15
|
+
|
16
|
+
class HandlerChains
|
17
|
+
|
18
|
+
DEFAULTS = [
|
19
|
+
Awestruct::Handlers::MarkdownHandler::CHAIN,
|
20
|
+
Awestruct::Handlers::TextileHandler::CHAIN,
|
21
|
+
Awestruct::Handlers::ErbHandler::CHAIN,
|
22
|
+
Awestruct::Handlers::OrgmodeHandler::CHAIN,
|
23
|
+
Awestruct::Handlers::AsciidocHandler::CHAIN,
|
24
|
+
Awestruct::Handlers::RestructuredtextHandler::CHAIN,
|
25
|
+
Awestruct::Handlers::HamlHandler::CHAIN,
|
26
|
+
Awestruct::Handlers::SassHandler::CHAIN,
|
27
|
+
Awestruct::Handlers::ScssHandler::CHAIN,
|
28
|
+
Awestruct::Handlers::CoffeescriptHandler::CHAIN,
|
29
|
+
HandlerChain.new( /.*/, Awestruct::Handlers::FileHandler )
|
30
|
+
]
|
31
|
+
|
32
|
+
def initialize(include_defaults=true)
|
33
|
+
@chains = []
|
34
|
+
self << :defaults if include_defaults
|
35
|
+
end
|
36
|
+
|
37
|
+
def[](path)
|
38
|
+
@chains.detect{|e| e.matches?( path.to_s ) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def <<(chain)
|
42
|
+
@chains += DEFAULTS and return if ( chain == :defaults )
|
43
|
+
@chains << chain
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
|
2
|
+
require 'awestruct/handler_chain'
|
3
|
+
require 'awestruct/handlers/base_handler'
|
4
|
+
require 'awestruct/handlers/file_handler'
|
5
|
+
require 'awestruct/handlers/front_matter_handler'
|
6
|
+
require 'awestruct/handlers/interpolation_handler'
|
7
|
+
require 'awestruct/handlers/layout_handler'
|
8
|
+
|
9
|
+
module Awestruct
|
10
|
+
module Handlers
|
11
|
+
class AsciidocHandler < BaseHandler
|
12
|
+
|
13
|
+
CHAIN = Awestruct::HandlerChain.new( /\.(adoc|asciidoc)$/,
|
14
|
+
Awestruct::Handlers::FileHandler,
|
15
|
+
Awestruct::Handlers::FrontMatterHandler,
|
16
|
+
Awestruct::Handlers::InterpolationHandler,
|
17
|
+
Awestruct::Handlers::AsciidocHandler,
|
18
|
+
Awestruct::Handlers::LayoutHandler
|
19
|
+
)
|
20
|
+
|
21
|
+
def initialize(site, delegate)
|
22
|
+
super( site, delegate )
|
23
|
+
end
|
24
|
+
|
25
|
+
def simple_name
|
26
|
+
p = File.basename( relative_source_path )
|
27
|
+
File.basename( p, File.extname( p ) )
|
28
|
+
end
|
29
|
+
|
30
|
+
def output_filename
|
31
|
+
simple_name + output_extension
|
32
|
+
end
|
33
|
+
|
34
|
+
def output_extension
|
35
|
+
'.html'
|
36
|
+
end
|
37
|
+
|
38
|
+
def content_syntax
|
39
|
+
:asciidoc
|
40
|
+
end
|
41
|
+
|
42
|
+
def rendered_content(context, with_layouts=true)
|
43
|
+
content = delegate.rendered_content( context, with_layouts )
|
44
|
+
imagesdir = site.config.images_dir
|
45
|
+
iconsdir = File.join(imagesdir, 'icons')
|
46
|
+
conffile = File.join(site.config.config_dir, 'asciidoc.conf')
|
47
|
+
confopt = File.exist?(conffile) ? '-f ' + conffile : ''
|
48
|
+
content = execute_shell( [ "asciidoc -s -b html5 -a pygments -a icons",
|
49
|
+
"-a iconsdir='#{iconsdir}'",
|
50
|
+
"-a imagesdir='#{imagesdir}'",
|
51
|
+
"#{confopt} -o - -" ].join( ' ' ),
|
52
|
+
content)
|
53
|
+
content.gsub( "\r", '' )
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
|
2
|
+
require 'hashery/open_cascade'
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
module Awestruct
|
6
|
+
module Handlers
|
7
|
+
class BaseHandler
|
8
|
+
|
9
|
+
attr_reader :site
|
10
|
+
attr_reader :delegate
|
11
|
+
|
12
|
+
def initialize(site, delegate=nil)
|
13
|
+
@site = site
|
14
|
+
@delegate = delegate
|
15
|
+
end
|
16
|
+
|
17
|
+
def stale?
|
18
|
+
return @delegate.stale? if @delegate
|
19
|
+
false
|
20
|
+
end
|
21
|
+
|
22
|
+
def input_mtime(page)
|
23
|
+
return @delegate.input_mtime(page) if @delegate
|
24
|
+
0
|
25
|
+
end
|
26
|
+
|
27
|
+
def simple_name
|
28
|
+
return @delegate.simple_name if @delegate
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
def relative_source_path
|
33
|
+
return @delegate.relative_source_path if @delegate
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def output_filename
|
38
|
+
return @delegate.output_filename if @delegate
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def output_path
|
43
|
+
( p = relative_source_path ) if relative_source_path
|
44
|
+
( of = output_filename ) if output_filename
|
45
|
+
return File.join( File.dirname( p ), output_filename ) if ( p && of )
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
|
49
|
+
def output_extension
|
50
|
+
return @delegate.output_extension if @delegate
|
51
|
+
return File.extname( output_filename ) unless output_filename.nil?
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
|
55
|
+
def path
|
56
|
+
return @delegate.path if @delegate
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
|
60
|
+
def front_matter
|
61
|
+
return @delegate.front_matter if @delegate
|
62
|
+
{}
|
63
|
+
end
|
64
|
+
|
65
|
+
def content_syntax
|
66
|
+
return @delegate.raw_content if @delegate
|
67
|
+
:none
|
68
|
+
end
|
69
|
+
|
70
|
+
def raw_content
|
71
|
+
return @delegate.raw_content if @delegate
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
|
75
|
+
def rendered_content(context, with_layouts=true)
|
76
|
+
return @delegate.rendered_content(context, with_layouts) if @delegate
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
|
80
|
+
def content_line_offset
|
81
|
+
return @delegate.content_line_offset if @delegate
|
82
|
+
0
|
83
|
+
end
|
84
|
+
|
85
|
+
def inherit_front_matter(page)
|
86
|
+
return @delegate.inherit_front_matter(page) if @delegate
|
87
|
+
end
|
88
|
+
|
89
|
+
def dependencies
|
90
|
+
return @delegate.dependencies if @delegate
|
91
|
+
[]
|
92
|
+
end
|
93
|
+
|
94
|
+
def to_chain
|
95
|
+
chain = [ self ]
|
96
|
+
chain += @delegate.to_chain if @delegate
|
97
|
+
chain.flatten
|
98
|
+
end
|
99
|
+
|
100
|
+
def execute_shell(command, input=nil)
|
101
|
+
Open3.popen3(command) do |stdin, stdout, _|
|
102
|
+
stdin.puts input unless input.nil?
|
103
|
+
out = stdout.read
|
104
|
+
end
|
105
|
+
rescue Errno::EPIPE
|
106
|
+
""
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|