middleman-core 3.0.14 → 3.1.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/features/clean_build.feature +4 -5
  2. data/features/content_type.feature +43 -0
  3. data/features/data.feature +9 -4
  4. data/features/front-matter-neighbor.feature +151 -0
  5. data/features/queryable.feature +31 -0
  6. data/features/step_definitions/queryable_steps.rb +123 -0
  7. data/fixtures/content-type-app/config.rb +1 -0
  8. data/fixtures/content-type-app/source/.htaccess +1 -0
  9. data/fixtures/content-type-app/source/README +1 -0
  10. data/fixtures/content-type-app/source/images/blank.gif +0 -0
  11. data/fixtures/content-type-app/source/index.html +1 -0
  12. data/fixtures/content-type-app/source/javascripts/app.js +1 -0
  13. data/fixtures/content-type-app/source/override.html +5 -0
  14. data/fixtures/content-type-app/source/stylesheets/site.css +1 -0
  15. data/fixtures/frontmatter-neighbor-app/config.rb +0 -0
  16. data/fixtures/frontmatter-neighbor-app/source/front-matter-2.php.erb +2 -0
  17. data/fixtures/frontmatter-neighbor-app/source/front-matter-2.php.erb.frontmatter +4 -0
  18. data/fixtures/frontmatter-neighbor-app/source/front-matter-auto.erb +1 -0
  19. data/fixtures/frontmatter-neighbor-app/source/front-matter-auto.erb.frontmatter +4 -0
  20. data/fixtures/frontmatter-neighbor-app/source/front-matter-change.html.erb +1 -0
  21. data/fixtures/frontmatter-neighbor-app/source/front-matter-change.html.erb.frontmatter +4 -0
  22. data/fixtures/frontmatter-neighbor-app/source/front-matter-encoding.html.erb +1 -0
  23. data/fixtures/frontmatter-neighbor-app/source/front-matter-encoding.html.erb.frontmatter +5 -0
  24. data/fixtures/frontmatter-neighbor-app/source/json-front-matter-2.php.erb +2 -0
  25. data/fixtures/frontmatter-neighbor-app/source/json-front-matter-2.php.erb.frontmatter +4 -0
  26. data/fixtures/frontmatter-neighbor-app/source/json-front-matter-auto.erb +1 -0
  27. data/fixtures/frontmatter-neighbor-app/source/json-front-matter-auto.erb.frontmatter +4 -0
  28. data/fixtures/frontmatter-neighbor-app/source/json-front-matter.html.erb +1 -0
  29. data/fixtures/frontmatter-neighbor-app/source/json-front-matter.html.erb.frontmatter +4 -0
  30. data/fixtures/frontmatter-neighbor-app/source/raw-front-matter.html +1 -0
  31. data/fixtures/frontmatter-neighbor-app/source/raw-front-matter.html.frontmatter +4 -0
  32. data/fixtures/frontmatter-neighbor-app/source/raw-front-matter.php +1 -0
  33. data/fixtures/frontmatter-neighbor-app/source/raw-front-matter.php.frontmatter +4 -0
  34. data/fixtures/frontmatter-settings-neighbor-app/config.rb +4 -0
  35. data/fixtures/frontmatter-settings-neighbor-app/source/alternate_layout.html.erb +1 -0
  36. data/fixtures/frontmatter-settings-neighbor-app/source/alternate_layout.html.erb.frontmatter +3 -0
  37. data/fixtures/frontmatter-settings-neighbor-app/source/ignored.html.erb +1 -0
  38. data/fixtures/frontmatter-settings-neighbor-app/source/ignored.html.erb.frontmatter +3 -0
  39. data/fixtures/frontmatter-settings-neighbor-app/source/layouts/alternate.erb +3 -0
  40. data/fixtures/frontmatter-settings-neighbor-app/source/layouts/override.erb +2 -0
  41. data/fixtures/frontmatter-settings-neighbor-app/source/override_layout.html.erb +1 -0
  42. data/fixtures/frontmatter-settings-neighbor-app/source/override_layout.html.erb.frontmatter +3 -0
  43. data/fixtures/frontmatter-settings-neighbor-app/source/page_mentioned.html.erb +1 -0
  44. data/fixtures/frontmatter-settings-neighbor-app/source/page_mentioned.html.erb.frontmatter +3 -0
  45. data/fixtures/nested-data-app/config.rb +1 -0
  46. data/fixtures/nested-data-app/data/examples/test.yml +1 -0
  47. data/fixtures/nested-data-app/source/test.html.erb +1 -0
  48. data/fixtures/queryable-app/config.rb +0 -0
  49. data/fixtures/queryable-app/source/2010-08-08-test-document-file.html.markdown +8 -0
  50. data/fixtures/queryable-app/source/2010-08-09-another-test-document.html.markdown +10 -0
  51. data/fixtures/queryable-app/source/2011-12-26-some-test-document.html.markdown +6 -0
  52. data/fixtures/queryable-app/source/document_with_date_in_yaml.html.markdown +7 -0
  53. data/fixtures/queryable-app/source/document_without_date.html.markdown +7 -0
  54. data/lib/middleman-core/application.rb +52 -84
  55. data/lib/middleman-core/cli.rb +3 -2
  56. data/lib/middleman-core/cli/build.rb +5 -7
  57. data/lib/middleman-core/cli/bundler.rb +1 -1
  58. data/lib/middleman-core/cli/console.rb +46 -0
  59. data/lib/middleman-core/configuration.rb +235 -0
  60. data/lib/middleman-core/core_extensions.rb +0 -6
  61. data/lib/middleman-core/core_extensions/data.rb +34 -11
  62. data/lib/middleman-core/core_extensions/extensions.rb +31 -35
  63. data/lib/middleman-core/core_extensions/external_helpers.rb +7 -7
  64. data/lib/middleman-core/core_extensions/file_watcher.rb +1 -1
  65. data/lib/middleman-core/core_extensions/front_matter.rb +44 -38
  66. data/lib/middleman-core/core_extensions/rendering.rb +27 -21
  67. data/lib/middleman-core/core_extensions/request.rb +41 -73
  68. data/lib/middleman-core/core_extensions/routing.rb +7 -24
  69. data/lib/middleman-core/core_extensions/show_exceptions.rb +6 -8
  70. data/lib/middleman-core/extensions.rb +35 -0
  71. data/lib/middleman-core/logger.rb +9 -0
  72. data/lib/middleman-core/meta_pages.rb +93 -0
  73. data/lib/middleman-core/meta_pages/assets/config.css +36 -0
  74. data/lib/middleman-core/meta_pages/assets/glyphicons-halflings.png +0 -0
  75. data/lib/middleman-core/meta_pages/assets/jquery-1.8.2.min.js +2 -0
  76. data/lib/middleman-core/meta_pages/assets/jquery.details-1.6.min.js +6 -0
  77. data/lib/middleman-core/meta_pages/assets/meta.css +368 -0
  78. data/lib/middleman-core/meta_pages/assets/sitemap.css +635 -0
  79. data/lib/middleman-core/meta_pages/assets/sitemap.js +0 -0
  80. data/lib/middleman-core/meta_pages/config_setting.rb +39 -0
  81. data/lib/middleman-core/meta_pages/sitemap_resource.rb +52 -0
  82. data/lib/middleman-core/meta_pages/sitemap_tree.rb +73 -0
  83. data/lib/middleman-core/meta_pages/templates/config.html.erb +59 -0
  84. data/lib/middleman-core/meta_pages/templates/index.html.erb +21 -0
  85. data/lib/middleman-core/meta_pages/templates/sitemap.html.erb +31 -0
  86. data/lib/middleman-core/preview_server.rb +18 -7
  87. data/lib/middleman-core/profiling.rb +1 -1
  88. data/lib/middleman-core/renderers/erb.rb +5 -5
  89. data/lib/middleman-core/renderers/less.rb +3 -3
  90. data/lib/middleman-core/renderers/markdown.rb +10 -9
  91. data/lib/middleman-core/renderers/redcarpet.rb +16 -21
  92. data/lib/middleman-core/renderers/sass.rb +4 -5
  93. data/lib/middleman-core/renderers/slim.rb +4 -1
  94. data/lib/middleman-core/sitemap.rb +3 -3
  95. data/lib/middleman-core/sitemap/extensions/content_type.rb +16 -0
  96. data/lib/middleman-core/sitemap/extensions/on_disk.rb +2 -2
  97. data/lib/middleman-core/sitemap/extensions/proxies.rb +26 -16
  98. data/lib/middleman-core/sitemap/queryable.rb +148 -0
  99. data/lib/middleman-core/sitemap/resource.rb +14 -2
  100. data/lib/middleman-core/sitemap/store.rb +8 -7
  101. data/lib/middleman-core/step_definitions/builder_steps.rb +3 -0
  102. data/lib/middleman-core/step_definitions/server_steps.rb +6 -1
  103. data/lib/middleman-core/templates/default/source/layouts/layout.erb +1 -1
  104. data/lib/middleman-core/templates/extension/lib/lib.rb +17 -26
  105. data/lib/middleman-core/templates/html5/source/layouts/layout.erb +1 -1
  106. data/lib/middleman-core/templates/shared/Gemfile.tt +6 -1
  107. data/lib/middleman-core/util.rb +7 -5
  108. data/lib/middleman-core/version.rb +1 -1
  109. data/middleman-core.gemspec +1 -1
  110. metadata +126 -28
  111. data/lib/middleman-core/core_extensions/builder.rb +0 -17
  112. data/lib/middleman-core/core_extensions/ruby_encoding.rb +0 -25
  113. data/middleman-core-x86-mingw32.gemspec +0 -38
File without changes
@@ -0,0 +1,39 @@
1
+ module Middleman
2
+ module MetaPages
3
+ # View class for a config entry
4
+ class ConfigSetting
5
+ include Padrino::Helpers::OutputHelpers
6
+ include Padrino::Helpers::TagHelpers
7
+
8
+ def initialize(setting)
9
+ @setting = setting
10
+ end
11
+
12
+ def render
13
+ content = ""
14
+ key_classes = ['key']
15
+ key_classes << 'modified' if @setting.value_set?
16
+ content << content_tag(:span, @setting.key.inspect, :class => key_classes.join(' '))
17
+ content << " = "
18
+ content << content_tag(:span, CGI::escapeHTML(@setting.value.inspect), :class => 'value')
19
+ if @setting.default
20
+ content << content_tag(:span, :class => 'default') do
21
+ if @setting.value_set?
22
+ "Default: #{CGI::escapeHTML(@setting.default.inspect)}"
23
+ else
24
+ "(Default)"
25
+ end
26
+ end
27
+ end
28
+
29
+ if @setting.description
30
+ content << content_tag(:p, :class => 'description') do
31
+ CGI::escapeHTML(@setting.description)
32
+ end
33
+ end
34
+
35
+ content
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,52 @@
1
+ module Middleman
2
+ module MetaPages
3
+ # View class for a sitemap resource
4
+ class SitemapResource
5
+ include Padrino::Helpers::OutputHelpers
6
+ include Padrino::Helpers::TagHelpers
7
+
8
+ def initialize(resource)
9
+ @resource = resource
10
+ end
11
+
12
+ def render
13
+ content_tag :div, :class => 'resource-details' do
14
+ content_tag :table do
15
+ content = ""
16
+ resource_properties.each do |label, value|
17
+ content << content_tag(:tr) do
18
+ row_content = ""
19
+ row_content << content_tag(:th, label)
20
+ row_content << content_tag(:td, value)
21
+ row_content
22
+ end
23
+ end
24
+ content
25
+ end
26
+ end
27
+ end
28
+
29
+ # A hash of label to value for all the properties we want to display
30
+ def resource_properties
31
+ props = {
32
+ 'Path' => @resource.path,
33
+ 'Build Path' => @resource.destination_path,
34
+ 'URL' => content_tag(:a, @resource.url, :href => @resource.url),
35
+ 'Template' => @resource.source_file,
36
+ }
37
+
38
+ data = @resource.data
39
+ props['Data'] = data unless data.empty?
40
+
41
+ options = @resource.metadata[:options]
42
+ props['Options'] = options unless options.empty?
43
+
44
+ props
45
+ end
46
+
47
+ def css_classes
48
+ ['resource']
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,73 @@
1
+ require 'middleman-core/meta_pages/sitemap_resource'
2
+
3
+ module Middleman
4
+ module MetaPages
5
+ # View class for a sitemap tree
6
+ class SitemapTree
7
+ def initialize
8
+ @children = {}
9
+ end
10
+
11
+ def add_resource(resource)
12
+ add_path(resource.path.split('/'), resource)
13
+ end
14
+
15
+ def render
16
+ content = ""
17
+ @children.keys.sort do |a,b|
18
+ a_subtree = @children[a]
19
+ b_subtree = @children[b]
20
+ if a_subtree.is_a? SitemapResource
21
+ if b_subtree.is_a? SitemapResource
22
+ a.downcase <=> b.downcase
23
+ else
24
+ 1
25
+ end
26
+ elsif b_subtree.is_a? SitemapResource
27
+ if a_subtree.is_a? SitemapResource
28
+ b.downcase <=> a.downcase
29
+ else
30
+ -1
31
+ end
32
+ else
33
+ a.downcase <=> b.downcase
34
+ end
35
+ end.each do |path_part|
36
+ subtree = @children[path_part]
37
+ content << "<details class='#{subtree.css_classes.join(' ')}'>"
38
+ content << "<summary>"
39
+ content << "<i class='icon-folder-open'></i>" unless subtree.is_a? SitemapResource
40
+ content << "#{path_part}</summary>"
41
+ content << subtree.render
42
+ content << "</details>"
43
+ end
44
+ content
45
+ end
46
+
47
+ def css_classes
48
+ ['tree']
49
+ end
50
+
51
+ protected
52
+
53
+ def add_path(path_parts, resource)
54
+ first_part = path_parts.first
55
+
56
+ if path_parts.size == 1
57
+ sitemap_class = SitemapResource
58
+ # Allow special sitemap resources to use custom metadata view calsses
59
+ sitemap_class = resource.meta_pages_class if resource.respond_to? :meta_pages_class
60
+
61
+ @children[first_part] = sitemap_class.new(resource)
62
+ else
63
+ @children[first_part] ||= SitemapTree.new
64
+ @children[first_part].add_path(path_parts[1..-1], resource)
65
+ end
66
+ end
67
+
68
+ def to_s
69
+ "Sitemap Tree"
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,59 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Middleman Configuration</title>
6
+ <link type="text/css" rel="stylesheet" href="../assets/meta.css">
7
+ <link type="text/css" rel="stylesheet" href="../assets/config.css">
8
+ </head>
9
+
10
+ <body>
11
+ <div class="container">
12
+ <article id="main">
13
+ <a href="../">&laquo; back</a>
14
+ <h1>Middleman Configuration</h1>
15
+
16
+ <p>This page shows the current configuration of your Middleman application.</p>
17
+
18
+ <p>
19
+ <a href="#core">Core configuration</a>
20
+ | <a href="#extensions">Extensions</a>
21
+ </p>
22
+
23
+ <h2 id="core">Core Configuration</h2>
24
+ <ul class="settings">
25
+ <% global_config.each do |setting| %>
26
+ <li class="setting"><%= setting.render %></li>
27
+ <% end %>
28
+ </ul>
29
+
30
+ <h2 id="extensions">Extensions</h2>
31
+ <ul class="extensions">
32
+ <% extension_config.each do |ext_name, configs| %>
33
+ <li>
34
+ <% registered_extensions.delete(ext_name) %>
35
+
36
+ <span class="extension active"><%= ext_name.inspect %></span>
37
+
38
+
39
+ <% if configs && !configs.empty? %>
40
+ <ul class="settings">
41
+ <% configs.each do |setting| %>
42
+ <li class="setting"><%= setting.render %></li>
43
+ <% end %>
44
+ </ul>
45
+ <% end %>
46
+ </li>
47
+
48
+ <% end %>
49
+
50
+ <% registered_extensions.keys.each do |ext_name| %>
51
+ <li><span class="extension"><%= ext_name.inspect %></span> (Inactive)</li>
52
+ <% end %>
53
+ </ul>
54
+ </article>
55
+ </div>
56
+ </body>
57
+ </html>
58
+
59
+
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Middleman Info</title>
6
+ <link type="text/css" rel="stylesheet" href="assets/meta.css">
7
+ </head>
8
+
9
+ <body>
10
+ <div class="container">
11
+ <h1>Middleman Information</h1>
12
+
13
+ <ul>
14
+ <li><a href="sitemap/">Sitemap</a></li>
15
+ <li><a href="config/">Configuration</a></li>
16
+ <li><a href="http://middlemanapp.com">Middleman Guides</a></li>
17
+ </ul>
18
+ </div>
19
+ </body>
20
+ </html>
21
+
@@ -0,0 +1,31 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+
6
+ <title>Middleman Sitemap</title>
7
+
8
+
9
+ <link type="text/css" rel="stylesheet" href="../assets/meta.css">
10
+ <link type="text/css" rel="stylesheet" href="../assets/sitemap.css">
11
+ <script src="../assets/jquery-1.8.2.min.js"></script>
12
+ <script src="../assets/jquery.details-1.6.min.js"></script>
13
+ <script src="../assets/sitemap.js"></script>
14
+ </head>
15
+
16
+ <body>
17
+ <div class="container">
18
+ <article id="main">
19
+ <a href="../">&laquo; back</a>
20
+ <h1>Middleman Sitemap</h1>
21
+
22
+ <p>This page shows all of the pages in
23
+ the <a href="http://middlemanapp.com/advanced/sitemap/">sitemap</a>,
24
+ Middleman's view of your site.</p>
25
+
26
+ <%= sitemap_tree.render %>
27
+ </article>
28
+ </div>
29
+ </body>
30
+ </html>
31
+
@@ -1,4 +1,5 @@
1
1
  require "webrick"
2
+ require 'middleman-core/meta_pages'
2
3
 
3
4
  module Middleman
4
5
  module PreviewServer
@@ -18,6 +19,7 @@ module Middleman
18
19
 
19
20
  mount_instance
20
21
  logger.info "== The Middleman is standing watch at http://#{host}:#{port}"
22
+ logger.info "== Inspect your site configuration at http://#{host}:#{port}/__middleman/"
21
23
 
22
24
  @initialized ||= false
23
25
  unless @initialized
@@ -76,9 +78,17 @@ module Middleman
76
78
  private
77
79
  def new_app
78
80
  opts = @options
79
- @app =::Middleman::Application.server.inst do
81
+ server = ::Middleman::Application.server
82
+
83
+ # Add in the meta pages application
84
+ meta_app = Middleman::MetaPages::Application.new(server)
85
+ server.map '/__middleman' do
86
+ run meta_app
87
+ end
88
+
89
+ @app = server.inst do
80
90
  if opts[:environment]
81
- set :environment, opts[:environment].to_sym
91
+ config[:environment] = opts[:environment].to_sym
82
92
  end
83
93
 
84
94
  logger(opts[:debug] ? 0 : 1, opts[:instrumenting] || false)
@@ -100,7 +110,7 @@ module Middleman
100
110
  added_and_modified = (modified + added)
101
111
 
102
112
  # See if the changed file is config.rb or lib/*.rb
103
- if needs_to_reload?(added_and_modified) || needs_to_reload?(removed)
113
+ if needs_to_reload?(added_and_modified + removed)
104
114
  reload
105
115
  else
106
116
  added_and_modified.each do |path|
@@ -148,7 +158,7 @@ module Middleman
148
158
 
149
159
  begin
150
160
  ::WEBrick::HTTPServer.new(http_opts)
151
- rescue Errno::EADDRINUSE => e
161
+ rescue Errno::EADDRINUSE
152
162
  logger.error "== Port #{port} is unavailable. Either close the instance of Middleman already running on #{port} or start this Middleman on a new port with: --port=#{port.to_i+1}"
153
163
  exit(1)
154
164
  end
@@ -164,7 +174,8 @@ module Middleman
164
174
 
165
175
  start_file_watcher
166
176
 
167
- @webrick.mount "/", ::Rack::Handler::WEBrick, app.class.to_rack_app
177
+ rack_app = app.class.to_rack_app
178
+ @webrick.mount "/", ::Rack::Handler::WEBrick, rack_app
168
179
  end
169
180
 
170
181
  # Detach the current Middleman::Application instance
@@ -180,8 +191,8 @@ module Middleman
180
191
  def needs_to_reload?(paths)
181
192
  match_against = [
182
193
  %r{^config\.rb},
183
- %r{^lib/^[^\.](.*)\.rb$},
184
- %r{^helpers/^[^\.](.*)_helper\.rb$}
194
+ %r{^lib/[^\.](.*)\.rb$},
195
+ %r{^helpers/[^\.](.*)\.rb$}
185
196
  ]
186
197
 
187
198
  if @options[:reload_paths]
@@ -34,7 +34,7 @@ module Middleman
34
34
  begin
35
35
  require 'ruby-prof'
36
36
  rescue LoadError
37
- raise "To use the --profile option, you must 'gem install ruby-prof' (and include it in your Gemfile if running under bundle exec)"
37
+ raise "To use the --profile option, you must add the 'ruby-prof' gem to your Gemfile"
38
38
  end
39
39
  end
40
40
 
@@ -8,8 +8,8 @@ module Middleman
8
8
  # once registered
9
9
  def registered(app)
10
10
  # Setup a default ERb engine
11
- app.set :erb_engine, :erb
12
- app.set :erb_engine_prefix, ::Tilt
11
+ app.config.define_setting :erb_engine, :erb, 'The engine to use for rendering ERb templates'
12
+ app.config.define_setting :erb_engine_prefix, ::Tilt, 'The parent module for ERb template engines'
13
13
 
14
14
  app.before_configuration do
15
15
  template_extensions :erb => :html
@@ -19,14 +19,14 @@ module Middleman
19
19
  app.after_configuration do
20
20
  # Find the user's prefered engine
21
21
  # Convert symbols to classes
22
- if erb_engine.is_a? Symbol
22
+ if config[:erb_engine].is_a? Symbol
23
23
  engine = engine.to_s
24
24
  engine = engine == "erb" ? "ERB" : engine.camelize
25
- erb_engine = erb_engine_prefix.const_get("#{engine}Template")
25
+ config[:erb_engine] = config[:erb_engine_prefix].const_get("#{engine}Template")
26
26
  end
27
27
 
28
28
  # Tell Tilt to use the preferred engine
29
- ::Tilt.prefer(erb_engine)
29
+ ::Tilt.prefer(config[:erb_engine])
30
30
  end
31
31
  end
32
32
  alias :included :registered
@@ -11,15 +11,15 @@ module Middleman
11
11
 
12
12
  # Once registered
13
13
  def registered(app)
14
- # Default sass options
15
- app.set :less, {}
14
+ # Default less options
15
+ app.config.define_setting :less, {}, 'LESS compiler options'
16
16
 
17
17
  app.before_configuration do
18
18
  template_extensions :less => :css
19
19
  end
20
20
 
21
21
  app.after_configuration do
22
- ::Less.paths << File.expand_path(css_dir, source_dir)
22
+ ::Less.paths << File.join(source_dir, config[:css_dir])
23
23
  end
24
24
 
25
25
  # Tell Tilt to use it as well (for inline sass blocks)
@@ -10,8 +10,8 @@ module Middleman
10
10
  # Once registered
11
11
  def registered(app)
12
12
  # Set our preference for a markdown engine
13
- app.set :markdown_engine, :maruku
14
- app.set :markdown_engine_prefix, ::Tilt
13
+ app.config.define_setting :markdown_engine, :kramdown, 'Preferred markdown engine'
14
+ app.config.define_setting :markdown_engine_prefix, ::Tilt, 'The parent module for markdown template engines'
15
15
 
16
16
  app.before_configuration do
17
17
  template_extensions :markdown => :html,
@@ -26,24 +26,25 @@ module Middleman
26
26
 
27
27
  begin
28
28
  # Look for the user's preferred engine
29
- if markdown_engine == :redcarpet
29
+ if config[:markdown_engine] == :redcarpet
30
30
  require "middleman-core/renderers/redcarpet"
31
31
  ::Tilt.prefer(::Middleman::Renderers::RedcarpetTemplate)
32
- elsif !markdown_engine.nil?
32
+ MiddlemanRedcarpetHTML.middleman_app = self
33
+ elsif !config[:markdown_engine].nil?
33
34
  # Map symbols to classes
34
- markdown_engine_klass = if markdown_engine.is_a? Symbol
35
- engine = markdown_engine.to_s
35
+ markdown_engine_klass = if config[:markdown_engine].is_a? Symbol
36
+ engine = config[:markdown_engine].to_s
36
37
  engine = engine == "rdiscount" ? "RDiscount" : engine.camelize
37
- markdown_engine_prefix.const_get("#{engine}Template")
38
+ config[:markdown_engine_prefix].const_get("#{engine}Template")
38
39
  else
39
- markdown_engine_prefix
40
+ config[:markdown_engine_prefix]
40
41
  end
41
42
 
42
43
  # Tell tilt to use that engine
43
44
  ::Tilt.prefer(markdown_engine_klass)
44
45
  end
45
46
  rescue LoadError
46
- logger.warn "Requested Markdown engine (#{markdown_engine}) not found. Maybe the gem needs to be installed and required?"
47
+ logger.warn "Requested Markdown engine (#{config[:markdown_engine]}) not found. Maybe the gem needs to be installed and required?"
47
48
  end
48
49
  end
49
50
  end