Browse Source

Fixed combine test. Fixed stylus so that the include option is recognized

main
Lakshmi Vyasarajan 13 years ago
parent
commit
3171a53676
2 changed files with 20 additions and 8 deletions
  1. +14
    -6
      hyde/ext/plugins/stylus.py
  2. +6
    -2
      hyde/tests/ext/test_combine.py

+ 14
- 6
hyde/ext/plugins/stylus.py View File

@@ -50,13 +50,21 @@ class StylusPlugin(CLTransformer):
if len(afile.kind.strip()) == 0:
afile = File(afile.path + '.styl')
ref = self.site.content.resource_from_path(afile.path)

if not ref:
raise self.template.exception_class(
try:
include = self.settings.args.include
except AttributeError:
include = False
if not include:
raise self.template.exception_class(
"Cannot import from path [%s]" % afile.path)
ref.is_processable = False
return "\n" + \
self.template.get_include_statement(ref.relative_path) + \
"\n"
else:
ref.is_processable = False
return "\n" + \
self.template.get_include_statement(ref.relative_path) + \
"\n"
return '@import "' + path + '"\n'

text = import_finder.sub(import_to_include, text)
return text
@@ -101,7 +109,7 @@ class StylusPlugin(CLTransformer):
args.append(str(source))
try:
self.call_app(args)
except subprocess.CalledProcessError:
except subprocess.CalledProcessError, e:
raise self.template.exception_class(
"Cannot process %s. Error occurred when "
"processing [%s]" % (stylus.name, resource.source_file))


+ 6
- 2
hyde/tests/ext/test_combine.py View File

@@ -65,11 +65,15 @@ combine:
---

First line

""")
assert text == """First line
expected = """First line
var a = 1 + 2;
var b = a + 3;
var c = a + 5;"""
var c = a + 5;
"""

assert text == expected
return

def test_combine_remove(self):


Loading…
Cancel
Save