middleman-core 3.0.0.beta.2 → 3.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. data/features/cli_extension.feature +13 -0
  2. data/features/{cli.feature → cli_init.feature} +1 -10
  3. data/features/directory_index.feature +29 -1
  4. data/features/dynamic_pages.feature +1 -0
  5. data/features/extensionless_text_files.feature +0 -2
  6. data/features/front-matter.feature +17 -1
  7. data/features/frontmatter_page_settings.feature +16 -1
  8. data/features/helpers_relative_link_to.feature +68 -0
  9. data/features/unicode_filenames.feature +14 -0
  10. data/fixtures/csspie/config.rb +0 -0
  11. data/fixtures/csspie/source/stylesheets/PIE.htc +96 -0
  12. data/fixtures/dynamic-pages-app/config.rb +3 -0
  13. data/fixtures/frontmatter-app/source/front-matter-auto.erb +6 -0
  14. data/fixtures/frontmatter-app/source/front-matter.html.erb +2 -0
  15. data/fixtures/frontmatter-app/source/json-front-matter-2.php.erb +7 -0
  16. data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +6 -0
  17. data/fixtures/frontmatter-app/source/json-front-matter.html.erb +6 -0
  18. data/fixtures/unicode-filenames-app/config.rb +1 -0
  19. data/fixtures/unicode-filenames-app/source/snowmen-rule-/342/230/203.html +4 -0
  20. data/lib/middleman-core/application.rb +43 -335
  21. data/lib/middleman-core/cli/build.rb +11 -4
  22. data/lib/middleman-core/cli/bundler.rb +40 -0
  23. data/lib/middleman-core/cli/extension.rb +36 -0
  24. data/lib/middleman-core/cli/server.rb +2 -2
  25. data/lib/middleman-core/cli.rb +2 -6
  26. data/lib/middleman-core/core_extensions/assets.rb +35 -31
  27. data/lib/middleman-core/core_extensions/builder.rb +14 -9
  28. data/lib/middleman-core/core_extensions/data.rb +150 -145
  29. data/lib/middleman-core/core_extensions/default_helpers.rb +159 -97
  30. data/lib/middleman-core/core_extensions/extensions.rb +103 -97
  31. data/lib/middleman-core/core_extensions/external_helpers.rb +27 -23
  32. data/lib/middleman-core/core_extensions/file_watcher.rb +140 -110
  33. data/lib/middleman-core/core_extensions/front_matter.rb +155 -175
  34. data/lib/middleman-core/core_extensions/i18n.rb +111 -102
  35. data/lib/middleman-core/core_extensions/rendering.rb +293 -295
  36. data/lib/middleman-core/core_extensions/request.rb +338 -0
  37. data/lib/middleman-core/core_extensions/routing.rb +72 -68
  38. data/lib/middleman-core/core_extensions/show_exceptions.rb +23 -18
  39. data/lib/middleman-core/core_extensions.rb +39 -0
  40. data/lib/middleman-core/extensions/directory_indexes.rb +1 -4
  41. data/lib/middleman-core/extensions/lorem.rb +10 -3
  42. data/lib/middleman-core/extensions.rb +2 -64
  43. data/lib/middleman-core/preview_server.rb +157 -0
  44. data/lib/middleman-core/sitemap/extensions/ignores.rb +73 -68
  45. data/lib/middleman-core/sitemap/extensions/on_disk.rb +65 -58
  46. data/lib/middleman-core/sitemap/extensions/proxies.rb +86 -75
  47. data/lib/middleman-core/sitemap/extensions/traversal.rb +68 -61
  48. data/lib/middleman-core/sitemap/resource.rb +123 -102
  49. data/lib/middleman-core/sitemap/store.rb +170 -149
  50. data/lib/middleman-core/sitemap.rb +57 -57
  51. data/lib/middleman-core/step_definitions/server_steps.rb +13 -3
  52. data/lib/middleman-core/templates/extension/Gemfile +4 -0
  53. data/lib/middleman-core/templates/extension/Rakefile +12 -0
  54. data/lib/middleman-core/templates/extension/features/support/env.rb +4 -0
  55. data/lib/middleman-core/templates/extension/gemspec +24 -0
  56. data/lib/middleman-core/templates/extension/lib/lib.rb +49 -0
  57. data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -0
  58. data/lib/middleman-core/templates/shared/gitignore +14 -0
  59. data/lib/middleman-core/templates.rb +14 -8
  60. data/lib/middleman-core/util.rb +31 -9
  61. data/lib/middleman-core/version.rb +1 -1
  62. data/lib/middleman-core.rb +6 -4
  63. data/middleman-core.gemspec +4 -6
  64. metadata +62 -203
  65. data/lib/middleman-core/vendor/padrino-core-0.10.6/.document +0 -5
  66. data/lib/middleman-core/vendor/padrino-core-0.10.6/.gitignore +0 -22
  67. data/lib/middleman-core/vendor/padrino-core-0.10.6/.yardopts +0 -1
  68. data/lib/middleman-core/vendor/padrino-core-0.10.6/LICENSE.txt +0 -20
  69. data/lib/middleman-core/vendor/padrino-core-0.10.6/README.rdoc +0 -294
  70. data/lib/middleman-core/vendor/padrino-core-0.10.6/Rakefile +0 -5
  71. data/lib/middleman-core/vendor/padrino-core-0.10.6/bin/padrino +0 -9
  72. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/rendering.rb +0 -292
  73. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/routing.rb +0 -943
  74. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/showexceptions.rb +0 -20
  75. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application.rb +0 -269
  76. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/caller.rb +0 -53
  77. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/adapter.rb +0 -24
  78. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/base.rb +0 -150
  79. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/console.rb +0 -20
  80. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake.rb +0 -24
  81. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake_tasks.rb +0 -59
  82. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/command.rb +0 -38
  83. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/404.png +0 -0
  84. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/500.png +0 -0
  85. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/loader.rb +0 -211
  86. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/cs.yml +0 -34
  87. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/da.yml +0 -34
  88. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/de.yml +0 -34
  89. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/en.yml +0 -34
  90. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/es.yml +0 -34
  91. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/fr.yml +0 -34
  92. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/hu.yml +0 -34
  93. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/it.yml +0 -40
  94. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ja.yml +0 -34
  95. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/lv.yml +0 -34
  96. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/nl.yml +0 -34
  97. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/no.yml +0 -35
  98. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pl.yml +0 -34
  99. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pt_br.yml +0 -40
  100. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ru.yml +0 -35
  101. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/tr.yml +0 -34
  102. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/uk.yml +0 -34
  103. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_cn.yml +0 -34
  104. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_tw.yml +0 -34
  105. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/logger.rb +0 -428
  106. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/mounter.rb +0 -224
  107. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/reloader.rb +0 -254
  108. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/router.rb +0 -98
  109. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/server.rb +0 -79
  110. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/support_lite.rb +0 -199
  111. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/tasks.rb +0 -21
  112. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/version.rb +0 -20
  113. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core.rb +0 -152
  114. data/lib/middleman-core/vendor/padrino-core-0.10.6/padrino-core.gemspec +0 -38
  115. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.components +0 -6
  116. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.gitignore +0 -7
  117. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/complex.rb +0 -32
  118. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/simple.rb +0 -33
  119. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/a.rb +0 -9
  120. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/b.rb +0 -4
  121. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/c.rb +0 -1
  122. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/e.rb +0 -13
  123. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/f.rb +0 -2
  124. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/g.rb +0 -2
  125. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/d.rb +0 -4
  126. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/helper.rb +0 -83
  127. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/mini_shoulda.rb +0 -45
  128. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_application.rb +0 -108
  129. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_core.rb +0 -77
  130. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_dependencies.rb +0 -44
  131. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_filters.rb +0 -278
  132. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_locale.rb +0 -21
  133. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_logger.rb +0 -154
  134. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_mounter.rb +0 -177
  135. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_complex.rb +0 -75
  136. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_simple.rb +0 -98
  137. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_rendering.rb +0 -461
  138. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_restful_routing.rb +0 -33
  139. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_router.rb +0 -146
  140. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_routing.rb +0 -1680
  141. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.document +0 -5
  142. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.gitignore +0 -21
  143. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.yardopts +0 -1
  144. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/LICENSE.txt +0 -20
  145. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/README.rdoc +0 -239
  146. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/Rakefile +0 -5
  147. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/asset_tag_helpers.rb +0 -417
  148. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -251
  149. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -43
  150. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_helpers.rb +0 -787
  151. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/format_helpers.rb +0 -381
  152. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/cs.yml +0 -103
  153. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/da.yml +0 -91
  154. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/de.yml +0 -81
  155. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/en.yml +0 -103
  156. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/es.yml +0 -103
  157. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/fr.yml +0 -80
  158. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/hu.yml +0 -103
  159. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/it.yml +0 -89
  160. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ja.yml +0 -103
  161. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/lv.yml +0 -103
  162. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/nl.yml +0 -82
  163. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/no.yml +0 -91
  164. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pl.yml +0 -95
  165. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pt_br.yml +0 -103
  166. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ru.yml +0 -103
  167. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/tr.yml +0 -103
  168. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/uk.yml +0 -103
  169. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_cn.yml +0 -104
  170. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_tw.yml +0 -103
  171. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/number_helpers.rb +0 -288
  172. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -98
  173. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -79
  174. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
  175. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -81
  176. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers.rb +0 -175
  177. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/render_helpers.rb +0 -60
  178. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/tag_helpers.rb +0 -260
  179. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/translation_helpers.rb +0 -38
  180. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers.rb +0 -59
  181. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/padrino-helpers.gemspec +0 -27
  182. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/app.rb +0 -73
  183. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.erb +0 -14
  184. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.haml +0 -12
  185. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.slim +0 -13
  186. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.erb +0 -14
  187. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml +0 -12
  188. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim +0 -12
  189. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb +0 -11
  190. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml +0 -9
  191. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim +0 -9
  192. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb +0 -5
  193. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml +0 -5
  194. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim +0 -5
  195. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb +0 -20
  196. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml +0 -15
  197. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim +0 -15
  198. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb +0 -72
  199. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml +0 -59
  200. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim +0 -59
  201. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb +0 -86
  202. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml +0 -70
  203. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim +0 -70
  204. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb +0 -5
  205. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml +0 -4
  206. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim +0 -4
  207. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb +0 -3
  208. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml +0 -3
  209. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim +0 -3
  210. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb +0 -3
  211. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml +0 -3
  212. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim +0 -3
  213. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
  214. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
  215. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
  216. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb +0 -1
  217. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml +0 -1
  218. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim +0 -1
  219. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb +0 -50
  220. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml +0 -5
  221. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
  222. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
  223. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
  224. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb +0 -1
  225. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml +0 -5
  226. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml +0 -1
  227. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml +0 -7
  228. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml +0 -1
  229. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml +0 -2
  230. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb +0 -66
  231. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb +0 -328
  232. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb +0 -1106
  233. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb +0 -770
  234. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb +0 -227
  235. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb +0 -20
  236. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb +0 -139
  237. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb +0 -153
  238. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb +0 -76
  239. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb +0 -106
  240. data/lib/middleman-core/watcher.rb +0 -196
@@ -9,359 +9,357 @@ class Tilt::Template
9
9
  end
10
10
 
11
11
  # Rendering extension
12
- module Middleman::CoreExtensions::Rendering
12
+ module Middleman
13
+ module CoreExtensions
14
+ module Rendering
13
15
 
14
- # Setup extension
15
- class << self
16
+ # Setup extension
17
+ class << self
16
18
 
17
- # Once registered
18
- def registered(app)
19
- # Include methods
20
- app.send :include, InstanceMethods
19
+ # Once registered
20
+ def registered(app)
21
+ # Include methods
22
+ app.send :include, InstanceMethods
21
23
 
22
- # Activate custom renderers
23
- app.register Middleman::Renderers::ERb
24
- end
24
+ # Activate custom renderers
25
+ app.register Middleman::Renderers::ERb
26
+ end
25
27
 
26
- alias :included :registered
27
- end
28
-
29
- # Custom error class for handling
30
- class TemplateNotFound < RuntimeError
31
- end
28
+ alias :included :registered
29
+ end
32
30
 
33
- # Rendering instance methods
34
- module InstanceMethods
35
-
36
- # Override init to clear cache on file removal
37
- def initialize
38
- # Default extension map
39
- @_template_extensions = {
40
-
41
- }
42
-
43
- static_path = source_dir.sub(self.root, "").sub(/^\//, "")
44
- render_regex = static_path.empty? ? // : (%r{^#{static_path + "/"}})
45
-
46
- self.files.changed render_regex do |file|
47
- path = File.expand_path(file, self.root)
48
- self.cache.remove(:raw_template, path)
31
+ # Custom error class for handling
32
+ class TemplateNotFound < RuntimeError
49
33
  end
50
-
51
- super
52
- end
34
+
35
+ # Rendering instance methods
36
+ module InstanceMethods
53
37
 
54
- # Add or overwrite a default template extension
55
- #
56
- # @param [Hash] extension_map
57
- # @return [void]
58
- def template_extensions(extension_map={})
59
- @_template_extensions.merge!(extension_map)
60
- end
38
+ # Add or overwrite a default template extension
39
+ #
40
+ # @param [Hash] extension_map
41
+ # @return [Hash]
42
+ def template_extensions(extension_map=nil)
43
+ @_template_extensions ||= {}
44
+ @_template_extensions.merge!(extension_map) if extension_map
45
+ @_template_extensions
46
+ end
61
47
 
62
- # Render a template, with layout, given a path
63
- #
64
- # @param [String] path
65
- # @param [Hash] locs
66
- # @param [Hash] opts
67
- # @return [String]
68
- def render_template(path, locs={}, opts={})
69
- # Detect the remdering engine from the extension
70
- extension = File.extname(path)
71
- engine = extension[1..-1].to_sym
48
+ # Render a template, with layout, given a path
49
+ #
50
+ # @param [String] path
51
+ # @param [Hash] locs
52
+ # @param [Hash] opts
53
+ # @return [String]
54
+ def render_template(path, locs={}, opts={})
55
+ # Detect the remdering engine from the extension
56
+ extension = File.extname(path)
57
+ engine = extension[1..-1].to_sym
72
58
 
73
- # Store last engine for later (could be inside nested renders)
74
- @current_engine, engine_was = engine, @current_engine
59
+ # Store last engine for later (could be inside nested renders)
60
+ @current_engine, engine_was = engine, @current_engine
75
61
 
76
- # Use a dup of self as a context so that instance variables set within
77
- # the template don't persist for other templates.
78
- context = self.dup
62
+ # Use a dup of self as a context so that instance variables set within
63
+ # the template don't persist for other templates.
64
+ context = self.dup
79
65
 
80
- # Store current locs/opts for later
81
- @current_locs = locs, @current_opts = opts
66
+ # Store current locs/opts for later
67
+ @current_locs = locs, @current_opts = opts
82
68
 
83
- # Keep rendering template until we've used up all extensions. This handles
84
- # cases like `style.css.sass.erb`
85
- while ::Tilt[path]
86
- content = render_individual_file(path, locs, opts, context)
87
- path = File.basename(path, File.extname(path))
88
- cache.set([:raw_template, path], content)
89
- end
69
+ # Keep rendering template until we've used up all extensions. This
70
+ # handles cases like `style.css.sass.erb`
71
+ content = nil
72
+ while ::Tilt[path]
73
+ opts[:template_body] = content if content
74
+ content = render_individual_file(path, locs, opts, context)
75
+ path = File.basename(path, File.extname(path))
76
+ end
90
77
 
91
- # Certain output file types don't use layouts
92
- needs_layout = !%w(.js .json .css .txt).include?(extension)
78
+ # Certain output file types don't use layouts
79
+ needs_layout = !%w(.js .json .css .txt).include?(extension)
93
80
 
94
- # If we need a layout and have a layout, use it
95
- if needs_layout && layout_path = fetch_layout(engine, opts)
96
- content = render_individual_file(layout_path, locs, opts, context) { content }
97
- end
81
+ # If we need a layout and have a layout, use it
82
+ if needs_layout && layout_path = fetch_layout(engine, opts)
83
+ content = render_individual_file(layout_path, locs, opts, context) { content }
84
+ end
98
85
 
99
- # Return result
100
- content
101
- ensure
102
- # Pop all the saved variables from earlier as we may be returning to a
103
- # previous render (layouts, partials, nested layouts).
104
- @current_engine = engine_was
105
- @content_blocks = nil
106
- @current_locs = nil
107
- @current_opts = nil
108
- end
86
+ # Return result
87
+ content
88
+ ensure
89
+ # Pop all the saved variables from earlier as we may be returning to a
90
+ # previous render (layouts, partials, nested layouts).
91
+ @current_engine = engine_was
92
+ @content_blocks = nil
93
+ @current_locs = nil
94
+ @current_opts = nil
95
+ end
109
96
 
110
- # Sinatra/Padrino compatible render method signature referenced by some view
111
- # helpers. Especially partials.
112
- #
113
- # @param [String, Symbol] engine
114
- # @param [String, Symbol] data
115
- # @param [Hash] options
116
- # @return [String]
117
- def render(engine, data, options={}, &block)
118
- data = data.to_s
97
+ # Sinatra/Padrino compatible render method signature referenced by some view
98
+ # helpers. Especially partials.
99
+ #
100
+ # @param [String, Symbol] engine
101
+ # @param [String, Symbol] data
102
+ # @param [Hash] options
103
+ # @return [String]
104
+ def render(engine, data, options={}, &block)
105
+ data = data.to_s
119
106
 
120
- locals = options[:locals]
107
+ locals = options[:locals]
121
108
 
122
- found_partial = false
123
- engine = nil
109
+ found_partial = false
110
+ engine = nil
124
111
 
125
- # If the path is known to the sitemap
126
- if resource = sitemap.find_resource_by_path(current_path)
127
- current_dir = File.dirname(resource.source_file)
128
- engine = File.extname(resource.source_file)[1..-1].to_sym
112
+ # If the path is known to the sitemap
113
+ if resource = sitemap.find_resource_by_path(current_path)
114
+ current_dir = File.dirname(resource.source_file)
115
+ engine = File.extname(resource.source_file)[1..-1].to_sym
129
116
 
130
- # Look for partials relative to the current path
131
- if current_dir != self.source_dir
132
- relative_dir = File.join(current_dir.sub("#{self.source_dir}/", ""), data)
117
+ # Look for partials relative to the current path
118
+ if current_dir != self.source_dir
119
+ relative_dir = File.join(current_dir.sub("#{self.source_dir}/", ""), data)
133
120
 
134
- # Try to use the current engine first
135
- found_partial, found_engine = resolve_template(relative_dir, :preferred_engine => engine, :try_without_underscore => true)
121
+ # Try to use the current engine first
122
+ found_partial, found_engine = resolve_template(relative_dir, :preferred_engine => engine, :try_without_underscore => true)
136
123
 
137
- # Fall back to any engine available
138
- if !found_partial
139
- found_partial, found_engine = resolve_template(relative_dir, :try_without_underscore => true)
124
+ # Fall back to any engine available
125
+ if !found_partial
126
+ found_partial, found_engine = resolve_template(relative_dir, :try_without_underscore => true)
127
+ end
128
+ end
140
129
  end
141
- end
142
- end
143
130
 
144
- # Look in the root for the partial with the current engine
145
- if !found_partial && !engine.nil?
146
- found_partial, found_engine = resolve_template(data, :preferred_engine => engine, :try_without_underscore => true)
147
- end
131
+ # Look in the root for the partial with the current engine
132
+ if !found_partial && !engine.nil?
133
+ found_partial, found_engine = resolve_template(data, :preferred_engine => engine, :try_without_underscore => true)
134
+ end
148
135
 
149
- # Look in the root with any engine
150
- if !found_partial
151
- found_partial, found_engine = resolve_template(data, :try_without_underscore => true)
152
- end
136
+ # Look in the root with any engine
137
+ if !found_partial
138
+ found_partial, found_engine = resolve_template(data, :try_without_underscore => true)
139
+ end
153
140
 
154
- # Render the partial if found, otherwide throw exception
155
- if found_partial
156
- render_individual_file(found_partial, locals, options, self, &block)
157
- else
158
- raise ::Middleman::CoreExtensions::Rendering::TemplateNotFound, "Could not locate partial: #{data}"
159
- end
160
- end
141
+ # Render the partial if found, otherwide throw exception
142
+ if found_partial
143
+ render_individual_file(found_partial, locals, options, self, &block)
144
+ else
145
+ raise ::Middleman::CoreExtensions::Rendering::TemplateNotFound, "Could not locate partial: #{data}"
146
+ end
147
+ end
161
148
 
162
- # Render an on-disk file. Used for everything, including layouts.
163
- #
164
- # @param [String, Symbol] path
165
- # @param [Hash] locs
166
- # @param [Hash] opts
167
- # @param [Class] context
168
- # @return [String]
169
- def render_individual_file(path, locs = {}, opts = {}, context = self, &block)
170
- path = path.to_s
149
+ # Render an on-disk file. Used for everything, including layouts.
150
+ #
151
+ # @param [String, Symbol] path
152
+ # @param [Hash] locs
153
+ # @param [Hash] opts
154
+ # @param [Class] context
155
+ # @return [String]
156
+ def render_individual_file(path, locs = {}, opts = {}, context = self, &block)
157
+ path = path.to_s
171
158
 
172
- # Save current buffere for later
173
- @_out_buf, _buf_was = "", @_out_buf
159
+ # Save current buffere for later
160
+ @_out_buf, _buf_was = "", @_out_buf
174
161
 
175
- # Read from disk or cache the contents of the file
176
- body = cache.fetch(:raw_template, path) do
177
- File.read(path)
178
- end
162
+ # Read from disk or cache the contents of the file
163
+ body = if opts[:template_body]
164
+ opts.delete(:template_body)
165
+ else
166
+ template_data_for_file(path)
167
+ end
179
168
 
180
- # Merge per-extension options from config
181
- extension = File.extname(path)
182
- options = opts.merge(options_for_ext(extension))
183
- options[:outvar] ||= '@_out_buf'
169
+ # Merge per-extension options from config
170
+ extension = File.extname(path)
171
+ options = opts.merge(options_for_ext(extension))
172
+ options[:outvar] ||= '@_out_buf'
184
173
 
185
- # Read compiled template from disk or cache
186
- template = cache.fetch(:compiled_template, options, body) do
187
- ::Tilt.new(path, 1, options) { body }
188
- end
174
+ # Read compiled template from disk or cache
175
+ template = cache.fetch(:compiled_template, options, body) do
176
+ ::Tilt.new(path, 1, options) { body }
177
+ end
189
178
 
190
- # Render using Tilt
191
- template.render(context, locs, &block)
192
- ensure
193
- # Reset stored buffer
194
- @_out_buf = _buf_was
195
- end
179
+ # Render using Tilt
180
+ template.render(context, locs, &block)
181
+ ensure
182
+ # Reset stored buffer
183
+ @_out_buf = _buf_was
184
+ end
196
185
 
197
- # Get a hash of configuration options for a given file extension, from
198
- # config.rb
199
- #
200
- # @param [String] ext
201
- # @return [Hash]
202
- def options_for_ext(ext)
203
- # Read options for extension from config/Tilt or cache
204
- cache.fetch(:options_for_ext, ext) do
205
- options = {}
206
-
207
- # Find all the engines which handle this extension in tilt. Look for
208
- # config variables of that name and merge it
209
- extension_class = ::Tilt[ext]
210
- ::Tilt.mappings.each do |ext, engines|
211
- next unless engines.include? extension_class
212
- engine_options = respond_to?(ext.to_sym) ? send(ext.to_sym) : {}
213
- options.merge!(engine_options)
186
+ # Get the template data from a path
187
+ # @param [String] path
188
+ # @return [String]
189
+ def template_data_for_file(path)
190
+ File.read(File.expand_path(path, source_dir))
214
191
  end
192
+
193
+ # Get a hash of configuration options for a given file extension, from
194
+ # config.rb
195
+ #
196
+ # @param [String] ext
197
+ # @return [Hash]
198
+ def options_for_ext(ext)
199
+ # Read options for extension from config/Tilt or cache
200
+ cache.fetch(:options_for_ext, ext) do
201
+ options = {}
215
202
 
216
- options
217
- end
218
- end
203
+ # Find all the engines which handle this extension in tilt. Look for
204
+ # config variables of that name and merge it
205
+ extension_class = ::Tilt[ext]
206
+ ::Tilt.mappings.each do |ext, engines|
207
+ next unless engines.include? extension_class
208
+ engine_options = respond_to?(ext.to_sym) ? send(ext.to_sym) : {}
209
+ options.merge!(engine_options)
210
+ end
211
+
212
+ options
213
+ end
214
+ end
219
215
 
220
- # Find a layout for a given engine
221
- #
222
- # @param [Symbol] engine
223
- # @param [Hash] opts
224
- # @return [String]
225
- def fetch_layout(engine, opts)
226
- # The layout name comes from either the system default or the options
227
- local_layout = opts.has_key?(:layout) ? opts[:layout] : layout
228
- return false unless local_layout
216
+ # Find a layout for a given engine
217
+ #
218
+ # @param [Symbol] engine
219
+ # @param [Hash] opts
220
+ # @return [String]
221
+ def fetch_layout(engine, opts)
222
+ # The layout name comes from either the system default or the options
223
+ local_layout = opts.has_key?(:layout) ? opts[:layout] : layout
224
+ return false unless local_layout
229
225
 
230
- # Look for engine-specific options
231
- engine_options = respond_to?(engine) ? send(engine) : {}
226
+ # Look for engine-specific options
227
+ engine_options = respond_to?(engine) ? send(engine) : {}
232
228
 
233
- # The engine for the layout can be set in options, engine_options or passed
234
- # into this method
235
- layout_engine = if opts.has_key?(:layout_engine)
236
- opts[:layout_engine]
237
- elsif engine_options.has_key?(:layout_engine)
238
- engine_options[:layout_engine]
239
- else
240
- engine
241
- end
229
+ # The engine for the layout can be set in options, engine_options or passed
230
+ # into this method
231
+ layout_engine = if opts.has_key?(:layout_engine)
232
+ opts[:layout_engine]
233
+ elsif engine_options.has_key?(:layout_engine)
234
+ engine_options[:layout_engine]
235
+ else
236
+ engine
237
+ end
242
238
 
243
- # Automatic mode
244
- if local_layout == :_auto_layout
245
- # Look for :layout of any extension
246
- # If found, use it. If not, continue
247
- locate_layout(:layout, layout_engine) || false
248
- else
249
- # Look for specific layout
250
- # If found, use it. If not, error.
251
- if layout_path = locate_layout(local_layout, layout_engine)
252
- layout_path
253
- else
254
- raise ::Middleman::CoreExtensions::Rendering::TemplateNotFound, "Could not locate layout: #{local_layout}"
239
+ # Automatic mode
240
+ if local_layout == :_auto_layout
241
+ # Look for :layout of any extension
242
+ # If found, use it. If not, continue
243
+ locate_layout(:layout, layout_engine) || false
244
+ else
245
+ # Look for specific layout
246
+ # If found, use it. If not, error.
247
+ if layout_path = locate_layout(local_layout, layout_engine)
248
+ layout_path
249
+ else
250
+ raise ::Middleman::CoreExtensions::Rendering::TemplateNotFound, "Could not locate layout: #{local_layout}"
251
+ end
252
+ end
255
253
  end
256
- end
257
- end
258
254
 
259
- # Find a layout on-disk, optionally using a specific engine
260
- # @param [String] name
261
- # @param [Symbol] preferred_engine
262
- # @return [String]
263
- def locate_layout(name, preferred_engine=nil)
264
- # Whether we've found the layout
265
- layout_path = false
255
+ # Find a layout on-disk, optionally using a specific engine
256
+ # @param [String] name
257
+ # @param [Symbol] preferred_engine
258
+ # @return [String]
259
+ def locate_layout(name, preferred_engine=nil)
260
+ # Whether we've found the layout
261
+ layout_path = false
266
262
 
267
- # If we prefer a specific engine
268
- if !preferred_engine.nil?
269
- # Check root
270
- layout_path, layout_engine = resolve_template(name, :preferred_engine => preferred_engine)
263
+ # If we prefer a specific engine
264
+ if !preferred_engine.nil?
265
+ # Check root
266
+ layout_path, layout_engine = resolve_template(name, :preferred_engine => preferred_engine)
271
267
 
272
- # Check layouts folder
273
- if !layout_path
274
- layout_path, layout_engine = resolve_template(File.join("layouts", name.to_s), :preferred_engine => preferred_engine)
275
- end
276
- end
268
+ # Check layouts folder
269
+ if !layout_path
270
+ layout_path, layout_engine = resolve_template(File.join("layouts", name.to_s), :preferred_engine => preferred_engine)
271
+ end
272
+ end
277
273
 
278
- # Check root, no preference
279
- if !layout_path
280
- layout_path, layout_engine = resolve_template(name)
281
- end
274
+ # Check root, no preference
275
+ if !layout_path
276
+ layout_path, layout_engine = resolve_template(name)
277
+ end
282
278
 
283
- # Check layouts folder, no preference
284
- if !layout_path
285
- layout_path, layout_engine = resolve_template(File.join("layouts", name.to_s))
286
- end
279
+ # Check layouts folder, no preference
280
+ if !layout_path
281
+ layout_path, layout_engine = resolve_template(File.join("layouts", name.to_s))
282
+ end
287
283
 
288
- # Return the path
289
- layout_path
290
- end
284
+ # Return the path
285
+ layout_path
286
+ end
291
287
 
292
- # Allow layouts to be wrapped in the contents of other layouts
293
- # @param [String, Symbol] layout_name
294
- # @return [void]
295
- def wrap_layout(layout_name, &block)
296
- content = capture(&block) if block_given?
297
- layout_path = locate_layout(layout_name, current_engine)
298
- concat render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
299
- end
288
+ # Allow layouts to be wrapped in the contents of other layouts
289
+ # @param [String, Symbol] layout_name
290
+ # @return [void]
291
+ def wrap_layout(layout_name, &block)
292
+ content = capture(&block) if block_given?
293
+ layout_path = locate_layout(layout_name, current_engine)
294
+ concat render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
295
+ end
300
296
 
301
- # The currently rendering engine
302
- # @return [Symbol, nil]
303
- def current_engine
304
- @current_engine ||= nil
305
- end
297
+ # The currently rendering engine
298
+ # @return [Symbol, nil]
299
+ def current_engine
300
+ @current_engine ||= nil
301
+ end
306
302
 
307
- # Find a template on disk given a output path
308
- # @param [String] request_path
309
- # @param [Hash] options
310
- # @return [Array<String, Symbol>, Boolean]
311
- def resolve_template(request_path, options={})
312
- # Find the path by searching or using the cache
313
- request_path = request_path.to_s
314
- cache.fetch(:resolve_template, request_path, options) do
315
- relative_path = request_path.sub(%r{^/}, "")
316
- on_disk_path = File.expand_path(relative_path, self.source_dir)
303
+ # Find a template on disk given a output path
304
+ # @param [String] request_path
305
+ # @param [Hash] options
306
+ # @return [Array<String, Symbol>, Boolean]
307
+ def resolve_template(request_path, options={})
308
+ # Find the path by searching or using the cache
309
+ request_path = request_path.to_s
310
+ cache.fetch(:resolve_template, request_path, options) do
311
+ relative_path = request_path.sub(%r{^/}, "")
312
+ on_disk_path = File.expand_path(relative_path, self.source_dir)
317
313
 
318
- # By default, any engine will do
319
- preferred_engine = "*"
314
+ # By default, any engine will do
315
+ preferred_engine = "*"
320
316
 
321
- # Unless we're specifically looking for a preferred engine
322
- if options.has_key?(:preferred_engine)
323
- extension_class = ::Tilt[options[:preferred_engine]]
324
- matched_exts = []
317
+ # Unless we're specifically looking for a preferred engine
318
+ if options.has_key?(:preferred_engine)
319
+ extension_class = ::Tilt[options[:preferred_engine]]
320
+ matched_exts = []
325
321
 
326
- # Get a list of extensions for a preferred engine
327
- # TODO: Cache this
328
- ::Tilt.mappings.each do |ext, engines|
329
- next unless engines.include? extension_class
330
- matched_exts << ext
331
- end
322
+ # Get a list of extensions for a preferred engine
323
+ # TODO: Cache this
324
+ ::Tilt.mappings.each do |ext, engines|
325
+ next unless engines.include? extension_class
326
+ matched_exts << ext
327
+ end
332
328
 
333
- # Change the glob to only look for the matched extensions
334
- if matched_exts.length > 0
335
- preferred_engine = "{" + matched_exts.join(",") + "}"
336
- else
337
- return false
338
- end
339
- end
329
+ # Change the glob to only look for the matched extensions
330
+ if matched_exts.length > 0
331
+ preferred_engine = "{" + matched_exts.join(",") + "}"
332
+ else
333
+ return false
334
+ end
335
+ end
340
336
 
341
- # Look for files that match
342
- path_with_ext = on_disk_path + "." + preferred_engine
337
+ # Look for files that match
338
+ path_with_ext = on_disk_path + "." + preferred_engine
343
339
 
344
- found_path = Dir[path_with_ext].find do |path|
345
- ::Tilt[path]
346
- end
340
+ found_path = Dir[path_with_ext].find do |path|
341
+ ::Tilt[path]
342
+ end
347
343
 
348
- if !found_path && options[:try_without_underscore] &&
349
- path_no_underscore = path_with_ext.
350
- sub(relative_path, relative_path.sub(/^_/, "").
351
- sub(/\/_/, "/"))
352
- found_path = Dir[path_no_underscore].find do |path|
353
- ::Tilt[path]
354
- end
355
- end
344
+ if !found_path && options[:try_without_underscore] &&
345
+ path_no_underscore = path_with_ext.
346
+ sub(relative_path, relative_path.sub(/^_/, "").
347
+ sub(/\/_/, "/"))
348
+ found_path = Dir[path_no_underscore].find do |path|
349
+ ::Tilt[path]
350
+ end
351
+ end
356
352
 
357
- # If we found one, return it and the found engine
358
- if found_path || (File.exists?(on_disk_path) && !File.directory?(on_disk_path))
359
- engine = found_path ? File.extname(found_path)[1..-1].to_sym : nil
360
- [ found_path || on_disk_path, engine ]
361
- else
362
- false
353
+ # If we found one, return it and the found engine
354
+ if found_path || (File.exists?(on_disk_path) && !File.directory?(on_disk_path))
355
+ engine = found_path ? File.extname(found_path)[1..-1].to_sym : nil
356
+ [ found_path || on_disk_path, engine ]
357
+ else
358
+ false
359
+ end
360
+ end
363
361
  end
364
362
  end
365
363
  end
366
364
  end
367
- end
365
+ end