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.
- data/features/cli_extension.feature +13 -0
- data/features/{cli.feature → cli_init.feature} +1 -10
- data/features/directory_index.feature +29 -1
- data/features/dynamic_pages.feature +1 -0
- data/features/extensionless_text_files.feature +0 -2
- data/features/front-matter.feature +17 -1
- data/features/frontmatter_page_settings.feature +16 -1
- data/features/helpers_relative_link_to.feature +68 -0
- data/features/unicode_filenames.feature +14 -0
- data/fixtures/csspie/config.rb +0 -0
- data/fixtures/csspie/source/stylesheets/PIE.htc +96 -0
- data/fixtures/dynamic-pages-app/config.rb +3 -0
- data/fixtures/frontmatter-app/source/front-matter-auto.erb +6 -0
- data/fixtures/frontmatter-app/source/front-matter.html.erb +2 -0
- data/fixtures/frontmatter-app/source/json-front-matter-2.php.erb +7 -0
- data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +6 -0
- data/fixtures/frontmatter-app/source/json-front-matter.html.erb +6 -0
- data/fixtures/unicode-filenames-app/config.rb +1 -0
- data/fixtures/unicode-filenames-app/source/snowmen-rule-/342/230/203.html +4 -0
- data/lib/middleman-core/application.rb +43 -335
- data/lib/middleman-core/cli/build.rb +11 -4
- data/lib/middleman-core/cli/bundler.rb +40 -0
- data/lib/middleman-core/cli/extension.rb +36 -0
- data/lib/middleman-core/cli/server.rb +2 -2
- data/lib/middleman-core/cli.rb +2 -6
- data/lib/middleman-core/core_extensions/assets.rb +35 -31
- data/lib/middleman-core/core_extensions/builder.rb +14 -9
- data/lib/middleman-core/core_extensions/data.rb +150 -145
- data/lib/middleman-core/core_extensions/default_helpers.rb +159 -97
- data/lib/middleman-core/core_extensions/extensions.rb +103 -97
- data/lib/middleman-core/core_extensions/external_helpers.rb +27 -23
- data/lib/middleman-core/core_extensions/file_watcher.rb +140 -110
- data/lib/middleman-core/core_extensions/front_matter.rb +155 -175
- data/lib/middleman-core/core_extensions/i18n.rb +111 -102
- data/lib/middleman-core/core_extensions/rendering.rb +293 -295
- data/lib/middleman-core/core_extensions/request.rb +338 -0
- data/lib/middleman-core/core_extensions/routing.rb +72 -68
- data/lib/middleman-core/core_extensions/show_exceptions.rb +23 -18
- data/lib/middleman-core/core_extensions.rb +39 -0
- data/lib/middleman-core/extensions/directory_indexes.rb +1 -4
- data/lib/middleman-core/extensions/lorem.rb +10 -3
- data/lib/middleman-core/extensions.rb +2 -64
- data/lib/middleman-core/preview_server.rb +157 -0
- data/lib/middleman-core/sitemap/extensions/ignores.rb +73 -68
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +65 -58
- data/lib/middleman-core/sitemap/extensions/proxies.rb +86 -75
- data/lib/middleman-core/sitemap/extensions/traversal.rb +68 -61
- data/lib/middleman-core/sitemap/resource.rb +123 -102
- data/lib/middleman-core/sitemap/store.rb +170 -149
- data/lib/middleman-core/sitemap.rb +57 -57
- data/lib/middleman-core/step_definitions/server_steps.rb +13 -3
- data/lib/middleman-core/templates/extension/Gemfile +4 -0
- data/lib/middleman-core/templates/extension/Rakefile +12 -0
- data/lib/middleman-core/templates/extension/features/support/env.rb +4 -0
- data/lib/middleman-core/templates/extension/gemspec +24 -0
- data/lib/middleman-core/templates/extension/lib/lib.rb +49 -0
- data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -0
- data/lib/middleman-core/templates/shared/gitignore +14 -0
- data/lib/middleman-core/templates.rb +14 -8
- data/lib/middleman-core/util.rb +31 -9
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-core.rb +6 -4
- data/middleman-core.gemspec +4 -6
- metadata +62 -203
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.document +0 -5
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.gitignore +0 -22
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.yardopts +0 -1
- data/lib/middleman-core/vendor/padrino-core-0.10.6/LICENSE.txt +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/README.rdoc +0 -294
- data/lib/middleman-core/vendor/padrino-core-0.10.6/Rakefile +0 -5
- data/lib/middleman-core/vendor/padrino-core-0.10.6/bin/padrino +0 -9
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/rendering.rb +0 -292
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/routing.rb +0 -943
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/showexceptions.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application.rb +0 -269
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/caller.rb +0 -53
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/adapter.rb +0 -24
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/base.rb +0 -150
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/console.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake.rb +0 -24
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake_tasks.rb +0 -59
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/command.rb +0 -38
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/404.png +0 -0
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/500.png +0 -0
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/loader.rb +0 -211
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/cs.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/da.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/de.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/en.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/es.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/fr.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/hu.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/it.yml +0 -40
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ja.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/lv.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/nl.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/no.yml +0 -35
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pl.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pt_br.yml +0 -40
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ru.yml +0 -35
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/tr.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/uk.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_cn.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_tw.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/logger.rb +0 -428
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/mounter.rb +0 -224
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/reloader.rb +0 -254
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/router.rb +0 -98
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/server.rb +0 -79
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/support_lite.rb +0 -199
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/tasks.rb +0 -21
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/version.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core.rb +0 -152
- data/lib/middleman-core/vendor/padrino-core-0.10.6/padrino-core.gemspec +0 -38
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.components +0 -6
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.gitignore +0 -7
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/complex.rb +0 -32
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/simple.rb +0 -33
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/a.rb +0 -9
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/b.rb +0 -4
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/c.rb +0 -1
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/e.rb +0 -13
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/f.rb +0 -2
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/g.rb +0 -2
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/d.rb +0 -4
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/helper.rb +0 -83
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/mini_shoulda.rb +0 -45
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_application.rb +0 -108
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_core.rb +0 -77
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_dependencies.rb +0 -44
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_filters.rb +0 -278
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_locale.rb +0 -21
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_logger.rb +0 -154
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_mounter.rb +0 -177
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_complex.rb +0 -75
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_simple.rb +0 -98
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_rendering.rb +0 -461
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_restful_routing.rb +0 -33
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_router.rb +0 -146
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_routing.rb +0 -1680
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.document +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.gitignore +0 -21
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.yardopts +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/LICENSE.txt +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/README.rdoc +0 -239
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/Rakefile +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/asset_tag_helpers.rb +0 -417
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -251
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -43
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_helpers.rb +0 -787
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/format_helpers.rb +0 -381
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/cs.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/da.yml +0 -91
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/de.yml +0 -81
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/en.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/es.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/fr.yml +0 -80
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/hu.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/it.yml +0 -89
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ja.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/lv.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/nl.yml +0 -82
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/no.yml +0 -91
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pl.yml +0 -95
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pt_br.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ru.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/tr.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/uk.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_cn.yml +0 -104
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_tw.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/number_helpers.rb +0 -288
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -98
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -79
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -81
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers.rb +0 -175
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/render_helpers.rb +0 -60
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/tag_helpers.rb +0 -260
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/translation_helpers.rb +0 -38
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers.rb +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/padrino-helpers.gemspec +0 -27
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/app.rb +0 -73
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.erb +0 -14
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.haml +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.slim +0 -13
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.erb +0 -14
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb +0 -11
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml +0 -9
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim +0 -9
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml +0 -15
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim +0 -15
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb +0 -72
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb +0 -86
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml +0 -70
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim +0 -70
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml +0 -4
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim +0 -4
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb +0 -50
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml +0 -7
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml +0 -2
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb +0 -66
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb +0 -328
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb +0 -1106
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb +0 -770
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb +0 -227
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb +0 -139
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb +0 -153
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb +0 -76
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb +0 -106
- 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
|
12
|
+
module Middleman
|
13
|
+
module CoreExtensions
|
14
|
+
module Rendering
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
# Setup extension
|
17
|
+
class << self
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
# Once registered
|
20
|
+
def registered(app)
|
21
|
+
# Include methods
|
22
|
+
app.send :include, InstanceMethods
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
# Activate custom renderers
|
25
|
+
app.register Middleman::Renderers::ERb
|
26
|
+
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
# Custom error class for handling
|
30
|
-
class TemplateNotFound < RuntimeError
|
31
|
-
end
|
28
|
+
alias :included :registered
|
29
|
+
end
|
32
30
|
|
33
|
-
|
34
|
-
|
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
|
-
|
52
|
-
|
34
|
+
|
35
|
+
# Rendering instance methods
|
36
|
+
module InstanceMethods
|
53
37
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
-
|
74
|
-
|
59
|
+
# Store last engine for later (could be inside nested renders)
|
60
|
+
@current_engine, engine_was = engine, @current_engine
|
75
61
|
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
|
81
|
-
|
66
|
+
# Store current locs/opts for later
|
67
|
+
@current_locs = locs, @current_opts = opts
|
82
68
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|
-
|
92
|
-
|
78
|
+
# Certain output file types don't use layouts
|
79
|
+
needs_layout = !%w(.js .json .css .txt).include?(extension)
|
93
80
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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
|
-
|
107
|
+
locals = options[:locals]
|
121
108
|
|
122
|
-
|
123
|
-
|
109
|
+
found_partial = false
|
110
|
+
engine = nil
|
124
111
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
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
|
-
|
131
|
-
|
132
|
-
|
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
|
-
|
135
|
-
|
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
|
-
|
138
|
-
|
139
|
-
|
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
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
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
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
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
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
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
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
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
|
-
|
173
|
-
|
159
|
+
# Save current buffere for later
|
160
|
+
@_out_buf, _buf_was = "", @_out_buf
|
174
161
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
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
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
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
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
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
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
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
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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
|
-
|
217
|
-
|
218
|
-
|
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
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
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
|
-
|
231
|
-
|
226
|
+
# Look for engine-specific options
|
227
|
+
engine_options = respond_to?(engine) ? send(engine) : {}
|
232
228
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
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
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
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
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
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
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
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
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
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
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
274
|
+
# Check root, no preference
|
275
|
+
if !layout_path
|
276
|
+
layout_path, layout_engine = resolve_template(name)
|
277
|
+
end
|
282
278
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
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
|
-
|
289
|
-
|
290
|
-
|
284
|
+
# Return the path
|
285
|
+
layout_path
|
286
|
+
end
|
291
287
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
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
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
297
|
+
# The currently rendering engine
|
298
|
+
# @return [Symbol, nil]
|
299
|
+
def current_engine
|
300
|
+
@current_engine ||= nil
|
301
|
+
end
|
306
302
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
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
|
-
|
319
|
-
|
314
|
+
# By default, any engine will do
|
315
|
+
preferred_engine = "*"
|
320
316
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
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
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
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
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
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
|
-
|
342
|
-
|
337
|
+
# Look for files that match
|
338
|
+
path_with_ext = on_disk_path + "." + preferred_engine
|
343
339
|
|
344
|
-
|
345
|
-
|
346
|
-
|
340
|
+
found_path = Dir[path_with_ext].find do |path|
|
341
|
+
::Tilt[path]
|
342
|
+
end
|
347
343
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
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
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
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
|