diff --git a/doc-src/HAML_CHANGELOG.md b/doc-src/HAML_CHANGELOG.md index b79a7986..bb2cbf9f 100644 --- a/doc-src/HAML_CHANGELOG.md +++ b/doc-src/HAML_CHANGELOG.md @@ -32,8 +32,8 @@ This has always been incorrect behavior, and in fact has never actually worked. The only difference is that now it will fail loudly. Second, Ruby 1.9 is now more fully supported, -especially with the {file:HAML_REFERENCE#htmlstyle_attributes_ new attribute syntax}. -Third, filters are no longer escaped when the {file:HAML_REFERENCE#escape_html-option `:escape_html` option} +especially with the {file:HAML_REFERENCE.md#htmlstyle_attributes_ new attribute syntax}. +Third, filters are no longer escaped when the {file:HAML_REFERENCE.md#escape_html-option `:escape_html` option} is enabled and `#{}` interpolation is used. ## [2.2.1](http://github.com/nex3/haml/commit/2.2.1) diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index c60a004f..86b06f5c 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -5,9 +5,12 @@ ## 2.2.4 -Don't add `require 'rubygems'` to the top of init.rb when installed -via `sass --rails`. This isn't necessary, and actually gets -clobbered as soon as haml/template is loaded. +* Don't add `require 'rubygems'` to the top of init.rb when installed + via `sass --rails`. This isn't necessary, and actually gets + clobbered as soon as haml/template is loaded. + +* Document the previously-undocumented {file:SASS_REFERENCE.md#line-option `:line` option}, + which allows the number of the first line of a Sass file to be set for error reporting. ## [2.2.3](http://github.com/nex3/haml/commit/2.2.3) diff --git a/doc-src/SASS_REFERENCE.md b/doc-src/SASS_REFERENCE.md index c621f767..4de784cd 100644 --- a/doc-src/SASS_REFERENCE.md +++ b/doc-src/SASS_REFERENCE.md @@ -186,6 +186,11 @@ Available options are: This is used solely for reporting errors, and is automatically set when using Rails or Merb. +{#line-option} `:line` +: The number of the first line of the Sass template. + Used for reporting line numbers for errors. + This is useful to set if the Sass template is embedded in a Ruby file. + {#load_paths-option} `:load_paths` : An array of filesystem paths which should be searched for Sass templates imported with the [`@import`](#import) directive. diff --git a/lib/sass/tree/prop_node.rb b/lib/sass/tree/prop_node.rb index 980f231f..07a0c64f 100644 --- a/lib/sass/tree/prop_node.rb +++ b/lib/sass/tree/prop_node.rb @@ -42,9 +42,9 @@ module Sass::Tree # @raise [Sass::SyntaxError] if the property uses invalid syntax def to_s(tabs, parent_name = nil) if @options[:property_syntax] == :old && @prop_syntax == :new - raise Sass::SyntaxError.new("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.") + raise Sass::SyntaxError.new("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.", @line) elsif @options[:property_syntax] == :new && @prop_syntax == :old - raise Sass::SyntaxError.new("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.") + raise Sass::SyntaxError.new("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.", @line) end if value[-1] == ?; diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index 6c576b49..e0335707 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -255,12 +255,14 @@ SASS rescue Sass::SyntaxError => e assert_equal("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.", e.message) + assert_equal(2, e.sass_line) else assert(false, "SyntaxError not raised for :property_syntax => :old") end begin render("a\n :b c", :property_syntax => :new) + assert_equal(2, e.sass_line) rescue Sass::SyntaxError => e assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.", e.message)