Skip to content

Commit

Permalink
Better empty line check: Lines with only whitespace are considered em…
Browse files Browse the repository at this point in the history
…pty.
  • Loading branch information
netzpirat committed Nov 16, 2011
1 parent fbc1251 commit 68a3cfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/compiler.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/compiler.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ module.exports = class Compiler
if (@node instanceof Filter) and not @exitFilter

# Blank lines within a filter goes into the filter
if line is ''
if /^(\s)*$/.test(line)
@node.addChild(new Text('', @getNodeOptions({ parentNode: @node })))

# Detect if filter ends or if there is more text
Expand Down Expand Up @@ -207,7 +207,7 @@ module.exports = class Compiler
expression = result[2]

# Skip empty lines
continue if line is ''
continue if /^(\s)*$/.test(line)

# Look ahead for more attributes and add them to the current line
while /^%.*[{(]/.test(expression) and not /^(\s*)[%<]/.test(lines[0]) and /(?:(['"]?\w+[\w:-]*['"]?)\s*=\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[\w@.]+)|(['"]?\w+[\w:-]*['"]?)\s*=>\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[-\w@.()'"]+)|(['"]?\w+[\w:-]*['"]?):\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[-\w@.()'"]+))/.test(lines[0])
Expand Down

0 comments on commit 68a3cfe

Please sign in to comment.