awestruct 0.4.8 → 0.5.0.cr
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/awestruct/astruct.rb +4 -0
- data/lib/awestruct/astruct_mixin.rb +3 -0
- data/lib/awestruct/cli/auto.rb +6 -6
- data/lib/awestruct/cli/deploy.rb +3 -3
- data/lib/awestruct/cli/generate.rb +5 -3
- data/lib/awestruct/cli/init.rb +1 -1
- data/lib/awestruct/cli/invoker.rb +10 -3
- data/lib/awestruct/cli/manifest.rb +18 -17
- data/lib/awestruct/cli/options.rb +7 -6
- data/lib/awestruct/cli/server.rb +7 -14
- data/lib/awestruct/config.rb +7 -1
- data/lib/awestruct/config/default-site.yml +30 -0
- data/lib/awestruct/context_helper.rb +7 -7
- data/lib/awestruct/dependencies.rb +14 -11
- data/lib/awestruct/deploy/base_deploy.rb +2 -2
- data/lib/awestruct/deploy/github_pages_deploy.rb +1 -1
- data/lib/awestruct/deploy/rsync_deploy.rb +11 -15
- data/lib/awestruct/deploy/s3_deploy.rb +9 -0
- data/lib/awestruct/engine.rb +72 -21
- data/lib/awestruct/extensions/minify.rb +21 -20
- data/lib/awestruct/extensions/paginator.rb +5 -5
- data/lib/awestruct/extensions/partial.rb +1 -1
- data/lib/awestruct/extensions/pipeline.rb +5 -1
- data/lib/awestruct/extensions/posts.rb +8 -4
- data/lib/awestruct/extensions/relative.rb +7 -2
- data/lib/awestruct/extensions/remotePartial.rb +1 -1
- data/lib/awestruct/extensions/sitemap.rb +1 -1
- data/lib/awestruct/frameworks/bootstrap/base_index.html.haml +1 -1
- data/lib/awestruct/frameworks/bootstrap/base_layout.html.haml +1 -1
- data/lib/awestruct/handler_chains.rb +8 -23
- data/lib/awestruct/handlers/asciidoctor_handler.rb +114 -0
- data/lib/awestruct/handlers/base_tilt_handler.rb +114 -0
- data/lib/awestruct/handlers/css_tilt_handler.rb +43 -0
- data/lib/awestruct/handlers/front_matter_handler.rb +1 -1
- data/lib/awestruct/handlers/interpolation_handler.rb +3 -3
- data/lib/awestruct/handlers/layout_handler.rb +6 -4
- data/lib/awestruct/handlers/restructuredtext_handler.rb +5 -5
- data/lib/awestruct/handlers/template/asciidoc.rb +41 -0
- data/lib/awestruct/handlers/template/mustache.rb +25 -0
- data/lib/awestruct/handlers/tilt_handler.rb +73 -0
- data/lib/awestruct/layouts.rb +1 -1
- data/lib/awestruct/logger.rb +59 -0
- data/lib/awestruct/page.rb +16 -3
- data/lib/awestruct/page_loader.rb +5 -5
- data/lib/awestruct/version.rb +1 -1
- data/man/awestruct.1 +163 -0
- data/spec/asciidoc_handler_spec.rb +75 -0
- data/spec/astruct_spec.rb +52 -0
- data/spec/coffeescript_handler_spec.rb +23 -0
- data/spec/config_spec.rb +22 -0
- data/spec/context_helper_spec.rb +115 -0
- data/spec/deploy_spec.rb +41 -0
- data/spec/disqus_spec.rb +43 -0
- data/spec/engine_spec.rb +115 -0
- data/spec/erb_handler_spec.rb +52 -0
- data/spec/file_handler_spec.rb +57 -0
- data/spec/front_matter_handler_spec.rb +42 -0
- data/spec/github_pages_deploy_spec.rb +56 -0
- data/spec/haml_handler_spec.rb +93 -0
- data/spec/handler_chain_spec.rb +44 -0
- data/spec/handler_chains_spec.rb +25 -0
- data/spec/interpolation_handler_spec.rb +35 -0
- data/spec/invoker_spec.rb +74 -0
- data/spec/javascript_handler_spec.rb +23 -0
- data/spec/layout_handler_spec.rb +77 -0
- data/spec/layouts_spec.rb +32 -0
- data/spec/less_handler_spec.rb +33 -0
- data/spec/markdown_handler_spec.rb +41 -0
- data/spec/minify_spec.rb +61 -0
- data/spec/mustache_handler_spec.rb +29 -0
- data/spec/options_spec.rb +97 -0
- data/spec/orgmode_handler_spec.rb +24 -0
- data/spec/page_delegating_handler_spec.rb +79 -0
- data/spec/page_loader_spec.rb +43 -0
- data/spec/page_loader_spec_for_layouts.rb +36 -0
- data/spec/page_spec.rb +65 -0
- data/spec/pipeline_spec.rb +12 -0
- data/spec/posts_archive_spec.rb +108 -0
- data/spec/redirect_handler_spec.rb +32 -0
- data/spec/restructuredtext_handler_spec.rb +22 -0
- data/spec/rsync_deploy_spec.rb +9 -0
- data/spec/sass_handler_spec.rb +23 -0
- data/spec/scss_handler_spec.rb +23 -0
- data/spec/server_spec.rb +45 -0
- data/spec/slim_handler_spec.rb +81 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/nokogiri_matchers.rb +21 -0
- data/spec/support/shared_handler_example.rb +98 -0
- data/spec/test-data/engine/_config/arbitrary.yml +2 -0
- data/spec/test-data/engine/_config/other.yml +1 -0
- data/spec/test-data/engine/_config/site.yml +14 -0
- data/spec/test-data/front-matter-file-no-content.txt +2 -0
- data/spec/test-data/front-matter-file-no-front.txt +1 -0
- data/spec/test-data/front-matter-file.txt +4 -0
- data/spec/test-data/handlers/asciidoc-page.ad +3 -0
- data/spec/test-data/handlers/asciidoc-page.adoc +3 -0
- data/spec/test-data/handlers/asciidoc-page.asciidoc +3 -0
- data/spec/test-data/handlers/asciidoctor_with_front_matter.ad +6 -0
- data/spec/test-data/handlers/asciidoctor_with_headers.ad +8 -0
- data/spec/test-data/handlers/coffeescript-page.coffee +8 -0
- data/spec/test-data/handlers/erb-page.html.erb +6 -0
- data/spec/test-data/handlers/erb-page.xml.erb +2 -0
- data/spec/test-data/handlers/erb-utf-page.html.erb +2 -0
- data/spec/test-data/handlers/haml-layout-two.html.haml +7 -0
- data/spec/test-data/handlers/haml-layout.html.haml +4 -0
- data/spec/test-data/handlers/haml-page.atom.haml +4 -0
- data/spec/test-data/handlers/haml-page.html.haml +2 -0
- data/spec/test-data/handlers/haml-page.xml.haml +1 -0
- data/spec/test-data/handlers/haml-with-markdown-page.html.haml +6 -0
- data/spec/test-data/handlers/haml-with-textile-page.html.haml +6 -0
- data/spec/test-data/handlers/haml-with-utf.html.haml +2 -0
- data/spec/test-data/handlers/haml-with-variables.html.haml +2 -0
- data/spec/test-data/handlers/inner-page.html.haml +4 -0
- data/spec/test-data/handlers/javascript-page.js +1 -0
- data/spec/test-data/handlers/less-page-include.less +1 -0
- data/spec/test-data/handlers/less-page-with-import.less +4 -0
- data/spec/test-data/handlers/less-page.less +4 -0
- data/spec/test-data/handlers/markdown-page.markdown +2 -0
- data/spec/test-data/handlers/markdown-page.md +2 -0
- data/spec/test-data/handlers/markdown-page.mkd +2 -0
- data/spec/test-data/handlers/mustache-page.html.mustache +2 -0
- data/spec/test-data/handlers/mustache-page.xml.mustache +1 -0
- data/spec/test-data/handlers/orgmode-page.org +6 -0
- data/spec/test-data/handlers/outer-layout.html.haml +2 -0
- data/spec/test-data/handlers/outside_relative/git_keep +3 -0
- data/spec/test-data/handlers/redirect-page.redirect +1 -0
- data/spec/test-data/handlers/restructuredtext-page.rst +8 -0
- data/spec/test-data/handlers/sass-page-include.sass +1 -0
- data/spec/test-data/handlers/sass-page.sass +4 -0
- data/spec/test-data/handlers/scss-page-include.scss +1 -0
- data/spec/test-data/handlers/scss-page.scss +5 -0
- data/spec/test-data/handlers/simple-redirect-page.redirect +1 -0
- data/spec/test-data/handlers/slim-page.atom.slim +4 -0
- data/spec/test-data/handlers/slim-page.html.slim +1 -0
- data/spec/test-data/handlers/slim-page.xml.slim +1 -0
- data/spec/test-data/handlers/slim-with-markdown-page.html.slim +5 -0
- data/spec/test-data/handlers/slim-with-utf.html.slim +2 -0
- data/spec/test-data/handlers/slim-with-variables.html.slim +1 -0
- data/spec/test-data/handlers/textile-page.textile +1 -0
- data/spec/test-data/images/logo.png +0 -0
- data/spec/test-data/index.html +242 -0
- data/spec/test-data/javascript/bootstrap-dropdown.js +92 -0
- data/spec/test-data/out-of-site/page-three.html.haml +2 -0
- data/spec/test-data/page-loader/_layouts/layout-one.md +2 -0
- data/spec/test-data/page-loader/_layouts/layout-two.html.haml +2 -0
- data/spec/test-data/page-loader/page-draft.md +5 -0
- data/spec/test-data/page-loader/page-one.md +2 -0
- data/spec/test-data/page-loader/page-two.html.haml +2 -0
- data/spec/test-data/simple-data.yaml +1 -0
- data/spec/test-data/simple-file.txt +1 -0
- data/spec/test-data/stylesheets/screen.css +688 -0
- data/spec/textile_handler_spec.rb +22 -0
- data/spec/tilt_handler_spec.rb +81 -0
- data/spec/yaml_handler_spec.rb +21 -0
- metadata +243 -202
- data/lib/awestruct/handlers/asciidoc_handler.rb +0 -86
- data/lib/awestruct/handlers/base_sass_handler.rb +0 -42
- data/lib/awestruct/handlers/coffeescript_handler.rb +0 -48
- data/lib/awestruct/handlers/erb_handler.rb +0 -43
- data/lib/awestruct/handlers/haml_handler.rb +0 -54
- data/lib/awestruct/handlers/less_handler.rb +0 -37
- data/lib/awestruct/handlers/markdown_handler.rb +0 -50
- data/lib/awestruct/handlers/mustache_handler.rb +0 -44
- data/lib/awestruct/handlers/orgmode_handler.rb +0 -48
- data/lib/awestruct/handlers/sass_handler.rb +0 -21
- data/lib/awestruct/handlers/scss_handler.rb +0 -21
- data/lib/awestruct/handlers/textile_handler.rb +0 -58
@@ -1,86 +0,0 @@
|
|
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
|
-
if !site.asciidoc? || !site.asciidoc.has_key?(:engine)
|
24
|
-
site.asciidoc[:engine] = 'asciidoctor'
|
25
|
-
end
|
26
|
-
|
27
|
-
if !site.asciidoc.has_key?(:engine_loaded)
|
28
|
-
if site.asciidoc[:engine] != 'system'
|
29
|
-
require site.asciidoc[:engine]
|
30
|
-
end
|
31
|
-
site.asciidoc[:engine_loaded] = true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def simple_name
|
36
|
-
p = File.basename( relative_source_path )
|
37
|
-
File.basename( p, File.extname( p ) )
|
38
|
-
end
|
39
|
-
|
40
|
-
def output_filename
|
41
|
-
simple_name + output_extension
|
42
|
-
end
|
43
|
-
|
44
|
-
def output_extension
|
45
|
-
'.html'
|
46
|
-
end
|
47
|
-
|
48
|
-
def content_syntax
|
49
|
-
:asciidoc
|
50
|
-
end
|
51
|
-
|
52
|
-
def rendered_content(context, with_layouts=true)
|
53
|
-
options = context.site.asciidoc
|
54
|
-
|
55
|
-
content = delegate.rendered_content( context, with_layouts )
|
56
|
-
if options[:engine] == 'system'
|
57
|
-
imagesdir = site.config.images_dir
|
58
|
-
iconsdir = File.join(imagesdir, 'icons')
|
59
|
-
conffile = File.join(site.config.config_dir, 'asciidoc.conf')
|
60
|
-
confopt = File.exist?(conffile) ? '-f ' + conffile : ''
|
61
|
-
content = execute_shell( [ "asciidoc -s -b html5 -a pygments -a icons",
|
62
|
-
"-a iconsdir='#{iconsdir}'",
|
63
|
-
"-a imagesdir='#{imagesdir}'",
|
64
|
-
"#{confopt} -o - -" ].join( ' ' ),
|
65
|
-
content, false)
|
66
|
-
content.gsub( "\r", '' )
|
67
|
-
elsif options[:engine] == 'asciidoctor'
|
68
|
-
opts = {
|
69
|
-
:header_footer => false,
|
70
|
-
:attributes => {
|
71
|
-
'backend' => 'html5',
|
72
|
-
'imagesdir' => site.config.images_dir,
|
73
|
-
'stylesdir' => site.config.stylesheets_dir,
|
74
|
-
}
|
75
|
-
}
|
76
|
-
if options.has_key? :templates
|
77
|
-
opts[:template_dir] = options[:templates]
|
78
|
-
end
|
79
|
-
Asciidoctor::Document.new(content, opts).render
|
80
|
-
else
|
81
|
-
raise 'Unknown AsciiDoc engine: ' + options[:engine]
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'awestruct/handlers/base_handler'
|
3
|
-
|
4
|
-
require 'compass'
|
5
|
-
require 'ninesixty'
|
6
|
-
require 'bootstrap-sass'
|
7
|
-
|
8
|
-
module Awestruct
|
9
|
-
module Handlers
|
10
|
-
class BaseSassHandler < BaseHandler
|
11
|
-
|
12
|
-
attr_reader :syntax
|
13
|
-
|
14
|
-
def initialize(site, delegate, syntax)
|
15
|
-
super( site, delegate )
|
16
|
-
@syntax = syntax
|
17
|
-
end
|
18
|
-
|
19
|
-
def simple_name
|
20
|
-
File.basename( relative_source_path, ".#{syntax}" )
|
21
|
-
end
|
22
|
-
|
23
|
-
def output_filename
|
24
|
-
simple_name + '.css'
|
25
|
-
end
|
26
|
-
|
27
|
-
def rendered_content(context, with_layouts=true)
|
28
|
-
sass_opts = Compass.sass_engine_options
|
29
|
-
sass_opts[:load_paths] ||= []
|
30
|
-
Compass::Frameworks::ALL.each do |framework|
|
31
|
-
sass_opts[:load_paths] << framework.stylesheets_directory
|
32
|
-
end
|
33
|
-
sass_opts[:load_paths] << File.dirname( context.page.source_path )
|
34
|
-
sass_opts[:syntax] = syntax
|
35
|
-
sass_opts[:custom] = site
|
36
|
-
sass_engine = Sass::Engine.new( raw_content, sass_opts )
|
37
|
-
sass_engine.render
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,48 +0,0 @@
|
|
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
|
-
|
8
|
-
require 'coffee-script'
|
9
|
-
|
10
|
-
module Awestruct
|
11
|
-
module Handlers
|
12
|
-
class CoffeescriptHandler < BaseHandler
|
13
|
-
|
14
|
-
|
15
|
-
CHAIN = Awestruct::HandlerChain.new( /\.coffee$/,
|
16
|
-
Awestruct::Handlers::FileHandler,
|
17
|
-
Awestruct::Handlers::FrontMatterHandler,
|
18
|
-
Awestruct::Handlers::InterpolationHandler,
|
19
|
-
Awestruct::Handlers::CoffeescriptHandler
|
20
|
-
)
|
21
|
-
|
22
|
-
def initialize(site, delegate)
|
23
|
-
super( site, delegate )
|
24
|
-
end
|
25
|
-
|
26
|
-
def simple_name
|
27
|
-
File.basename( relative_source_path, '.coffee' )
|
28
|
-
end
|
29
|
-
|
30
|
-
def output_filename
|
31
|
-
File.basename( relative_source_path, '.coffee' ) + '.js'
|
32
|
-
end
|
33
|
-
|
34
|
-
def output_extension
|
35
|
-
'.js'
|
36
|
-
end
|
37
|
-
|
38
|
-
def content_syntax
|
39
|
-
:coffeescript
|
40
|
-
end
|
41
|
-
|
42
|
-
def rendered_content(context, with_layouts=true)
|
43
|
-
CoffeeScript.compile( delegate.rendered_content( context, with_layouts ) )
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'awestruct/handlers/base_handler'
|
2
|
-
require 'awestruct/handlers/file_handler'
|
3
|
-
require 'awestruct/handlers/front_matter_handler'
|
4
|
-
require 'awestruct/handlers/layout_handler'
|
5
|
-
|
6
|
-
module Awestruct
|
7
|
-
module Handlers
|
8
|
-
class ErbHandler < BaseHandler
|
9
|
-
|
10
|
-
CHAIN = Awestruct::HandlerChain.new( /\.erb$/,
|
11
|
-
Awestruct::Handlers::FileHandler,
|
12
|
-
Awestruct::Handlers::FrontMatterHandler,
|
13
|
-
Awestruct::Handlers::ErbHandler,
|
14
|
-
Awestruct::Handlers::LayoutHandler
|
15
|
-
)
|
16
|
-
|
17
|
-
def initialize(site, delegate)
|
18
|
-
super( site, delegate )
|
19
|
-
end
|
20
|
-
|
21
|
-
def simple_name
|
22
|
-
File.basename( File.basename( relative_source_path, '.erb' ), output_extension )
|
23
|
-
end
|
24
|
-
|
25
|
-
def output_filename
|
26
|
-
File.basename( relative_source_path, '.erb' )
|
27
|
-
end
|
28
|
-
|
29
|
-
def output_extension
|
30
|
-
File.extname( output_filename )
|
31
|
-
end
|
32
|
-
|
33
|
-
def content_syntax
|
34
|
-
:erb
|
35
|
-
end
|
36
|
-
|
37
|
-
def rendered_content(context, with_layouts=true)
|
38
|
-
erb = ERB.new( delegate.rendered_content( context, with_layouts) )
|
39
|
-
erb.result( context.send( :binding ) )
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,54 +0,0 @@
|
|
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/layout_handler'
|
7
|
-
|
8
|
-
require 'haml'
|
9
|
-
|
10
|
-
module Awestruct
|
11
|
-
module Handlers
|
12
|
-
class HamlHandler < BaseHandler
|
13
|
-
|
14
|
-
CHAIN = Awestruct::HandlerChain.new( /\.haml$/,
|
15
|
-
Awestruct::Handlers::FileHandler,
|
16
|
-
Awestruct::Handlers::FrontMatterHandler,
|
17
|
-
Awestruct::Handlers::HamlHandler,
|
18
|
-
Awestruct::Handlers::LayoutHandler
|
19
|
-
)
|
20
|
-
|
21
|
-
def initialize(site, delegate)
|
22
|
-
super( site, delegate )
|
23
|
-
end
|
24
|
-
|
25
|
-
def simple_name
|
26
|
-
File.basename( self.path, "#{output_extension}.haml" )
|
27
|
-
end
|
28
|
-
|
29
|
-
def output_filename
|
30
|
-
return File.basename( relative_source_path, '.haml' ) unless relative_source_path.nil?
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
def output_extension
|
35
|
-
File.extname( File.basename( path, '.haml' ) )
|
36
|
-
end
|
37
|
-
|
38
|
-
def rendered_content(context, with_layouts=true)
|
39
|
-
options = context.site.haml? ? context.site.haml : {}
|
40
|
-
options = options.inject({}){ |hash,(key,value)|
|
41
|
-
hash[key.to_sym] = value
|
42
|
-
hash
|
43
|
-
}
|
44
|
-
options[:relative_source_path] = context.page.relative_source_path
|
45
|
-
options[:filename] = delegate.path.to_s
|
46
|
-
options[:line] = delegate.content_line_offset + 1
|
47
|
-
options[:site] = context.site
|
48
|
-
haml_engine = Haml::Engine.new( delegate.raw_content, options )
|
49
|
-
haml_engine.render( context )
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'awestruct/handler_chain'
|
3
|
-
require 'awestruct/handlers/base_handler'
|
4
|
-
require 'awestruct/handlers/file_handler'
|
5
|
-
|
6
|
-
require 'less'
|
7
|
-
|
8
|
-
module Awestruct
|
9
|
-
module Handlers
|
10
|
-
class LessHandler < BaseHandler
|
11
|
-
|
12
|
-
CHAIN = Awestruct::HandlerChain.new( /\.less$/,
|
13
|
-
Awestruct::Handlers::FileHandler,
|
14
|
-
Awestruct::Handlers::LessHandler
|
15
|
-
)
|
16
|
-
|
17
|
-
def initialize(site, delegate)
|
18
|
-
super( site, delegate )
|
19
|
-
end
|
20
|
-
|
21
|
-
def simple_name
|
22
|
-
File.basename( relative_source_path, '.less' )
|
23
|
-
end
|
24
|
-
|
25
|
-
def output_filename
|
26
|
-
simple_name + '.css'
|
27
|
-
end
|
28
|
-
|
29
|
-
def rendered_content(context, with_layouts=true)
|
30
|
-
load_paths = [File.dirname( context.page.source_path )]
|
31
|
-
less_parser = Less::Parser.new :paths => load_paths, :filename => context.page.source_path
|
32
|
-
less_parser.parse( raw_content ).to_css
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,50 +0,0 @@
|
|
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
|
-
require 'rdiscount'
|
9
|
-
|
10
|
-
module Awestruct
|
11
|
-
module Handlers
|
12
|
-
class MarkdownHandler < BaseHandler
|
13
|
-
|
14
|
-
|
15
|
-
CHAIN = Awestruct::HandlerChain.new( /\.md$/,
|
16
|
-
Awestruct::Handlers::FileHandler,
|
17
|
-
Awestruct::Handlers::FrontMatterHandler,
|
18
|
-
Awestruct::Handlers::InterpolationHandler,
|
19
|
-
Awestruct::Handlers::MarkdownHandler,
|
20
|
-
Awestruct::Handlers::LayoutHandler
|
21
|
-
)
|
22
|
-
|
23
|
-
def initialize(site, delegate)
|
24
|
-
super( site, delegate )
|
25
|
-
end
|
26
|
-
|
27
|
-
def simple_name
|
28
|
-
File.basename( relative_source_path, '.md' )
|
29
|
-
end
|
30
|
-
|
31
|
-
def output_filename
|
32
|
-
File.basename( relative_source_path, '.md' ) + '.html'
|
33
|
-
end
|
34
|
-
|
35
|
-
def output_extension
|
36
|
-
'.html'
|
37
|
-
end
|
38
|
-
|
39
|
-
def content_syntax
|
40
|
-
:markdown
|
41
|
-
end
|
42
|
-
|
43
|
-
def rendered_content(context, with_layouts=true)
|
44
|
-
doc = RDiscount.new( delegate.rendered_content( context, with_layouts ) )
|
45
|
-
doc.to_html
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,44 +0,0 @@
|
|
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/layout_handler'
|
7
|
-
|
8
|
-
require 'mustache'
|
9
|
-
|
10
|
-
module Awestruct
|
11
|
-
module Handlers
|
12
|
-
class MustacheHandler < BaseHandler
|
13
|
-
|
14
|
-
CHAIN = Awestruct::HandlerChain.new( /\.mustache$/,
|
15
|
-
Awestruct::Handlers::FileHandler,
|
16
|
-
Awestruct::Handlers::FrontMatterHandler,
|
17
|
-
Awestruct::Handlers::MustacheHandler,
|
18
|
-
Awestruct::Handlers::LayoutHandler
|
19
|
-
)
|
20
|
-
|
21
|
-
def initialize(site, delegate)
|
22
|
-
super( site, delegate )
|
23
|
-
end
|
24
|
-
|
25
|
-
def simple_name
|
26
|
-
File.basename( self.path, "#{output_extension}.mustache" )
|
27
|
-
end
|
28
|
-
|
29
|
-
def output_filename
|
30
|
-
return File.basename( relative_source_path, ".mustache") unless relative_source_path.nil?
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
def output_extension
|
35
|
-
File.extname( File.basename( path, ".mustache" ) )
|
36
|
-
end
|
37
|
-
|
38
|
-
def rendered_content(context, with_layouts=true)
|
39
|
-
Mustache.render( delegate.raw_content, context )
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,48 +0,0 @@
|
|
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
|
-
require 'org-ruby'
|
9
|
-
|
10
|
-
module Awestruct
|
11
|
-
module Handlers
|
12
|
-
class OrgmodeHandler < BaseHandler
|
13
|
-
|
14
|
-
CHAIN = Awestruct::HandlerChain.new( /\.org$/,
|
15
|
-
Awestruct::Handlers::FileHandler,
|
16
|
-
Awestruct::Handlers::FrontMatterHandler,
|
17
|
-
Awestruct::Handlers::InterpolationHandler,
|
18
|
-
Awestruct::Handlers::OrgmodeHandler,
|
19
|
-
Awestruct::Handlers::LayoutHandler
|
20
|
-
)
|
21
|
-
|
22
|
-
def initialize(site, delegate)
|
23
|
-
super( site, delegate )
|
24
|
-
end
|
25
|
-
|
26
|
-
def simple_name
|
27
|
-
File.basename( relative_source_path, '.org' )
|
28
|
-
end
|
29
|
-
|
30
|
-
def output_filename
|
31
|
-
File.basename( relative_source_path, '.org' ) + '.html'
|
32
|
-
end
|
33
|
-
|
34
|
-
def output_extension
|
35
|
-
'.html'
|
36
|
-
end
|
37
|
-
|
38
|
-
def content_syntax
|
39
|
-
:orgmode
|
40
|
-
end
|
41
|
-
|
42
|
-
def rendered_content(context, with_layouts=true)
|
43
|
-
Orgmode::Parser.new(super( context, with_layouts) ).to_html
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|