Skip to content

Commit

Permalink
Allow different indentation in the indented syntax. (#2309)
Browse files Browse the repository at this point in the history
Closes #2176
  • Loading branch information
nex3 committed Jun 9, 2017
1 parent 7ad03a9 commit d1c9d47
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 3 additions & 0 deletions doc-src/SASS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
[`<declaration-value>`][declaration-value] production in their argument list.
This will provide better forwards-compatibility for future CSS syntax.

* The indented syntax now allows different indentation to be used for different
lines, as long as they define a consistent tree structure.

[hex alpha spec]: https://drafts.csswg.org/css-color/#hex-notation
[directional focus spec]: https://www.w3.org/TR/css-ui-3/#nav-dir

Expand Down
4 changes: 0 additions & 4 deletions lib/sass/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,6 @@ def tree(arr, i = 0)
nodes = []
while (line = arr[i]) && line.tabs >= base
if line.tabs > base
raise SyntaxError.new(
"The line was indented #{line.tabs - base} levels deeper than the previous line.",
:line => line.index) if line.tabs > base + 1

nodes.last.children, i = tree(arr, i)
else
nodes << line
Expand Down
2 changes: 0 additions & 2 deletions test/sass/engine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ class SassEngineTest < MiniTest::Test
"a\n\t\tb: c\n\tb: c" => ["Inconsistent indentation: 1 tab was used for indentation, but the rest of the document was indented using 2 tabs.", 3],
"a\n b: c\n b: c" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 3],
"a\n b: c\n a\n d: e" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 4],
"a\n b: c\na\n d: e" => ["The line was indented 2 levels deeper than the previous line.", 4],
"a\n b: c\n a\n d: e" => ["The line was indented 3 levels deeper than the previous line.", 4],
"a\n \tb: c" => ["Indentation can't use both tabs and spaces.", 2],
"=a(" => 'Invalid CSS after "(": expected variable (e.g. $foo), was ""',
"=a(b)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was "b)"',
Expand Down

0 comments on commit d1c9d47

Please sign in to comment.