From 6895f30ff33d5bac178ba3ad155b73716fe71ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20H=C3=B6ltje?= Date: Thu, 14 Aug 2014 22:15:17 -0400 Subject: [PATCH 1/5] Accept pandoc-style YAML frontmatter Pandoc (and some other tools) have decided to end their YAML frontmatter with `...` instead of `---`. In the name of flexibility, this patch allows either to mark the end of YAML frontmatter. Example: ``` --- title: No place like home ... ``` --- middleman-core/features/front-matter.feature | 11 +++++++++++ .../source/front-matter-pandoc.html.md.erb | 13 +++++++++++++ .../middleman-core/core_extensions/front_matter.rb | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 middleman-core/fixtures/frontmatter-app/source/front-matter-pandoc.html.md.erb diff --git a/middleman-core/features/front-matter.feature b/middleman-core/features/front-matter.feature index a0440f55..4625906f 100644 --- a/middleman-core/features/front-matter.feature +++ b/middleman-core/features/front-matter.feature @@ -21,6 +21,17 @@ Feature: YAML Front Matter Then I should see "This is a document" + Then I should see "

To be or not to be

" + Then I should see "The meaning of life is 42" + Then I should not see "..." + Then I should not see "layout: false" + Then I should not see "title: Pandoc likes trailing dots..." + + Scenario: YAML not on first line, no encoding Given the Server is running at "frontmatter-app" When I go to "/front-matter-line-2.html" diff --git a/middleman-core/fixtures/frontmatter-app/source/front-matter-pandoc.html.md.erb b/middleman-core/fixtures/frontmatter-app/source/front-matter-pandoc.html.md.erb new file mode 100644 index 00000000..b800a11b --- /dev/null +++ b/middleman-core/fixtures/frontmatter-app/source/front-matter-pandoc.html.md.erb @@ -0,0 +1,13 @@ +--- +layout: false +title: Pandoc likes trailing dots... +dotty_string: "..." +famous_quote: To be or not to be +popular_number: 42 +... + +# This is a document + +<%= current_page.data.famous_quote %> + +The meaning of life is <%= current_page.data.popular_number %>. diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb index b9f09647..ac683db7 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -119,7 +119,7 @@ module Middleman::CoreExtensions # @param [String] content # @return [Array] def parse_yaml_front_matter(content, full_path) - yaml_regex = /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m + yaml_regex = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m if content =~ yaml_regex content = content.sub(yaml_regex, '') From 51d57afc7364fa74dc089a616f4ef1076c1873db Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sun, 17 Aug 2014 13:20:29 -0700 Subject: [PATCH 2/5] require new compass, fix tests --- middleman-core/features/compass-sprites.feature | 2 +- middleman/middleman.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/middleman-core/features/compass-sprites.feature b/middleman-core/features/compass-sprites.feature index 2de35eb1..871c277a 100644 --- a/middleman-core/features/compass-sprites.feature +++ b/middleman-core/features/compass-sprites.feature @@ -3,4 +3,4 @@ Feature: Compass sprites should be generated on build and copied Given a successfully built app at "compass-sprites-app" When I cd to "build" Then the following files should exist: - | images/icon-s1a8aa64128.png | \ No newline at end of file + | images/icon-s0de2218f58.png | \ No newline at end of file diff --git a/middleman/middleman.gemspec b/middleman/middleman.gemspec index ab8ccab7..9ec12ff7 100644 --- a/middleman/middleman.gemspec +++ b/middleman/middleman.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.add_dependency("haml", [">= 4.0.5"]) s.add_dependency("sass", [">= 3.2.17", "< 4.0"]) s.add_dependency("compass-import-once", ["1.0.5"]) - s.add_dependency("compass", [">= 0.12.4"]) + s.add_dependency("compass", [">= 1.0.0", "< 2.0.0"]) s.add_dependency("uglifier", ["~> 2.5"]) s.add_dependency("coffee-script", ["~> 2.2"]) s.add_dependency("execjs", ["~> 2.0"]) From a1979f11b1a776abad6aa0c89dc47feb23d4dd40 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 20 Aug 2014 09:48:03 -0700 Subject: [PATCH 3/5] Update sass dep and test new error message --- middleman-core/features/slim.feature | 2 +- middleman-core/lib/middleman-core/renderers/sass.rb | 2 +- middleman/middleman.gemspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/middleman-core/features/slim.feature b/middleman-core/features/slim.feature index c415fefc..187600a1 100644 --- a/middleman-core/features/slim.feature +++ b/middleman-core/features/slim.feature @@ -74,4 +74,4 @@ Feature: Support slim templating language When I go to "/sass.html" Then I should see "html, body, div" When I go to "/error.html" - Then I should see "Syntax error" \ No newline at end of file + Then I should see "Error: Invalid" \ No newline at end of file diff --git a/middleman-core/lib/middleman-core/renderers/sass.rb b/middleman-core/lib/middleman-core/renderers/sass.rb index bf1578b7..00d786d9 100644 --- a/middleman-core/lib/middleman-core/renderers/sass.rb +++ b/middleman-core/lib/middleman-core/renderers/sass.rb @@ -86,7 +86,7 @@ module Middleman begin @engine.render rescue ::Sass::SyntaxError => e - ::Sass::SyntaxError.exception_to_css(e, full_exception: true) + ::Sass::SyntaxError.exception_to_css(e) end end diff --git a/middleman/middleman.gemspec b/middleman/middleman.gemspec index 9ec12ff7..11e4e871 100644 --- a/middleman/middleman.gemspec +++ b/middleman/middleman.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.add_dependency("middleman-core", Middleman::VERSION) s.add_dependency("middleman-sprockets", ">= 3.1.2") s.add_dependency("haml", [">= 4.0.5"]) - s.add_dependency("sass", [">= 3.2.17", "< 4.0"]) + s.add_dependency("sass", [">= 3.4.0", "< 4.0"]) s.add_dependency("compass-import-once", ["1.0.5"]) s.add_dependency("compass", [">= 1.0.0", "< 2.0.0"]) s.add_dependency("uglifier", ["~> 2.5"]) From 0d2bcbabe9b6bce2e460b18a33c592133c0d8f74 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 20 Aug 2014 09:48:55 -0700 Subject: [PATCH 4/5] Remove duplicate attr_accessor. Closes #1352 --- middleman-core/lib/middleman-core/sitemap/resource.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/middleman-core/lib/middleman-core/sitemap/resource.rb b/middleman-core/lib/middleman-core/sitemap/resource.rb index e86449d7..aadaf4f5 100644 --- a/middleman-core/lib/middleman-core/sitemap/resource.rb +++ b/middleman-core/lib/middleman-core/sitemap/resource.rb @@ -80,10 +80,6 @@ module Middleman @local_metadata[:blocks] += [block] if block_given? end - # The output/preview URL for this resource - # @return [String] - attr_accessor :destination_path - # Extension of the path (i.e. '.js') # @return [String] def ext From 18825e7ced0056efa7a011495b23758c9b792e8d Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Fri, 22 Aug 2014 09:36:07 -0700 Subject: [PATCH 5/5] no reason for image sizes to touch the alt attr --- .../lib/middleman-more/extensions/automatic_image_sizes.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb b/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb index 594e374a..56cb6ebf 100644 --- a/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb +++ b/middleman-core/lib/middleman-more/extensions/automatic_image_sizes.rb @@ -16,8 +16,6 @@ class Middleman::Extensions::AutomaticImageSizes < ::Middleman::Extension # @return [String] def image_tag(path, params={}) if !params.key?(:width) && !params.key?(:height) && !path.include?('://') - params[:alt] ||= '' - real_path = path real_path = File.join(images_dir, real_path) unless real_path.start_with?('/') full_path = File.join(source_dir, real_path)