diff --git a/middleman-core/features/helpers_link_to.feature b/middleman-core/features/helpers_link_to.feature index 746222e9..162c1e8a 100644 --- a/middleman-core/features/helpers_link_to.feature +++ b/middleman-core/features/helpers_link_to.feature @@ -1,5 +1,20 @@ Feature: link_to helper + Scenario: link_to works with blocks (erb) + Given the Server is running at "link-to-app" + When I go to "/link_to_erb.html" + Then I should see "erb with html tags" + + Scenario: link_to works with blocks (slim) + Given the Server is running at "link-to-app" + When I go to "/link_to_slim.html" + Then I should see "slim with html tags" + + Scenario: link_to works with blocks (haml) + Given the Server is running at "link-to-app" + When I go to "/link_to_haml.html" + Then I should see "haml with html tags" + Scenario: link_to produces relative links Given a fixture app "indexable-app" And an empty file named "config.rb" diff --git a/middleman-core/fixtures/link-to-app/config.rb b/middleman-core/fixtures/link-to-app/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/link-to-app/source/link_to_erb.html.erb b/middleman-core/fixtures/link-to-app/source/link_to_erb.html.erb new file mode 100644 index 00000000..20ceb513 --- /dev/null +++ b/middleman-core/fixtures/link-to-app/source/link_to_erb.html.erb @@ -0,0 +1,3 @@ +<% link_to "/" do %> + erb with html tags +<% end %> \ No newline at end of file diff --git a/middleman-core/fixtures/link-to-app/source/link_to_haml.html.haml b/middleman-core/fixtures/link-to-app/source/link_to_haml.html.haml new file mode 100644 index 00000000..7258f001 --- /dev/null +++ b/middleman-core/fixtures/link-to-app/source/link_to_haml.html.haml @@ -0,0 +1,2 @@ +- link_to "/" do + %s haml with html tags \ No newline at end of file diff --git a/middleman-core/fixtures/link-to-app/source/link_to_slim.html.slim b/middleman-core/fixtures/link-to-app/source/link_to_slim.html.slim new file mode 100644 index 00000000..847b9732 --- /dev/null +++ b/middleman-core/fixtures/link-to-app/source/link_to_slim.html.slim @@ -0,0 +1,2 @@ +- link_to "/" do + s slim with html tags \ No newline at end of file diff --git a/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb b/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb index 25628361..e66274c9 100644 --- a/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb +++ b/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb @@ -36,6 +36,12 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension # The helpers helpers do + + # Make all block content html_safe + def content_tag(name, content = nil, options = nil, &block) + mark_safe(super(name, mark_safe(content), options, &block)) + end + # Disable Padrino cache buster def asset_stamp false