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
@@ -1,214 +1,194 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
# Looking up Tilt extensions
|
5
|
-
require "tilt"
|
6
|
-
|
7
|
-
# Frontmatter namespace
|
8
|
-
module Middleman::CoreExtensions::FrontMatter
|
1
|
+
# Extensions namespace
|
2
|
+
module Middleman::CoreExtensions
|
9
3
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
# Once registered
|
14
|
-
def registered(app)
|
15
|
-
app.set :frontmatter_extensions, %w(.htm .html .php)
|
16
|
-
app.extend ClassMethods
|
17
|
-
app.send :include, InstanceMethods
|
18
|
-
app.delegate :frontmatter_changed, :to => :"self.class"
|
19
|
-
|
20
|
-
::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods
|
21
|
-
end
|
22
|
-
alias :included :registered
|
23
|
-
end
|
4
|
+
# Frontmatter namespace
|
5
|
+
module FrontMatter
|
24
6
|
|
25
|
-
|
26
|
-
|
7
|
+
# Setup extension
|
8
|
+
class << self
|
27
9
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
10
|
+
# Once registered
|
11
|
+
def registered(app)
|
12
|
+
# Parsing YAML frontmatter
|
13
|
+
require "yaml"
|
14
|
+
|
15
|
+
# Parsing JSON frontmatter
|
16
|
+
require "active_support/json"
|
17
|
+
|
18
|
+
app.send :include, InstanceMethods
|
19
|
+
|
20
|
+
app.before_configuration do
|
21
|
+
files.changed { |file| frontmatter_manager.clear_data(file) }
|
22
|
+
files.deleted { |file| frontmatter_manager.clear_data(file) }
|
23
|
+
end
|
24
|
+
|
25
|
+
app.after_configuration do
|
26
|
+
::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods
|
39
27
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
28
|
+
sitemap.register_resource_list_manipulator(
|
29
|
+
:frontmatter,
|
30
|
+
frontmatter_manager
|
31
|
+
)
|
32
|
+
|
33
|
+
sitemap.provides_metadata do |path|
|
34
|
+
fmdata = frontmatter_manager.data(path).first
|
35
|
+
|
36
|
+
data = {}
|
37
|
+
%w(layout layout_engine).each do |opt|
|
38
|
+
data[opt.to_sym] = fmdata[opt] if fmdata[opt]
|
39
|
+
end
|
40
|
+
|
41
|
+
{ :options => data, :page => fmdata }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
alias :included :registered
|
44
46
|
end
|
45
|
-
|
46
|
-
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
exts = frontmatter_extensions.join("|").gsub(".", "\.")
|
54
|
-
|
55
|
-
static_path = source_dir.sub(root, "").sub(/^\//, "").sub(/\/$/, "") + "/"
|
56
|
-
|
57
|
-
matcher = %r{#{static_path}.*(#{exts})}
|
48
|
+
class FrontmatterManager
|
49
|
+
def initialize(app)
|
50
|
+
@app = app
|
51
|
+
@cache = {}
|
52
|
+
end
|
58
53
|
|
59
|
-
|
60
|
-
|
54
|
+
def data(path)
|
55
|
+
p = normalize_path(path)
|
56
|
+
@cache[p] ||= frontmatter_and_content(p)
|
61
57
|
end
|
58
|
+
|
59
|
+
def clear_data(file)
|
60
|
+
# Copied from Sitemap::Store#file_to_path, but without
|
61
|
+
# removing the file extension
|
62
|
+
file = File.expand_path(file, @app.root)
|
63
|
+
prefix = @app.source_dir.sub(/\/$/, "") + "/"
|
64
|
+
return unless file.include?(prefix)
|
65
|
+
path = file.sub(prefix, "")
|
62
66
|
|
63
|
-
|
64
|
-
frontmatter_extension.remove_file(file)
|
67
|
+
@cache.delete(path)
|
65
68
|
end
|
69
|
+
|
70
|
+
# Parse YAML frontmatter out of a string
|
71
|
+
# @param [String] content
|
72
|
+
# @return [Array<Hash, String>]
|
73
|
+
def parse_yaml_front_matter(content)
|
74
|
+
yaml_regex = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
75
|
+
if content =~ yaml_regex
|
76
|
+
content = content.sub(yaml_regex, "")
|
66
77
|
|
67
|
-
|
68
|
-
|
78
|
+
begin
|
79
|
+
data = YAML.load($1)
|
80
|
+
rescue => e
|
81
|
+
puts "YAML Exception: #{e.message}"
|
82
|
+
return false
|
83
|
+
end
|
69
84
|
|
70
|
-
fmdata = if self.frontmatter_extension.has_data?(relative_path)
|
71
|
-
self.frontmatter(relative_path)[0]
|
72
85
|
else
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
data = {}
|
77
|
-
%w(layout layout_engine).each do |opt|
|
78
|
-
data[opt.to_sym] = fmdata[opt] if fmdata.has_key?(opt)
|
86
|
+
return false
|
79
87
|
end
|
80
88
|
|
81
|
-
|
89
|
+
[data, content]
|
90
|
+
rescue
|
91
|
+
[{}, content]
|
82
92
|
end
|
93
|
+
|
94
|
+
def parse_json_front_matter(content)
|
95
|
+
json_regex = /^(\{\{\{\s*\n.*?\n?)^(\}\}\}\s*$\n?)/m
|
96
|
+
|
97
|
+
if content =~ json_regex
|
98
|
+
content = content.sub(json_regex, "")
|
83
99
|
|
84
|
-
|
85
|
-
|
100
|
+
begin
|
101
|
+
json = ($1+$2).sub("{{{", "{").sub("}}}", "}")
|
102
|
+
data = ActiveSupport::JSON.decode(json)
|
103
|
+
rescue => e
|
104
|
+
puts "JSON Exception: #{e.message}"
|
105
|
+
return false
|
106
|
+
end
|
86
107
|
|
87
|
-
|
88
|
-
|
108
|
+
else
|
109
|
+
return false
|
110
|
+
end
|
89
111
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
def frontmatter_did_change(path)
|
94
|
-
frontmatter_changed.each do |callback, matcher|
|
95
|
-
next if path.match(%r{^#{build_dir}/})
|
96
|
-
next if !matcher.nil? && !path.match(matcher)
|
97
|
-
instance_exec(path, &callback)
|
112
|
+
[data, content]
|
113
|
+
rescue
|
114
|
+
[{}, content]
|
98
115
|
end
|
99
|
-
end
|
100
|
-
|
101
|
-
# Get the frontmatter object
|
102
|
-
# @return [Middleman::CoreExtensions::FrontMatter::FrontMatter]
|
103
|
-
def frontmatter_extension
|
104
|
-
@_frontmatter_extension ||= FrontMatter.new(self)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Get the frontmatter for the given params
|
108
|
-
# @param [String] path
|
109
|
-
# @return [Hash, nil]
|
110
|
-
def frontmatter(*args)
|
111
|
-
frontmatter_extension.data(*args)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# Core Frontmatter class
|
116
|
-
class FrontMatter
|
117
|
-
|
118
|
-
# Initialize frontmatter with current app
|
119
|
-
# @param [Middleman::Application] app
|
120
|
-
def initialize(app)
|
121
|
-
@app = app
|
122
|
-
@source = File.expand_path(@app.source, @app.root)
|
123
|
-
@local_data = {}
|
124
116
|
|
125
|
-
#
|
126
|
-
@
|
127
|
-
|
128
|
-
|
117
|
+
# Get the frontmatter and plain content from a file
|
118
|
+
# @param [String] path
|
119
|
+
# @return [Array<Thor::CoreExt::HashWithIndifferentAccess, String>]
|
120
|
+
def frontmatter_and_content(path)
|
121
|
+
full_path = File.expand_path(path, @app.source_dir)
|
122
|
+
content = File.read(full_path)
|
123
|
+
|
124
|
+
if result = parse_yaml_front_matter(content)
|
125
|
+
data, content = result
|
126
|
+
elsif result = parse_json_front_matter(content)
|
127
|
+
data, content = result
|
129
128
|
else
|
130
|
-
|
129
|
+
data = {}
|
131
130
|
end
|
131
|
+
|
132
|
+
[::Middleman::Util.recursively_enhance(data).freeze, content]
|
132
133
|
end
|
133
|
-
end
|
134
|
-
|
135
|
-
# Whether the frontmatter knows about a path
|
136
|
-
# @param [String] path
|
137
|
-
# @return [Boolean]
|
138
|
-
def has_data?(path)
|
139
|
-
@local_data.has_key?(path.to_s)
|
140
|
-
end
|
141
|
-
|
142
|
-
# Update frontmatter if a file changes
|
143
|
-
# @param [String] file
|
144
|
-
# @return [void]
|
145
|
-
def touch_file(file)
|
146
|
-
extension = File.extname(file).sub(/\./, "")
|
147
|
-
return unless ::Tilt.mappings.has_key?(extension)
|
148
134
|
|
149
|
-
|
150
|
-
|
135
|
+
def normalize_path(path)
|
136
|
+
path.sub(@app.source_dir, "").sub(/^\//, "")
|
137
|
+
end
|
151
138
|
|
152
|
-
|
139
|
+
# Update the main sitemap resource list
|
140
|
+
# @return [void]
|
141
|
+
def manipulate_resource_list(resources)
|
142
|
+
resources.each do |r|
|
143
|
+
if !r.proxy? && r.data["ignored"] == true
|
144
|
+
r.frontmatter_ignored = true
|
145
|
+
end
|
146
|
+
end
|
153
147
|
|
154
|
-
|
155
|
-
data, content = result
|
156
|
-
|
157
|
-
data = ::Middleman::Util.recursively_enhance(data).freeze
|
158
|
-
file = file.sub(@app.source_dir, "")
|
159
|
-
@local_data[file] = [data, content]
|
160
|
-
path = File.join(@app.source_dir, file)
|
161
|
-
@app.cache.set([:raw_template, path], result[1])
|
162
|
-
@app.frontmatter_did_change(path)
|
148
|
+
resources
|
163
149
|
end
|
164
150
|
end
|
165
|
-
|
166
|
-
|
167
|
-
# @param [String] file
|
168
|
-
# @return [void]
|
169
|
-
def remove_file(file)
|
170
|
-
file = File.expand_path(file, @app.root)
|
171
|
-
file = file.sub(@app.source_dir, "")
|
151
|
+
|
152
|
+
module ResourceInstanceMethods
|
172
153
|
|
173
|
-
|
174
|
-
|
175
|
-
@app.cache.remove(:raw_template, path)
|
176
|
-
@local_data.delete(file)
|
154
|
+
def frontmatter_ignored?
|
155
|
+
@_frontmatter_ignored || false
|
177
156
|
end
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
# @param [String] path
|
182
|
-
# @return [Hash]
|
183
|
-
def data(path)
|
184
|
-
if @local_data.has_key?(path.to_s)
|
185
|
-
@local_data[path.to_s]
|
186
|
-
else
|
187
|
-
{}.freeze
|
157
|
+
|
158
|
+
def frontmatter_ignored=(v)
|
159
|
+
@_frontmatter_ignored = v
|
188
160
|
end
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
def parse_front_matter(content)
|
196
|
-
yaml_regex = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
197
|
-
if content =~ yaml_regex
|
198
|
-
content = content[($1.size + $2.size)..-1]
|
199
|
-
|
200
|
-
begin
|
201
|
-
data = YAML.load($1)
|
202
|
-
rescue => e
|
203
|
-
puts "YAML Exception: #{e.message}"
|
204
|
-
return false
|
161
|
+
|
162
|
+
def ignored?
|
163
|
+
if frontmatter_ignored?
|
164
|
+
true
|
165
|
+
else
|
166
|
+
super
|
205
167
|
end
|
168
|
+
end
|
206
169
|
|
207
|
-
|
208
|
-
|
170
|
+
# This page's frontmatter
|
171
|
+
# @return [Hash]
|
172
|
+
def data
|
173
|
+
app.frontmatter_manager.data(source_file).first
|
209
174
|
end
|
210
175
|
|
211
|
-
|
176
|
+
end
|
177
|
+
|
178
|
+
module InstanceMethods
|
179
|
+
|
180
|
+
# Access the Frontmatter API
|
181
|
+
def frontmatter_manager
|
182
|
+
@_frontmatter_manager ||= FrontmatterManager.new(self)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Get the template data from a path
|
186
|
+
# @param [String] path
|
187
|
+
# @return [String]
|
188
|
+
def template_data_for_file(path)
|
189
|
+
frontmatter_manager.data(path).last
|
190
|
+
end
|
191
|
+
|
212
192
|
end
|
213
193
|
end
|
214
194
|
end
|
@@ -1,136 +1,145 @@
|
|
1
1
|
# i18n Namespace
|
2
|
-
module Middleman
|
2
|
+
module Middleman
|
3
|
+
module CoreExtensions
|
4
|
+
module I18n
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
# Setup extension
|
7
|
+
class << self
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
# Once registerd
|
10
|
+
def registered(app)
|
11
|
+
app.set :locales_dir, "locales"
|
10
12
|
|
11
|
-
|
13
|
+
app.send :include, InstanceMethods
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
# Needed for helpers as well
|
16
|
+
app.after_configuration do
|
17
|
+
# This is for making the tests work - since the tests
|
18
|
+
# don't completely reload middleman, I18n.load_path can get
|
19
|
+
# polluted with paths from other test app directories that don't
|
20
|
+
# exist anymore.
|
21
|
+
::I18n.load_path.delete_if {|path| path =~ %r{tmp/aruba}}
|
22
|
+
::I18n.load_path += Dir[File.join(root, locales_dir, "*.yml")]
|
23
|
+
::I18n.reload!
|
24
|
+
end
|
25
|
+
end
|
26
|
+
alias :included :registered
|
17
27
|
end
|
18
|
-
end
|
19
|
-
alias :included :registered
|
20
|
-
end
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
class Localizer
|
30
|
+
def initialize(app)
|
31
|
+
@app = app
|
32
|
+
@maps = {}
|
33
|
+
end
|
27
34
|
|
28
|
-
|
29
|
-
|
35
|
+
def setup(options)
|
36
|
+
@options = options
|
30
37
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
@lang_map = @options[:lang_map] || {}
|
39
|
+
@path = @options[:path] || "/:locale/"
|
40
|
+
@templates_dir = @options[:templates_dir] || "localizable"
|
41
|
+
@mount_at_root = @options.has_key?(:mount_at_root) ? @options[:mount_at_root] : langs.first
|
35
42
|
|
36
|
-
|
37
|
-
|
38
|
-
|
43
|
+
if !@app.build?
|
44
|
+
puts "== Locales: #{langs.join(", ")}"
|
45
|
+
end
|
39
46
|
|
40
|
-
|
41
|
-
|
47
|
+
# Don't output localizable files
|
48
|
+
@app.ignore File.join(@templates_dir, "**")
|
42
49
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
@app.sitemap.provides_metadata_for_path do |url|
|
51
|
+
if d = get_localization_data(url)
|
52
|
+
lang, page_id = d
|
53
|
+
instance_vars = Proc.new {
|
54
|
+
::I18n.locale = lang
|
55
|
+
@lang = lang
|
56
|
+
@page_id = page_id
|
57
|
+
}
|
58
|
+
{ :blocks => [instance_vars] }
|
59
|
+
else
|
60
|
+
{}
|
61
|
+
end
|
62
|
+
end
|
56
63
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
64
|
+
@app.sitemap.register_resource_list_manipulator(
|
65
|
+
:i18n,
|
66
|
+
@app.i18n
|
67
|
+
)
|
68
|
+
end
|
62
69
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
+
def langs
|
71
|
+
@options[:langs] || begin
|
72
|
+
Dir[File.join(@app.root, @app.locales_dir, "*.yml")].map { |file|
|
73
|
+
File.basename(file).gsub(".yml", "")
|
74
|
+
}.sort.map(&:to_sym)
|
75
|
+
end
|
76
|
+
end
|
70
77
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
78
|
+
def get_localization_data(path)
|
79
|
+
@_localization_data ||= {}
|
80
|
+
@_localization_data[path]
|
81
|
+
end
|
75
82
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
83
|
+
# Update the main sitemap resource list
|
84
|
+
# @return [void]
|
85
|
+
def manipulate_resource_list(resources)
|
86
|
+
@_localization_data = {}
|
80
87
|
|
81
|
-
|
88
|
+
new_resources = []
|
82
89
|
|
83
|
-
|
84
|
-
|
90
|
+
resources.each do |resource|
|
91
|
+
next unless File.fnmatch(File.join(@templates_dir, "**"), resource.path)
|
85
92
|
|
86
|
-
|
93
|
+
page_id = File.basename(resource.path, File.extname(resource.path))
|
87
94
|
|
88
|
-
|
89
|
-
|
95
|
+
langs.map do |lang|
|
96
|
+
::I18n.locale = lang
|
90
97
|
|
91
|
-
|
92
|
-
|
98
|
+
localized_page_id = ::I18n.t("paths.#{page_id}", :default => page_id)
|
99
|
+
path = resource.path.sub(@templates_dir, "")
|
93
100
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
# Build lang path
|
102
|
+
if @mount_at_root == lang
|
103
|
+
prefix = "/"
|
104
|
+
else
|
105
|
+
replacement = @lang_map.has_key?(lang) ? @lang_map[lang] : lang
|
106
|
+
prefix = @path.sub(":locale", replacement.to_s)
|
107
|
+
end
|
101
108
|
|
102
|
-
|
103
|
-
|
104
|
-
|
109
|
+
path = ::Middleman::Util.normalize_path(
|
110
|
+
File.join(prefix, path.sub(page_id, localized_page_id))
|
111
|
+
)
|
105
112
|
|
106
|
-
|
113
|
+
@_localization_data[path] = [lang, path, localized_page_id]
|
107
114
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
115
|
+
p = ::Middleman::Sitemap::Resource.new(
|
116
|
+
@app.sitemap,
|
117
|
+
path
|
118
|
+
)
|
119
|
+
p.proxy_to(resource.path)
|
113
120
|
|
114
|
-
|
121
|
+
new_resources << p
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
resources + new_resources
|
115
126
|
end
|
116
127
|
end
|
117
|
-
|
118
|
-
resources + new_resources
|
119
|
-
end
|
120
|
-
end
|
121
128
|
|
122
|
-
|
123
|
-
|
129
|
+
# Frontmatter class methods
|
130
|
+
module InstanceMethods
|
124
131
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
132
|
+
# Initialize the i18n
|
133
|
+
def i18n
|
134
|
+
@_i18n ||= Localizer.new(self)
|
135
|
+
end
|
129
136
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
137
|
+
# Main i18n API
|
138
|
+
def localize(options={})
|
139
|
+
settings.after_configuration do
|
140
|
+
i18n.setup(options)
|
141
|
+
end
|
142
|
+
end
|
134
143
|
end
|
135
144
|
end
|
136
145
|
end
|