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
@@ -1,104 +0,0 @@
1
- zh_cn:
2
- number:
3
- # Used in number_with_delimiter()
4
- # These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
5
- format:
6
- # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
7
- separator: "."
8
- # Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
9
- delimiter: ","
10
- # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
11
- precision: 3
12
-
13
- # Used in number_to_currency()
14
- currency:
15
- format:
16
- # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
17
- format: "%u %n"
18
- unit: "元"
19
- # These three are to override number.format and are optional
20
- separator: "."
21
- delimiter: ","
22
- precision: 2
23
-
24
- # Used in number_to_percentage()
25
- percentage:
26
- format:
27
- # These three are to override number.format and are optional
28
- # separator:
29
- delimiter: ""
30
- # precision:
31
-
32
- # Used in number_to_precision()
33
- precision:
34
- format:
35
- # These three are to override number.format and are optional
36
- # separator:
37
- delimiter: ""
38
- # precision:
39
-
40
- # Used in number_to_human_size()
41
- human:
42
- format:
43
- # These three are to override number.format and are optional
44
- # separator:
45
- delimiter: ""
46
- precision: 1
47
- storage_units:
48
- # Storage units output formatting.
49
- # %u is the storage unit, %n is the number (default: 2 MB)
50
- format: "%n %u"
51
- units:
52
- byte:
53
- one: "Byte"
54
- other: "Bytes"
55
- kb: "KB"
56
- mb: "MB"
57
- gb: "GB"
58
- tb: "TB"
59
-
60
- # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
61
- datetime:
62
- distance_in_words:
63
- half_a_minute: "半分钟"
64
- less_than_x_seconds:
65
- one: "不到一秒"
66
- other: "不到 %{count} 秒"
67
- x_seconds:
68
- one: "一秒"
69
- other: "%{count} 秒"
70
- less_than_x_minutes:
71
- one: "不到一分钟"
72
- other: "不到 %{count} 分钟"
73
- x_minutes:
74
- one: "一分钟"
75
- other: "%{count} 分钟"
76
- about_x_hours:
77
- one: "大约一小时"
78
- other: "大约 %{count} 小时"
79
- x_days:
80
- one: "一天"
81
- other: "%{count} 天"
82
- about_x_months:
83
- one: "大约一个月"
84
- other: "大约 %{count} 个月"
85
- x_months:
86
- one: "一个月"
87
- other: "%{count} 个月"
88
- about_x_years:
89
- one: "大约一年"
90
- other: "大约 %{count} 年"
91
- over_x_years:
92
- one: "一年多"
93
- other: "%{count} 年多"
94
- almost_x_years:
95
- one: "接近一年"
96
- other: "接近 %{count} 年"
97
- models:
98
- errors:
99
- template:
100
- header:
101
- one: "有1 个错误发生使得「%{model}」无法被储存。 "
102
- other: "有%{count} 个错误发生使得「%{model}」无法被储存。 "
103
- body: "以下栏位发生问题:"
104
-
@@ -1,103 +0,0 @@
1
- zh_tw:
2
- number:
3
- # Used in number_with_delimiter()
4
- # These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
5
- format:
6
- # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
7
- separator: "."
8
- # Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
9
- delimiter: ","
10
- # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
11
- precision: 3
12
-
13
- # Used in number_to_currency()
14
- currency:
15
- format:
16
- # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
17
- format: "%u %n"
18
- unit: "NT$"
19
- # These three are to override number.format and are optional
20
- separator: "."
21
- delimiter: ","
22
- precision: 2
23
-
24
- # Used in number_to_percentage()
25
- percentage:
26
- format:
27
- # These three are to override number.format and are optional
28
- # separator:
29
- delimiter: ""
30
- # precision:
31
-
32
- # Used in number_to_precision()
33
- precision:
34
- format:
35
- # These three are to override number.format and are optional
36
- # separator:
37
- delimiter: ""
38
- # precision:
39
-
40
- # Used in number_to_human_size()
41
- human:
42
- format:
43
- # These three are to override number.format and are optional
44
- # separator:
45
- delimiter: ""
46
- precision: 1
47
- storage_units:
48
- # Storage units output formatting.
49
- # %u is the storage unit, %n is the number (default: 2 MB)
50
- format: "%n %u"
51
- units:
52
- byte:
53
- one: "Byte"
54
- other: "Bytes"
55
- kb: "KB"
56
- mb: "MB"
57
- gb: "GB"
58
- tb: "TB"
59
-
60
- # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
61
- datetime:
62
- distance_in_words:
63
- half_a_minute: "半分鐘"
64
- less_than_x_seconds:
65
- one: "不到一秒"
66
- other: "不到 %{count} 秒"
67
- x_seconds:
68
- one: "一秒"
69
- other: "%{count} 秒"
70
- less_than_x_minutes:
71
- one: "不到一分鐘"
72
- other: "不到 %{count} 分鐘"
73
- x_minutes:
74
- one: "一分鐘"
75
- other: "%{count} 分鐘"
76
- about_x_hours:
77
- one: "大約一小時"
78
- other: "大約 %{count} 小時"
79
- x_days:
80
- one: "一天"
81
- other: "%{count} 天"
82
- about_x_months:
83
- one: "大約一個月"
84
- other: "大約 %{count} 個月"
85
- x_months:
86
- one: "一個月"
87
- other: "%{count} 個月"
88
- about_x_years:
89
- one: "大約一年"
90
- other: "大約 %{count} 年"
91
- over_x_years:
92
- one: "一年多"
93
- other: "%{count} 年多"
94
- almost_x_years:
95
- one: "接近一年"
96
- other: "接近 %{count} 年"
97
- models:
98
- errors:
99
- template:
100
- header:
101
- one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
102
- other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
103
- body: "以下欄位發生問題:"
@@ -1,288 +0,0 @@
1
- module Padrino
2
- module Helpers
3
- ##
4
- # Provides methods for converting numbers into formatted strings.
5
- # Methods are provided for phone numbers, currency, percentage,
6
- # precision, positional notation, and file size.
7
- #
8
- # Adapted from Rails Number Helpers.
9
- #
10
- module NumberHelpers
11
- ##
12
- # Formats a +number+ into a currency string (e.g., $13.65). You can customize the format
13
- # in the +options+ hash.
14
- #
15
- # @param [Float] number
16
- # Currency value to format.
17
- # @param [Hash] options
18
- # Options for currency conversion.
19
- # @option options [Fixnum] :precision (2)
20
- # Sets the level of precision.
21
- # @option options [String] :unit ("$")
22
- # Sets the denomination of the currency.
23
- # @option options [String] :separator (".")
24
- # Sets the separator between the units.
25
- # @option options [String] :delimiter (",")
26
- # Sets the thousands delimiter.
27
- # @option options [String] :format ("%u%n")
28
- # Sets the format of the output string. The field types are:
29
- # %u The currency unit
30
- # %n The number
31
- #
32
- # @return [String] The formatted representation of the currency
33
- #
34
- # @example
35
- # number_to_currency(1234567890.50) # => $1,234,567,890.50
36
- # number_to_currency(1234567890.506) # => $1,234,567,890.51
37
- # number_to_currency(1234567890.506, :precision => 3) # => $1,234,567,890.506
38
- # number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "")
39
- # # => £1234567890,50
40
- # number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "", :format => "%n %u")
41
- # # => 1234567890,50 £
42
- #
43
- # @api public
44
- def number_to_currency(number, options = {})
45
- options.symbolize_keys!
46
-
47
- defaults = I18n.translate(:'number.format', :locale => options[:locale], :raise => true) rescue {}
48
- currency = I18n.translate(:'number.currency.format', :locale => options[:locale], :raise => true) rescue {}
49
- defaults = defaults.merge(currency)
50
-
51
- precision = options[:precision] || defaults[:precision]
52
- unit = options[:unit] || defaults[:unit]
53
- separator = options[:separator] || defaults[:separator]
54
- delimiter = options[:delimiter] || defaults[:delimiter]
55
- format = options[:format] || defaults[:format]
56
- separator = '' if precision == 0
57
-
58
- begin
59
- format.gsub(/%n/, number_with_precision(number,
60
- :precision => precision,
61
- :delimiter => delimiter,
62
- :separator => separator)
63
- ).gsub(/%u/, unit)
64
- rescue
65
- number
66
- end
67
- end
68
-
69
- ##
70
- # Formats a +number+ as a percentage string (e.g., 65%). You can customize the
71
- # format in the +options+ hash.
72
- #
73
- # @param [Fixnum, Float] number
74
- # Percentage value to format.
75
- # @param [Hash] options
76
- # Options for percentage conversion.
77
- # @option options [Fixnum] :precision (3)
78
- # Sets the level of precision.
79
- # @option options [String] :separator (".")
80
- # Sets the separator between the units.
81
- # @option options [String] :delimiter ("")
82
- # Sets the thousands delimiter
83
- #
84
- # @return [String] The formatted representation of the percentage
85
- #
86
- # @example
87
- # number_to_percentage(100) # => 100.000%
88
- # number_to_percentage(100, :precision => 0) # => 100%
89
- # number_to_percentage(1000, :delimiter => '.', :separator => ',') # => 1.000,000%
90
- # number_to_percentage(302.24398923423, :precision => 5) # => 302.24399%
91
- #
92
- # @api public
93
- def number_to_percentage(number, options = {})
94
- options.symbolize_keys!
95
-
96
- defaults = I18n.translate(:'number.format', :locale => options[:locale], :raise => true) rescue {}
97
- percentage = I18n.translate(:'number.percentage.format', :locale => options[:locale], :raise => true) rescue {}
98
- defaults = defaults.merge(percentage)
99
-
100
- precision = options[:precision] || defaults[:precision]
101
- separator = options[:separator] || defaults[:separator]
102
- delimiter = options[:delimiter] || defaults[:delimiter]
103
-
104
- begin
105
- number_with_precision(number,
106
- :precision => precision,
107
- :separator => separator,
108
- :delimiter => delimiter) + "%"
109
- rescue
110
- number
111
- end
112
- end
113
-
114
- ##
115
- # Formats a +number+ with grouped thousands using +delimiter+ (e.g., 12,324). You can
116
- # customize the format in the +options+ hash.
117
- #
118
- # @overload number_with_delimiter(number, options={})
119
- # @param [Fixnum, Float] number
120
- # Number value to format.
121
- # @param [Hash] options
122
- # Options for formatter.
123
- # @option options [String] :delimiter (", ")
124
- # Sets the thousands delimiter
125
- # @option options [String] :separator (".")
126
- # Sets the separator between the units.
127
- #
128
- # @return [String] The formatted representation of the number
129
- #
130
- # @example
131
- # number_with_delimiter(12345678) # => 12,345,678
132
- # number_with_delimiter(12345678.05) # => 12,345,678.05
133
- # number_with_delimiter(12345678, :delimiter => ".") # => 12.345.678
134
- # number_with_delimiter(12345678, :separator => ",") # => 12,345,678
135
- # number_with_delimiter(98765432.98, :delimiter => " ", :separator => ",")
136
- # # => 98 765 432,98
137
- #
138
- # @api public
139
- def number_with_delimiter(number, *args)
140
- options = args.extract_options!
141
- options.symbolize_keys!
142
-
143
- defaults = I18n.translate(:'number.format', :locale => options[:locale], :raise => true) rescue {}
144
-
145
- delimiter ||= (options[:delimiter] || defaults[:delimiter])
146
- separator ||= (options[:separator] || defaults[:separator])
147
-
148
- begin
149
- parts = number.to_s.split('.')
150
- parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
151
- parts.join(separator)
152
- rescue
153
- number
154
- end
155
- end
156
-
157
- ##
158
- # Formats a +number+ with the specified level of <tt>:precision</tt> (e.g., 112.32 has a precision of 2).
159
- # You can customize the format in the +options+ hash.
160
- #
161
- # @overload number_with_precision(number, options={})
162
- # @param [Fixnum, Float] number
163
- # Number value to format.
164
- # @param [Hash] options
165
- # Options for formatter.
166
- # @option options [Fixnum] :precision (3)
167
- # Sets the level of precision.
168
- # @option options [String] :separator (".")
169
- # Sets the separator between the units.
170
- # @option options [String] :delimiter ("")
171
- # Sets the thousands delimiter
172
- #
173
- # @return [String] The formatted representation of the number
174
- #
175
- # @example
176
- # number_with_precision(111.2345) # => 111.235
177
- # number_with_precision(111.2345, :precision => 2) # => 111.23
178
- # number_with_precision(13, :precision => 5) # => 13.00000
179
- # number_with_precision(389.32314, :precision => 0) # => 389
180
- # number_with_precision(1111.2345, :precision => 2, :separator => ',', :delimiter => '.')
181
- # # => 1.111,23
182
- #
183
- # @api public
184
- def number_with_precision(number, *args)
185
- options = args.extract_options!
186
- options.symbolize_keys!
187
-
188
- defaults = I18n.translate(:'number.format', :locale => options[:locale], :raise => true) rescue {}
189
- precision_defaults = I18n.translate(:'number.precision.format', :locale => options[:locale],
190
- :raise => true) rescue {}
191
- defaults = defaults.merge(precision_defaults)
192
-
193
- precision ||= (options[:precision] || defaults[:precision])
194
- separator ||= (options[:separator] || defaults[:separator])
195
- delimiter ||= (options[:delimiter] || defaults[:delimiter])
196
-
197
- begin
198
- rounded_number = (Float(number) * (10 ** precision)).round.to_f / 10 ** precision
199
- number_with_delimiter("%01.#{precision}f" % rounded_number,
200
- :separator => separator,
201
- :delimiter => delimiter)
202
- rescue
203
- number
204
- end
205
- end
206
-
207
- # The units available for storage formatting.
208
- STORAGE_UNITS = [:byte, :kb, :mb, :gb, :tb].freeze
209
-
210
- ##
211
- # Formats the bytes in +size+ into a more understandable representation
212
- # (e.g., giving it 1500 yields 1.5 KB). This method is useful for
213
- # reporting file sizes to users. This method returns nil if
214
- # +size+ cannot be converted into a number. You can customize the
215
- # format in the +options+ hash.
216
- #
217
- #
218
- # @overload number_to_human_size(number, options={})
219
- # @param [Fixnum] number
220
- # Number value to format.
221
- # @param [Hash] options
222
- # Options for formatter.
223
- # @option options [Fixnum] :precision (1)
224
- # Sets the level of precision.
225
- # @option options [String] :separator (".")
226
- # Sets the separator between the units.
227
- # @option options [String] :delimiter ("")
228
- # Sets the thousands delimiter
229
- #
230
- # @return [String] The formatted representation of bytes
231
- #
232
- # @example
233
- # number_to_human_size(123) # => 123 Bytes
234
- # number_to_human_size(1234) # => 1.2 KB
235
- # number_to_human_size(12345) # => 12.1 KB
236
- # number_to_human_size(1234567) # => 1.2 MB
237
- # number_to_human_size(1234567890) # => 1.1 GB
238
- # number_to_human_size(1234567890123) # => 1.1 TB
239
- # number_to_human_size(1234567, :precision => 2) # => 1.18 MB
240
- # number_to_human_size(483989, :precision => 0) # => 473 KB
241
- # number_to_human_size(1234567, :precision => 2, :separator => ',') # => 1,18 MB
242
- #
243
- # @api public
244
- def number_to_human_size(number, *args)
245
- return nil if number.nil?
246
-
247
- options = args.extract_options!
248
- options.symbolize_keys!
249
-
250
- defaults = I18n.translate(:'number.format', :locale => options[:locale], :raise => true) rescue {}
251
- human = I18n.translate(:'number.human.format', :locale => options[:locale], :raise => true) rescue {}
252
- defaults = defaults.merge(human)
253
-
254
- precision ||= (options[:precision] || defaults[:precision])
255
- separator ||= (options[:separator] || defaults[:separator])
256
- delimiter ||= (options[:delimiter] || defaults[:delimiter])
257
-
258
- storage_units_format = I18n.translate(:'number.human.storage_units.format', :locale => options[:locale], :raise => true)
259
-
260
- if number.to_i < 1024
261
- unit = I18n.translate(:'number.human.storage_units.units.byte', :locale => options[:locale], :count => number.to_i, :raise => true)
262
- storage_units_format.gsub(/%n/, number.to_i.to_s).gsub(/%u/, unit)
263
- else
264
- max_exp = STORAGE_UNITS.size - 1
265
- number = Float(number)
266
- exponent = (Math.log(number) / Math.log(1024)).to_i # Convert to base 1024
267
- exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit
268
- number /= 1024 ** exponent
269
-
270
- unit_key = STORAGE_UNITS[exponent]
271
- unit = I18n.translate(:"number.human.storage_units.units.#{unit_key}", :locale => options[:locale], :count => number, :raise => true)
272
-
273
- begin
274
- escaped_separator = Regexp.escape(separator)
275
- formatted_number = number_with_precision(number,
276
- :precision => precision,
277
- :separator => separator,
278
- :delimiter => delimiter
279
- ).sub(/(#{escaped_separator})(\d*[1-9])?0+\z/, '\1\2').sub(/#{escaped_separator}\z/, '')
280
- storage_units_format.gsub(/%n/, formatted_number).gsub(/%u/, unit)
281
- rescue
282
- number
283
- end
284
- end
285
- end
286
- end # NumberHelpers
287
- end # Helpers
288
- end # Padrino
@@ -1,98 +0,0 @@
1
- module Padrino
2
- module Helpers
3
- module OutputHelpers
4
- ##
5
- # Returns the list of all available template handlers
6
- #
7
- # @example
8
- # OutputHelpers.handlers => [<OutputHelpers::HamlHandler>, <OutputHelpers::ErbHandler>]
9
- #
10
- # @private
11
- def self.handlers
12
- @_template_handlers ||= []
13
- end
14
-
15
- ##
16
- # Registers a new handler as available to the output helpers
17
- #
18
- # @example
19
- # OutputHelpers.register(OutputHelpers::HamlHandler)
20
- #
21
- # @private
22
- def self.register(handler)
23
- handlers << handler
24
- end
25
-
26
- # @abstract Extend this to create a template handler
27
- class AbstractHandler
28
- attr_reader :template
29
-
30
- def initialize(template)
31
- @template = template
32
- end
33
-
34
- ##
35
- # Returns extension of the template
36
- #
37
- # @example
38
- # @handler.template_extension => "erb"
39
- #
40
- def template_extension
41
- caller.find { |c| c =~ /\/views\// }[/\.([\w]*?)\:/, 1] rescue nil
42
- # "/some/path/app/views/posts/foo.html.erb:3:in `evaluate_source'"
43
- # => "erb"
44
- end
45
-
46
- ##
47
- # Returns an array of engines used for the template
48
- #
49
- # @example
50
- # @handler.engines => [:erb, :erubis]
51
- #
52
- def engines
53
- # Implemented in subclass
54
- end
55
-
56
- ##
57
- # Returns true if the current template type is same as this handlers; false otherwise.
58
- #
59
- # @example
60
- # @handler.is_type? => true
61
- #
62
- def is_type?
63
- # Implemented in subclass
64
- end
65
-
66
- ##
67
- # Returns true if the block given is of the handler's template type; false otherwise.
68
- #
69
- # @example
70
- # @handler.block_is_type?(block) => true
71
- #
72
- def block_is_type?(block)
73
- # Implemented in subclass
74
- end
75
-
76
- ##
77
- # Captures the html from a block of template code for this handler
78
- #
79
- # @example
80
- # @handler.capture_from_template(&block) => "...html..."
81
- #
82
- def capture_from_template(*args, &block)
83
- # Implemented in subclass
84
- end
85
-
86
- ##
87
- # Outputs the given text to the templates buffer directly
88
- #
89
- # @example
90
- # @handler.concat_to_template("This will be output to the template buffer")
91
- #
92
- def concat_to_template(text="")
93
- # Implemented in subclass
94
- end
95
- end # AbstractHandler
96
- end # OutputHelpers
97
- end # Helpers
98
- end # Padrino
@@ -1,79 +0,0 @@
1
- module Padrino
2
- module Helpers
3
- module OutputHelpers
4
- ##
5
- # Handler for reading and writing from an erb template.
6
- #
7
- class ErbHandler < AbstractHandler
8
- attr_reader :output_buffer
9
-
10
- def initialize(template)
11
- super
12
- @output_buffer = template.instance_variable_get(:@_out_buf)
13
- end
14
-
15
- ##
16
- # Returns true if the current template type is same as this handlers; false otherwise.
17
- #
18
- # @example
19
- # @handler.is_type? => true
20
- #
21
- def is_type?
22
- !self.output_buffer.nil?
23
- end
24
-
25
- # Captures the html from a block of template code for this handler
26
- #
27
- # @example
28
- # @handler.capture_from_template(&block) => "...html..."
29
- #
30
- def capture_from_template(*args, &block)
31
- self.output_buffer, _buf_was = "", self.output_buffer
32
- block.call(*args)
33
- ret = eval("@_out_buf", block.binding)
34
- self.output_buffer = _buf_was
35
- ret
36
- end
37
-
38
- ##
39
- # Outputs the given text to the templates buffer directly
40
- #
41
- # @example
42
- # @handler.concat_to_template("This will be output to the template buffer")
43
- #
44
- def concat_to_template(text="")
45
- self.output_buffer << text if is_type? && text
46
- nil
47
- end
48
-
49
- ##
50
- # Returns true if the block given is of the handler's template type; false otherwise.
51
- #
52
- # @example
53
- # @handler.block_is_type?(block) => true
54
- #
55
- def block_is_type?(block)
56
- is_type? || (block && eval('defined?(__in_erb_template)', block.binding))
57
- end
58
-
59
- ##
60
- # Returns an array of engines used for the template
61
- #
62
- # @example
63
- # @handler.engines => [:erb, :erubis]
64
- #
65
- def engines
66
- @_engines ||= [:erb, :erubis]
67
- end
68
-
69
- protected
70
-
71
- def output_buffer=(val)
72
- template.instance_variable_set(:@_out_buf, val)
73
- end
74
- end # ErbHandler
75
-
76
- OutputHelpers.register(ErbHandler)
77
- end # OutputHelpers
78
- end # Helpers
79
- end # Padrino