diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 16a5ff38..6d70b200 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -25,6 +25,28 @@ module Jekyll converter.convert(input) end + # Convert a Sass string into CSS output. + # + # input - The Sass String to convert. + # + # Returns the CSS formatted String. + def sassify(input) + site = @context.registers[:site] + converter = site.getConverterImpl(Jekyll::Converters::Sass) + converter.convert(input) + end + + # Convert a Scss string into CSS output. + # + # input - The Scss String to convert. + # + # Returns the CSS formatted String. + def scssify(input) + site = @context.registers[:site] + converter = site.getConverterImpl(Jekyll::Converters::Scss) + converter.convert(input) + end + # Format a date in short format e.g. "27 Jan 2011". # # date - the Time to format. diff --git a/test/test_filters.rb b/test/test_filters.rb index f2480267..d43dc01b 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -34,6 +34,14 @@ class TestFilters < Test::Unit::TestCase assert_equal "
something really simple
\n", @filter.markdownify("something **really** simple") end + should "sassify with simple string" do + assert_equal "p {\n color: #123456; }\n", @filter.sassify("$blue:#123456\np\n color: $blue") + end + + should "scssify with simple string" do + assert_equal "p {\n color: #123456; }\n", @filter.scssify("$blue:#123456; p{color: $blue}") + end + should "convert array to sentence string with no args" do assert_equal "", @filter.array_to_sentence_string([]) end