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.
Files changed (167) hide show
  1. data/lib/awestruct/astruct.rb +4 -0
  2. data/lib/awestruct/astruct_mixin.rb +3 -0
  3. data/lib/awestruct/cli/auto.rb +6 -6
  4. data/lib/awestruct/cli/deploy.rb +3 -3
  5. data/lib/awestruct/cli/generate.rb +5 -3
  6. data/lib/awestruct/cli/init.rb +1 -1
  7. data/lib/awestruct/cli/invoker.rb +10 -3
  8. data/lib/awestruct/cli/manifest.rb +18 -17
  9. data/lib/awestruct/cli/options.rb +7 -6
  10. data/lib/awestruct/cli/server.rb +7 -14
  11. data/lib/awestruct/config.rb +7 -1
  12. data/lib/awestruct/config/default-site.yml +30 -0
  13. data/lib/awestruct/context_helper.rb +7 -7
  14. data/lib/awestruct/dependencies.rb +14 -11
  15. data/lib/awestruct/deploy/base_deploy.rb +2 -2
  16. data/lib/awestruct/deploy/github_pages_deploy.rb +1 -1
  17. data/lib/awestruct/deploy/rsync_deploy.rb +11 -15
  18. data/lib/awestruct/deploy/s3_deploy.rb +9 -0
  19. data/lib/awestruct/engine.rb +72 -21
  20. data/lib/awestruct/extensions/minify.rb +21 -20
  21. data/lib/awestruct/extensions/paginator.rb +5 -5
  22. data/lib/awestruct/extensions/partial.rb +1 -1
  23. data/lib/awestruct/extensions/pipeline.rb +5 -1
  24. data/lib/awestruct/extensions/posts.rb +8 -4
  25. data/lib/awestruct/extensions/relative.rb +7 -2
  26. data/lib/awestruct/extensions/remotePartial.rb +1 -1
  27. data/lib/awestruct/extensions/sitemap.rb +1 -1
  28. data/lib/awestruct/frameworks/bootstrap/base_index.html.haml +1 -1
  29. data/lib/awestruct/frameworks/bootstrap/base_layout.html.haml +1 -1
  30. data/lib/awestruct/handler_chains.rb +8 -23
  31. data/lib/awestruct/handlers/asciidoctor_handler.rb +114 -0
  32. data/lib/awestruct/handlers/base_tilt_handler.rb +114 -0
  33. data/lib/awestruct/handlers/css_tilt_handler.rb +43 -0
  34. data/lib/awestruct/handlers/front_matter_handler.rb +1 -1
  35. data/lib/awestruct/handlers/interpolation_handler.rb +3 -3
  36. data/lib/awestruct/handlers/layout_handler.rb +6 -4
  37. data/lib/awestruct/handlers/restructuredtext_handler.rb +5 -5
  38. data/lib/awestruct/handlers/template/asciidoc.rb +41 -0
  39. data/lib/awestruct/handlers/template/mustache.rb +25 -0
  40. data/lib/awestruct/handlers/tilt_handler.rb +73 -0
  41. data/lib/awestruct/layouts.rb +1 -1
  42. data/lib/awestruct/logger.rb +59 -0
  43. data/lib/awestruct/page.rb +16 -3
  44. data/lib/awestruct/page_loader.rb +5 -5
  45. data/lib/awestruct/version.rb +1 -1
  46. data/man/awestruct.1 +163 -0
  47. data/spec/asciidoc_handler_spec.rb +75 -0
  48. data/spec/astruct_spec.rb +52 -0
  49. data/spec/coffeescript_handler_spec.rb +23 -0
  50. data/spec/config_spec.rb +22 -0
  51. data/spec/context_helper_spec.rb +115 -0
  52. data/spec/deploy_spec.rb +41 -0
  53. data/spec/disqus_spec.rb +43 -0
  54. data/spec/engine_spec.rb +115 -0
  55. data/spec/erb_handler_spec.rb +52 -0
  56. data/spec/file_handler_spec.rb +57 -0
  57. data/spec/front_matter_handler_spec.rb +42 -0
  58. data/spec/github_pages_deploy_spec.rb +56 -0
  59. data/spec/haml_handler_spec.rb +93 -0
  60. data/spec/handler_chain_spec.rb +44 -0
  61. data/spec/handler_chains_spec.rb +25 -0
  62. data/spec/interpolation_handler_spec.rb +35 -0
  63. data/spec/invoker_spec.rb +74 -0
  64. data/spec/javascript_handler_spec.rb +23 -0
  65. data/spec/layout_handler_spec.rb +77 -0
  66. data/spec/layouts_spec.rb +32 -0
  67. data/spec/less_handler_spec.rb +33 -0
  68. data/spec/markdown_handler_spec.rb +41 -0
  69. data/spec/minify_spec.rb +61 -0
  70. data/spec/mustache_handler_spec.rb +29 -0
  71. data/spec/options_spec.rb +97 -0
  72. data/spec/orgmode_handler_spec.rb +24 -0
  73. data/spec/page_delegating_handler_spec.rb +79 -0
  74. data/spec/page_loader_spec.rb +43 -0
  75. data/spec/page_loader_spec_for_layouts.rb +36 -0
  76. data/spec/page_spec.rb +65 -0
  77. data/spec/pipeline_spec.rb +12 -0
  78. data/spec/posts_archive_spec.rb +108 -0
  79. data/spec/redirect_handler_spec.rb +32 -0
  80. data/spec/restructuredtext_handler_spec.rb +22 -0
  81. data/spec/rsync_deploy_spec.rb +9 -0
  82. data/spec/sass_handler_spec.rb +23 -0
  83. data/spec/scss_handler_spec.rb +23 -0
  84. data/spec/server_spec.rb +45 -0
  85. data/spec/slim_handler_spec.rb +81 -0
  86. data/spec/spec_helper.rb +18 -0
  87. data/spec/support/nokogiri_matchers.rb +21 -0
  88. data/spec/support/shared_handler_example.rb +98 -0
  89. data/spec/test-data/engine/_config/arbitrary.yml +2 -0
  90. data/spec/test-data/engine/_config/other.yml +1 -0
  91. data/spec/test-data/engine/_config/site.yml +14 -0
  92. data/spec/test-data/front-matter-file-no-content.txt +2 -0
  93. data/spec/test-data/front-matter-file-no-front.txt +1 -0
  94. data/spec/test-data/front-matter-file.txt +4 -0
  95. data/spec/test-data/handlers/asciidoc-page.ad +3 -0
  96. data/spec/test-data/handlers/asciidoc-page.adoc +3 -0
  97. data/spec/test-data/handlers/asciidoc-page.asciidoc +3 -0
  98. data/spec/test-data/handlers/asciidoctor_with_front_matter.ad +6 -0
  99. data/spec/test-data/handlers/asciidoctor_with_headers.ad +8 -0
  100. data/spec/test-data/handlers/coffeescript-page.coffee +8 -0
  101. data/spec/test-data/handlers/erb-page.html.erb +6 -0
  102. data/spec/test-data/handlers/erb-page.xml.erb +2 -0
  103. data/spec/test-data/handlers/erb-utf-page.html.erb +2 -0
  104. data/spec/test-data/handlers/haml-layout-two.html.haml +7 -0
  105. data/spec/test-data/handlers/haml-layout.html.haml +4 -0
  106. data/spec/test-data/handlers/haml-page.atom.haml +4 -0
  107. data/spec/test-data/handlers/haml-page.html.haml +2 -0
  108. data/spec/test-data/handlers/haml-page.xml.haml +1 -0
  109. data/spec/test-data/handlers/haml-with-markdown-page.html.haml +6 -0
  110. data/spec/test-data/handlers/haml-with-textile-page.html.haml +6 -0
  111. data/spec/test-data/handlers/haml-with-utf.html.haml +2 -0
  112. data/spec/test-data/handlers/haml-with-variables.html.haml +2 -0
  113. data/spec/test-data/handlers/inner-page.html.haml +4 -0
  114. data/spec/test-data/handlers/javascript-page.js +1 -0
  115. data/spec/test-data/handlers/less-page-include.less +1 -0
  116. data/spec/test-data/handlers/less-page-with-import.less +4 -0
  117. data/spec/test-data/handlers/less-page.less +4 -0
  118. data/spec/test-data/handlers/markdown-page.markdown +2 -0
  119. data/spec/test-data/handlers/markdown-page.md +2 -0
  120. data/spec/test-data/handlers/markdown-page.mkd +2 -0
  121. data/spec/test-data/handlers/mustache-page.html.mustache +2 -0
  122. data/spec/test-data/handlers/mustache-page.xml.mustache +1 -0
  123. data/spec/test-data/handlers/orgmode-page.org +6 -0
  124. data/spec/test-data/handlers/outer-layout.html.haml +2 -0
  125. data/spec/test-data/handlers/outside_relative/git_keep +3 -0
  126. data/spec/test-data/handlers/redirect-page.redirect +1 -0
  127. data/spec/test-data/handlers/restructuredtext-page.rst +8 -0
  128. data/spec/test-data/handlers/sass-page-include.sass +1 -0
  129. data/spec/test-data/handlers/sass-page.sass +4 -0
  130. data/spec/test-data/handlers/scss-page-include.scss +1 -0
  131. data/spec/test-data/handlers/scss-page.scss +5 -0
  132. data/spec/test-data/handlers/simple-redirect-page.redirect +1 -0
  133. data/spec/test-data/handlers/slim-page.atom.slim +4 -0
  134. data/spec/test-data/handlers/slim-page.html.slim +1 -0
  135. data/spec/test-data/handlers/slim-page.xml.slim +1 -0
  136. data/spec/test-data/handlers/slim-with-markdown-page.html.slim +5 -0
  137. data/spec/test-data/handlers/slim-with-utf.html.slim +2 -0
  138. data/spec/test-data/handlers/slim-with-variables.html.slim +1 -0
  139. data/spec/test-data/handlers/textile-page.textile +1 -0
  140. data/spec/test-data/images/logo.png +0 -0
  141. data/spec/test-data/index.html +242 -0
  142. data/spec/test-data/javascript/bootstrap-dropdown.js +92 -0
  143. data/spec/test-data/out-of-site/page-three.html.haml +2 -0
  144. data/spec/test-data/page-loader/_layouts/layout-one.md +2 -0
  145. data/spec/test-data/page-loader/_layouts/layout-two.html.haml +2 -0
  146. data/spec/test-data/page-loader/page-draft.md +5 -0
  147. data/spec/test-data/page-loader/page-one.md +2 -0
  148. data/spec/test-data/page-loader/page-two.html.haml +2 -0
  149. data/spec/test-data/simple-data.yaml +1 -0
  150. data/spec/test-data/simple-file.txt +1 -0
  151. data/spec/test-data/stylesheets/screen.css +688 -0
  152. data/spec/textile_handler_spec.rb +22 -0
  153. data/spec/tilt_handler_spec.rb +81 -0
  154. data/spec/yaml_handler_spec.rb +21 -0
  155. metadata +243 -202
  156. data/lib/awestruct/handlers/asciidoc_handler.rb +0 -86
  157. data/lib/awestruct/handlers/base_sass_handler.rb +0 -42
  158. data/lib/awestruct/handlers/coffeescript_handler.rb +0 -48
  159. data/lib/awestruct/handlers/erb_handler.rb +0 -43
  160. data/lib/awestruct/handlers/haml_handler.rb +0 -54
  161. data/lib/awestruct/handlers/less_handler.rb +0 -37
  162. data/lib/awestruct/handlers/markdown_handler.rb +0 -50
  163. data/lib/awestruct/handlers/mustache_handler.rb +0 -44
  164. data/lib/awestruct/handlers/orgmode_handler.rb +0 -48
  165. data/lib/awestruct/handlers/sass_handler.rb +0 -21
  166. data/lib/awestruct/handlers/scss_handler.rb +0 -21
  167. 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