Update tag classes moving into a module

This commit is contained in:
Tom Bell 2013-01-19 23:50:44 +00:00
parent 10d980b6e1
commit 2c45150545
4 changed files with 122 additions and 121 deletions

View File

@ -1,5 +1,5 @@
module Jekyll module Jekyll
module Tags
class HighlightBlock < Liquid::Block class HighlightBlock < Liquid::Block
include Liquid::StandardFilters include Liquid::StandardFilters
@ -71,7 +71,7 @@ module Jekyll
end end
end end
end
end end
Liquid::Template.register_tag('highlight', Jekyll::HighlightBlock) Liquid::Template.register_tag('highlight', Jekyll::Tags::HighlightBlock)

View File

@ -1,5 +1,5 @@
module Jekyll module Jekyll
module Tags
class IncludeTag < Liquid::Tag class IncludeTag < Liquid::Tag
def initialize(tag_name, file, tokens) def initialize(tag_name, file, tokens)
super super
@ -31,7 +31,7 @@ module Jekyll
end end
end end
end end
end
end end
Liquid::Template.register_tag('include', Jekyll::IncludeTag) Liquid::Template.register_tag('include', Jekyll::Tags::IncludeTag)

View File

@ -1,5 +1,5 @@
module Jekyll module Jekyll
module Tags
class PostComparer class PostComparer
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/ MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
@ -34,5 +34,6 @@ module Jekyll
end end
end end
end end
end
Liquid::Template.register_tag('post_url', Jekyll::PostUrl) Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl)

View File

@ -39,7 +39,7 @@ CONTENT
context "language name" do context "language name" do
should "match only the required set of chars" do should "match only the required set of chars" do
r = Jekyll::HighlightBlock::SYNTAX r = Jekyll::Tags::HighlightBlock::SYNTAX
assert_match r, "ruby" assert_match r, "ruby"
assert_match r, "c#" assert_match r, "c#"
assert_match r, "xml+cheetah" assert_match r, "xml+cheetah"
@ -55,19 +55,19 @@ CONTENT
context "initialized tag" do context "initialized tag" do
should "work" do should "work" do
tag = Jekyll::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"]) tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"])
assert_equal({}, tag.instance_variable_get(:@options)) assert_equal({}, tag.instance_variable_get(:@options))
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos ', ["test", "{% endhighlight %}", "\n"]) tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos ', ["test", "{% endhighlight %}", "\n"])
assert_equal({ 'linenos' => 'inline' }, tag.instance_variable_get(:@options)) assert_equal({ 'linenos' => 'inline' }, tag.instance_variable_get(:@options))
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table ', ["test", "{% endhighlight %}", "\n"]) tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table ', ["test", "{% endhighlight %}", "\n"])
assert_equal({ 'linenos' => 'table' }, tag.instance_variable_get(:@options)) assert_equal({ 'linenos' => 'table' }, tag.instance_variable_get(:@options))
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table nowrap', ["test", "{% endhighlight %}", "\n"]) tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table nowrap', ["test", "{% endhighlight %}", "\n"])
assert_equal({ 'linenos' => 'table', 'nowrap' => true }, tag.instance_variable_get(:@options)) assert_equal({ 'linenos' => 'table', 'nowrap' => true }, tag.instance_variable_get(:@options))
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"]) tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"])
assert_equal({ 'cssclass' => 'hl', 'linenos' => 'table' }, tag.instance_variable_get(:@options)) assert_equal({ 'cssclass' => 'hl', 'linenos' => 'table' }, tag.instance_variable_get(:@options))
end end
end end