diff options
author | German M. Bravo <german.mb@deipi.com> | 2014-03-17 11:23:00 -0600 |
---|---|---|
committer | German M. Bravo <german.mb@deipi.com> | 2014-03-17 11:23:00 -0600 |
commit | bdfb8bf88f5b924633065a2f8043d858546d8b82 (patch) | |
tree | 5620f72ef1142c51784fd8f3407a1619c626112f /scss/rule.py | |
parent | 8a072850947088141584fdf20c51161e77fdd4c5 (diff) | |
download | pyscss-bdfb8bf88f5b924633065a2f8043d858546d8b82.tar.gz |
Added from_source_file and from_lineno to rules.
These should contain the source file and lineno of whatever the
resulting content of the rule comes from (if the rule is an @include,
these should contain the file and line where the mixin is.)
source_file and lineno must always contain the source file and line
where the rule appeared (if the rule is an @include, these should
contain the file and line where the @include appears.)
Diffstat (limited to 'scss/rule.py')
-rw-r--r-- | scss/rule.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/scss/rule.py b/scss/rule.py index 60fec68..52568d5 100644 --- a/scss/rule.py +++ b/scss/rule.py @@ -239,7 +239,11 @@ class SassRule(object): namespace=None, lineno=0, extends_selectors=frozenset(), ancestry=None, - nested=0): + nested=0, + from_source_file=None, from_lineno=0): + + self.from_source_file = from_source_file + self.from_lineno = from_lineno self.source_file = source_file self.import_key = import_key @@ -288,7 +292,10 @@ class SassRule(object): """Return the filename and line number where this rule originally appears, in the form "foo.scss:3". Used for error messages. """ - return "%s:%d" % (self.source_file.filename, self.lineno) + ret = "%s:%d" % (self.source_file.filename, self.lineno) + if self.from_source_file: + ret += " (%s:%d)" % (self.from_source_file.filename, self.from_lineno) + return ret @property def is_empty(self): @@ -313,6 +320,10 @@ class SassRule(object): return type(self)( source_file=self.source_file, lineno=self.lineno, + + from_source_file=self.from_source_file, + from_lineno=self.from_lineno, + unparsed_contents=self.unparsed_contents, options=self.options, |