Merge pull request #2739 from DynamicDyno/sassify-filters

This commit is contained in:
Parker Moore 2014-08-12 23:54:17 -04:00
commit fac5a2eb02
2 changed files with 30 additions and 0 deletions

View File

@ -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.

View File

@ -34,6 +34,14 @@ class TestFilters < Test::Unit::TestCase
assert_equal "<p>something <strong>really</strong> simple</p>\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